Commits

gao shuai committed c1e68e9 Draft

lua and sh version

Comments (0)

Files changed (21)

cmcc_login.py

-#!/usr/bin/env python
-import cookielib, urllib2,urllib
-import re
-import os
-
-username = '18229467518'
-passwd = '103474'
-
-cj = cookielib.CookieJar()
-opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
-
-test = opener.open('http://xiaoxia.org')
-index = opener.open(test.url).read()
-print test.url
-sec=re.findall('window.location="(.*)"',index)[0]
-print sec
-
-
-wlanuserip=''
-wlanacname=''
-log_in_url="https://221.176.1.140/cmcc_mobile_do_login.php"
-
-print sec
-for i in sec.split("?")[1].split("&"):
-	print i
-	print i.split("=")
-	if i.split("=")[0]=="wlanuserip":
-		wlanuserip=i.split("=")[1]
-	if i.split("=")[0]=="wlanacname":
-		wlanacname=i.split("=")[1]
-	if i.split("=")[0]=="wlanacip":
-		wlanacip=i.split("=")[1]
-LogInpostData=\
-{"staticusername" : username,\
-"staticpassword" :passwd,\
-"loginmode":"static",\
-"wlanacname":wlanacname,
-"wlanuserip":wlanuserip,
-"wlanacip":wlanacip,
-"wlanacssid":"CMCC",
-"ualistindex":"UA0999"}
-LogInpostData=urllib.urlencode(LogInpostData)
-log_in=opener.open(log_in_url,LogInpostData)
-print log_in.url
-index=log_in.read()
-
-sec=re.findall('window.location="(.*)"',index)[0]
-print sec
-
-f=file("sec.txt","w+")
-f.write(sec)
-f.close()

cmcc_login_wlan_v.py

-#!/usr/bin/env python
-# http://221.176.1.140/wlan/index.php?wlanacname=0361.0371.371.00&wlanuserip=111.7.63.111&ssid=CMCC
-import cookielib, urllib2,urllib
-import re
-import os
-import datetime,os
-CWD=os.getcwd()
-
-_f=file(os.path.join(CWD,"config.txt"),"r")
-CONFIG=_f.readlines()
-_f.close()
-username=CONFIG[0].strip()
-passwd=CONFIG[1].strip()
-
-def w(name):
-	_f=file(os.path.join(CWD,name+".html"),"w+")
-	_f.write(driver.page_source.encode("utf8"))
-	print driver.page_source.encode("utf8")
-	_f.close()
-
-cj = cookielib.CookieJar()
-opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
-
-test = opener.open('http://xiaoxia.org')
-index = opener.open(test.url).read()
-print test.url
-sec=re.findall('window.location="(.*)"',index)[0]
-print sec
-
-log_in_url="https://221.176.1.140/do_login.php"
-wlanuserip=''
-wlanacname=''
-
-print sec
-for i in sec.split("?")[1].split("&"):
-	print i
-	print i.split("=")
-	if i.split("=")[0]=="wlanuserip":
-		wlanuserip=i.split("=")[1]
-	if i.split("=")[0]=="wlanacname":
-		wlanacname=i.split("=")[1]
-	if i.split("=")[0]=="wlanacip":
-		wlanacip=i.split("=")[1]
-LogInpostData=\
-{"staticusername" : username,\
-"staticpassword" :passwd,\
-"loginmode":"static",\
-"wlanacname":wlanacname,
-"wlanuserip":wlanuserip,
-"wlanacip":wlanacip,
-"wlanacssid":"CMCC",
-"ualistindex":"UA0999"}
-LogInpostData=urllib.urlencode(LogInpostData)
-
-log_in=opener.open(log_in_url,LogInpostData)
-print log_in.url
-index=log_in.read()
-
-sec=re.findall("""<frame src='(.*)' name='status'""",index)[0]
-print sec
-
-f=file("sec.txt","w+")
-f.write(sec)
-f.close()
-

cmcc_logout.py

-#!/usr/bin/env python
-import cookielib, urllib2,urllib
-import re
-import os
-
-cj = cookielib.CookieJar()
-opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
-
-
-f=file("sec.txt","r")
-sec=f.read()
-f.close()
-
-#logout
-LogOutpostData={}
-
-
-for ce in sec.split("?")[1].split("&"):
-	LogOutpostData[ce.split("=")[0]]=ce.split("=")[1]
-
-LogOutpostData["logouttype"]="TYPESUBMIT"
-
-
-LogOutpostData=urllib.urlencode(LogOutpostData)
-print LogOutpostData
-
-print opener.open('http://221.176.1.140/cmcc_mobile_do_logout.php',LogOutpostData).read()
-

cmcc_logout_wlan_v.py

-#!/usr/bin/env python
-import cookielib, urllib2,urllib
-import re
-import os
-
-cj = cookielib.CookieJar()
-opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
-
-
-f=file("sec.txt","r")
-sec=f.read()
-f.close()
-
-#logout
-LogOutpostData={}
-
-
-for ce in sec.split("?")[1].split("&"):
-	LogOutpostData[ce.split("=")[0]]=ce.split("=")[1]
-
-LogOutpostData["logouttype"]="TYPESUBMIT"
-
-
-LogOutpostData=urllib.urlencode(LogOutpostData)
-print LogOutpostData
-
-print opener.open('http://221.176.1.140/do_logout.php',LogOutpostData).read()
-

cmcc_xiaoxia.py

-#!/usr/bin/env python
-import cookielib, urllib2
-import re
-import os
-import random
-import time
-
-username = ''
-passwd = ''
-
-cj = cookielib.CookieJar()
-opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
-
-test = opener.open('http://xiaoxia.org')
-data = test.read()
-userip = re.search(r'NAME="wlanuserip" value="(.+)">', data).group(1)
-acname = re.search(r'NAME="wlanacname" value="(.+)">', data).group(1)
-acip = re.search(r'NAME="wlanacip" value="(.+)">', data).group(1)
-
-url = os.path.join(os.path.dirname(test.url), 'index.jsp')
-data = 'wlanuserip=%s&wlanacname=%s&wlanacip=%s' % (userip, acname, acip)
-print 'opening', url, data
-data = opener.open(url, data).read()
-
-url = os.path.join(os.path.dirname(test.url), 'jsp/do_login.jsp')
-data = 'bpssUSERNAME=%s&bpssBUSPWD=%s&' +\
- 'Submit=\xb5\xc7\xc2\xbc&bpssLoginType=1' % (username, passwd)
-print 'opening', url, data
-data = opener.open(url, data).read()
-print 'result', data

handle_user_status.py

-#!/usr/bin/env python
-import re
-import os
-f=file("user_status.htm","r")
-for l in f.readlines():
-    print re.findall(""" <input type="hidden" name="(.*)" value="(.*)">.*""",l)

lua/cmcc_Login.lua

+-------------------------------------------------------------------------------
+-- LuaSocket connector
+-- Facepunch Lua API
+-- Authors: Andrew McWatters
+--			Gran PC
+--			Gregor Steiner
+-------------------------------------------------------------------------------
+-- a small problem:
+-- URL mast with http://,
+ 
+local error = error
+local http = require( "socket.http" )
+local ltn12 = require( "ltn12" )
+local string = string
+local table = table
+ 
+facepunch={}
+facepunch.http={}
+ 
+function facepunch.http.get( URL, session )
+	local t = {}
+	local cookie = nil
+	if ( session and session.cookie ) then
+		cookie = session.cookie
+	end
+	local headers = {}
+	headers[ "Cookie" ] = cookie
+	local r, c, h = http.request({
+		url = URL,
+		sink = ltn12.sink.table( t ),
+		headers = headers
+	})
+	r = table.concat( t, "" )
+	if ( h ) then
+		t = {}
+		for k, v in pairs( h ) do
+			if ( k == "set-cookie" ) then
+				-- We remove expiration data here since it has commas in the given
+				-- timestamps, so it doesn't break us separating individual cookies
+				-- below
+				v = string.gsub( v, "(expires=.-; )", "" )
+				-- Grab set-cookie and append an additional separator for gmatch
+				-- convenience
+				v = v .. ", "
+				for cookie in string.gmatch( v, "(.-), " ) do
+					cookie = string.match( cookie, "(.-);" )
+					table.insert( t, cookie )
+				end
+			end
+		end
+		cookie = table.concat( t, ";" )
+	else
+		cookie = nil
+	end
+	-- r is retcontent,c is retcode,cookie just cookie
+	return r, c, cookie
+end
+ 
+function facepunch.http.post( URL, session, postData )
+	local t = {}
+	local cookie = nil
+	if ( session and session.cookie ) then
+		cookie = session.cookie
+	end
+	postData = postData or ""
+	local headers = {}
+	headers[ "Content-Type" ] = "application/x-www-form-urlencoded"
+	headers[ "Content-Length" ] = string.len( postData )
+	headers[ "Cookie" ] = cookie
+	local r, c, h = http.request( {
+		url = URL,
+		source = ltn12.source.string( postData ),
+		sink = ltn12.sink.table( t ),
+		method = "POST",
+		headers = headers,
+	}, postData )
+	r = table.concat( t, "" )
+	if ( h ) then
+		t = {}
+		for k, v in pairs( h ) do
+			if ( k == "set-cookie" ) then
+				-- We remove expiration data here since it has commas in the given
+				-- timestamps, so it doesn't break us separating individual cookies
+				-- below
+				v = string.gsub( v, "(expires=.-; )", "" )
+				-- Grab set-cookie and append an additional separator for gmatch
+				-- convenience
+				v = v .. ", "
+				for cookie in string.gmatch( v, "(.-), " ) do
+					cookie = string.match( cookie, "(.-);" )
+					table.insert( t, cookie )
+				end
+			end
+		end
+		cookie = table.concat( t, ";" )
+	else
+		cookie = nil
+	end
+	return r, c, cookie
+end
+
+r=[[
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+
+<head>
+<!--
+<WISPAccessGatewayParam xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespace SchemaLocation="http://www.acmewisp.com/WISPAccessGatewayParam.xsd">
+<Proxy>
+<MessageType>110</MessageType>
+<NextURL>http://cmccportal.aicent.net/gis.php?Hotspot_operator=CMCC&Hotspot_location=beijing&Nas_id=0361.0371.371.00&Nas_ip=221.176.119.178&User_ip=111.7.61.189&Portal_ip=221.176.1.140:80&Client_type=wispr</NextURL>
+<ResponseCode>200</ResponseCode>
+<Delay>2</Delay>
+</Proxy>
+</WISPAccessGatewayParam>
+-->
+<!-- cmcccs|login_req||-->
+<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
+<meta http-equiv="Cache-Control" content="no-cache">
+<link href='http://221.176.1.140:80/cmcc_mobile/mobile.css' rel='stylesheet' type='text/css' />
+<title>�й��ƶ� Wlan</title>
+
+
+</head>
+
+<body>
+<form name="loginform" action="https://221.176.1.140/wlan/index.php" method="post">
+
+<input  type="hidden" name="wlanacname" value="0361.0371.371.00">
+<input  type="hidden" name="wlanuserip" value="111.7.61.189">
+<input  type="hidden" name="wlanacssid" value="CMCC">
+<input  type="hidden" name="actiontype" value="LOGIN">
+<input  type="hidden" name="languagetype" value="">
+</form>
+</body>
+<script language="javascript">
+window.location="https://221.176.1.140:443/cmcc_mobile_input.php?wlanacip=221.176.119.178&wlanacname=0361.0371.371.00&wlanuserip=111.7.61.189&wlanacssid=CMCC&fromlocation=cmcc_index&ualistindex=UA0999";
+</script>
+</html>
+]]
+
+-- ���Ըɻ�Ŷ
+r,c,cookie=facepunch.http.get("http://www.baidu.com/")
+print (r.."\n"..c)
+print ("\n"..cookie)
+local string = require"string"
+username="13873772907"
+password="743482"
+local patters = { "wlanacip","wlanacname","wlanuserip", }
+login_data={wlancssid="CMCC",ualistindex="UA0999",loginmode="static",staticusername=username,staticpassword=password}
+for _,p in pairs(patters) do
+	i,j=string.find(r, string.format("%s=([0-9\.]*)",p))
+	i=i+string.len(p)+1
+	login_data[p]=string.sub(r,i,j)
+end
+login_data_post=""
+for k,v in pairs(login_data) do
+	print(k,v)
+	login_data_post=login_data_post..k.."="..v.."&"
+end
+print(login_data_post)
+login_url="http://221.176.1.140/do_login.php"
+r,c,cookie=facepunch.http.post(login_url,cookie,login_data_post)
+print (r.."\n"..c)
+print ("\n"..cookie)
+
+-- r="<frameset rows='600,*' border='0' framespacing='0' frameborder=0 marginwidth='0' marginheight='0'><frame src='http://221.176.1.140:80/user_status.php?username=13873772907&logonsessid=0361.0371.371.00;201209211451330416D6;ps003new&wlanacip=221.176.119.178&wlanacname=0361.0371.371.00&wlanuserip=111.7.61.189&logintime=2012-09-21 14:51:33&remaintime=0&areacode=731&wlanacssid=&productid=22&effecttime=20120327 000000&expiretime=20380101 000000&keystr=13f38b0aa34870b4037da6b101fb93ef3d17078d42e14504&cf=disabled' name='status' scrolling='no' marginwidth='0' marginheight='0'><noframes>"
+
+i,j=string.find(r,"src='(.*)' name='status'")
+ser=string.sub(r,i+5,j-15)
+print(ser)
+
+local cookiefile = io.open("cmcc_login_cookie_lua", "w+")
+cookiefile:write(cookie)
+cookiefile:close()

lua/cmcc_Login_localtest.lua

+-------------------------------------------------------------------------------
+-- LuaSocket connector
+-- Facepunch Lua API
+-- Authors: Andrew McWatters
+--			Gran PC
+--			Gregor Steiner
+-------------------------------------------------------------------------------
+-- a small problem:
+-- URL mast with http://,
+ 
+local error = error
+local http = require( "socket.http" )
+local ltn12 = require( "ltn12" )
+local string = string
+local table = table
+ 
+facepunch={}
+facepunch.http={}
+ 
+function facepunch.http.get( URL, session )
+	local t = {}
+	local cookie = nil
+	if ( session and session.cookie ) then
+		cookie = session.cookie
+	end
+	local headers = {}
+	headers[ "Cookie" ] = cookie
+	local r, c, h = http.request({
+		url = URL,
+		sink = ltn12.sink.table( t ),
+		headers = headers
+	})
+	r = table.concat( t, "" )
+	if ( h ) then
+		t = {}
+		for k, v in pairs( h ) do
+			if ( k == "set-cookie" ) then
+				-- We remove expiration data here since it has commas in the given
+				-- timestamps, so it doesn't break us separating individual cookies
+				-- below
+				v = string.gsub( v, "(expires=.-; )", "" )
+				-- Grab set-cookie and append an additional separator for gmatch
+				-- convenience
+				v = v .. ", "
+				for cookie in string.gmatch( v, "(.-), " ) do
+					cookie = string.match( cookie, "(.-);" )
+					table.insert( t, cookie )
+				end
+			end
+		end
+		cookie = table.concat( t, ";" )
+	else
+		cookie = nil
+	end
+	-- r is retcontent,c is retcode,cookie just cookie
+	return r, c, cookie
+end
+ 
+function facepunch.http.post( URL, session, postData )
+	local t = {}
+	local cookie = nil
+	if ( session and session.cookie ) then
+		cookie = session.cookie
+	end
+	postData = postData or ""
+	local headers = {}
+	headers[ "Content-Type" ] = "application/x-www-form-urlencoded"
+	headers[ "Content-Length" ] = string.len( postData )
+	headers[ "Cookie" ] = cookie
+	local r, c, h = http.request( {
+		url = URL,
+		source = ltn12.source.string( postData ),
+		sink = ltn12.sink.table( t ),
+		method = "POST",
+		headers = headers,
+	}, postData )
+	r = table.concat( t, "" )
+	if ( h ) then
+		t = {}
+		for k, v in pairs( h ) do
+			if ( k == "set-cookie" ) then
+				-- We remove expiration data here since it has commas in the given
+				-- timestamps, so it doesn't break us separating individual cookies
+				-- below
+				v = string.gsub( v, "(expires=.-; )", "" )
+				-- Grab set-cookie and append an additional separator for gmatch
+				-- convenience
+				v = v .. ", "
+				for cookie in string.gmatch( v, "(.-), " ) do
+					cookie = string.match( cookie, "(.-);" )
+					table.insert( t, cookie )
+				end
+			end
+		end
+		cookie = table.concat( t, ";" )
+	else
+		cookie = nil
+	end
+	return r, c, cookie
+end
+
+r=[[
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+
+<head>
+<!--
+<WISPAccessGatewayParam xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespace SchemaLocation="http://www.acmewisp.com/WISPAccessGatewayParam.xsd">
+<Proxy>
+<MessageType>110</MessageType>
+<NextURL>http://cmccportal.aicent.net/gis.php?Hotspot_operator=CMCC&Hotspot_location=beijing&Nas_id=0361.0371.371.00&Nas_ip=221.176.119.178&User_ip=111.7.61.189&Portal_ip=221.176.1.140:80&Client_type=wispr</NextURL>
+<ResponseCode>200</ResponseCode>
+<Delay>2</Delay>
+</Proxy>
+</WISPAccessGatewayParam>
+-->
+<!-- cmcccs|login_req||-->
+<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
+<meta http-equiv="Cache-Control" content="no-cache">
+<link href='http://221.176.1.140:80/cmcc_mobile/mobile.css' rel='stylesheet' type='text/css' />
+<title>�й��ƶ� Wlan</title>
+
+
+</head>
+
+<body>
+<form name="loginform" action="https://221.176.1.140/wlan/index.php" method="post">
+
+<input  type="hidden" name="wlanacname" value="0361.0371.371.00">
+<input  type="hidden" name="wlanuserip" value="111.7.61.189">
+<input  type="hidden" name="wlanacssid" value="CMCC">
+<input  type="hidden" name="actiontype" value="LOGIN">
+<input  type="hidden" name="languagetype" value="">
+</form>
+</body>
+<script language="javascript">
+window.location="https://221.176.1.140:443/cmcc_mobile_input.php?wlanacip=221.176.119.178&wlanacname=0361.0371.371.00&wlanuserip=111.7.61.189&wlanacssid=CMCC&fromlocation=cmcc_index&ualistindex=UA0999";
+</script>
+</html>
+]]
+
+-- ���Ըɻ�Ŷ
+-- r,c,cookie=facepunch.http.get("http://www.baidu.com/")
+-- print (r.."\n"..c)
+-- print ("\n"..cookie)
+local string = require"string"
+username="13873772907"
+password="743482"
+local patters = { "wlanacip","wlanacname","wlanuserip", }
+login_data={wlancssid="CMCC",ualistindex="UA0999",loginmode="static",staticusername=username,staticpassword=password}
+for _,p in pairs(patters) do
+	i,j=string.find(r, string.format("%s=([0-9\.]*)",p))
+	i=i+string.len(p)+1
+	login_data[p]=string.sub(r,i,j)
+end
+login_data_post=""
+for k,v in pairs(login_data) do
+	print(k,v)
+	login_data_post=login_data_post..k.."="..v.."&"
+end
+print(login_data_post)
+login_url="http://221.176.1.140/do_login.php"
+-- r,c,cookie=facepunch.http.post(login_url,cookie,login_data_post)
+-- print (r.."\n"..c)
+-- print ("\n"..cookie)
+
+r="<frameset rows='600,*' border='0' framespacing='0' frameborder=0 marginwidth='0' marginheight='0'><frame src='http://221.176.1.140:80/user_status.php?username=13873772907&logonsessid=0361.0371.371.00;201209211451330416D6;ps003new&wlanacip=221.176.119.178&wlanacname=0361.0371.371.00&wlanuserip=111.7.61.189&logintime=2012-09-21 14:51:33&remaintime=0&areacode=731&wlanacssid=&productid=22&effecttime=20120327 000000&expiretime=20380101 000000&keystr=13f38b0aa34870b4037da6b101fb93ef3d17078d42e14504&cf=disabled' name='status' scrolling='no' marginwidth='0' marginheight='0'><noframes>"
+
+i,j=string.find(r,"src='(.*)' name='status'")
+ser=string.sub(r,i+5,j-15)
+print(ser)
+local file = io.open("cmcc_login_info_lua", "w+")
+file:write(ser)
+file:close()
+local file = io.open("cmcc_login_cookie_lua", "w+")
+file:write(cookie)
+file:close()

lua/cmcc_Logout.lua

+-------------------------------------------------------------------------------
+-- LuaSocket connector
+-- Facepunch Lua API
+-- Authors: Andrew McWatters
+--			Gran PC
+--			Gregor Steiner
+-------------------------------------------------------------------------------
+-- a small problem:
+-- URL mast with http://,
+ 
+local error = error
+local http = require( "socket.http" )
+local ltn12 = require( "ltn12" )
+local string = string
+local table = table
+ 
+facepunch={}
+facepunch.http={}
+ 
+function facepunch.http.get( URL, session )
+	local t = {}
+	local cookie = nil
+	if ( session and session.cookie ) then
+		cookie = session.cookie
+	end
+	local headers = {}
+	headers[ "Cookie" ] = cookie
+	local r, c, h = http.request({
+		url = URL,
+		sink = ltn12.sink.table( t ),
+		headers = headers
+	})
+	r = table.concat( t, "" )
+	if ( h ) then
+		t = {}
+		for k, v in pairs( h ) do
+			if ( k == "set-cookie" ) then
+				-- We remove expiration data here since it has commas in the given
+				-- timestamps, so it doesn't break us separating individual cookies
+				-- below
+				v = string.gsub( v, "(expires=.-; )", "" )
+				-- Grab set-cookie and append an additional separator for gmatch
+				-- convenience
+				v = v .. ", "
+				for cookie in string.gmatch( v, "(.-), " ) do
+					cookie = string.match( cookie, "(.-);" )
+					table.insert( t, cookie )
+				end
+			end
+		end
+		cookie = table.concat( t, ";" )
+	else
+		cookie = nil
+	end
+	-- r is retcontent,c is retcode,cookie just cookie
+	return r, c, cookie
+end
+ 
+function facepunch.http.post( URL, session, postData )
+	local t = {}
+	local cookie = nil
+	if ( session and session.cookie ) then
+		cookie = session.cookie
+	end
+	postData = postData or ""
+	local headers = {}
+	headers[ "Content-Type" ] = "application/x-www-form-urlencoded"
+	headers[ "Content-Length" ] = string.len( postData )
+	headers[ "Cookie" ] = cookie
+	local r, c, h = http.request( {
+		url = URL,
+		source = ltn12.source.string( postData ),
+		sink = ltn12.sink.table( t ),
+		method = "POST",
+		headers = headers,
+	}, postData )
+	r = table.concat( t, "" )
+	if ( h ) then
+		t = {}
+		for k, v in pairs( h ) do
+			if ( k == "set-cookie" ) then
+				-- We remove expiration data here since it has commas in the given
+				-- timestamps, so it doesn't break us separating individual cookies
+				-- below
+				v = string.gsub( v, "(expires=.-; )", "" )
+				-- Grab set-cookie and append an additional separator for gmatch
+				-- convenience
+				v = v .. ", "
+				for cookie in string.gmatch( v, "(.-), " ) do
+					cookie = string.match( cookie, "(.-);" )
+					table.insert( t, cookie )
+				end
+			end
+		end
+		cookie = table.concat( t, ";" )
+	else
+		cookie = nil
+	end
+	return r, c, cookie
+end
+
+local serfile = io.open("cmcc_login_info_lua", "r")
+ser=serfile:read()
+-- print(ser)
+serfile:close()
+
+logout_data_post=string.sub(ser,string.len("http://221.176.1.140:80/user_status.php?")+1,string.len(ser)).."&logouttype=TYPESUBMIT"
+print(logout_data_post)
+
+local cookiefile = io.open("cmcc_login_cookie_lua", "r")
+cookie=cookiefile:read()
+cookiefile:close()
+
+logout_url='http://221.176.1.140/do_logout.php'
+r,c,cookie=facepunch.http.post(logout_url,cookie,logout_data_post)
+print (r.."\n"..c)
+print ("\n"..cookie)

lua/cmcc_login_info_lua

+http://221.176.1.140:80/user_status.php?username=13873772907&logonsessid=0361.0371.371.00;2012092115142103E63F;ps001new&wlanacip=221.176.119.178&wlanacname=0361.0371.371.00&wlanuserip=111.7.61.189&logintime=2012-09-21 15:14:21&remaintime=0&areacode=731&wlanacssid=&productid=22&effecttime=20120327 000000&expiretime=20380101 000000&keystr=13f38b0aa34870b4037da6b101fb93ef3d17078d42e14504&cf=disabled

python/cmcc_login.py

+#!/usr/bin/env python
+import cookielib, urllib2,urllib
+import re
+import os
+
+username = '18229467518'
+passwd = '103474'
+
+cj = cookielib.CookieJar()
+opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
+
+test = opener.open('http://xiaoxia.org')
+index = opener.open(test.url).read()
+print test.url
+sec=re.findall('window.location="(.*)"',index)[0]
+print sec
+
+
+wlanuserip=''
+wlanacname=''
+log_in_url="https://221.176.1.140/cmcc_mobile_do_login.php"
+
+print sec
+for i in sec.split("?")[1].split("&"):
+	print i
+	print i.split("=")
+	if i.split("=")[0]=="wlanuserip":
+		wlanuserip=i.split("=")[1]
+	if i.split("=")[0]=="wlanacname":
+		wlanacname=i.split("=")[1]
+	if i.split("=")[0]=="wlanacip":
+		wlanacip=i.split("=")[1]
+LogInpostData=\
+{"staticusername" : username,\
+"staticpassword" :passwd,\
+"loginmode":"static",\
+"wlanacname":wlanacname,
+"wlanuserip":wlanuserip,
+"wlanacip":wlanacip,
+"wlanacssid":"CMCC",
+"ualistindex":"UA0999"}
+LogInpostData=urllib.urlencode(LogInpostData)
+log_in=opener.open(log_in_url,LogInpostData)
+print log_in.url
+index=log_in.read()
+
+sec=re.findall('window.location="(.*)"',index)[0]
+print sec
+
+f=file("sec.txt","w+")
+f.write(sec)
+f.close()

python/cmcc_login_wlan_v.py

+#!/usr/bin/env python
+# http://221.176.1.140/wlan/index.php?wlanacname=0361.0371.371.00&wlanuserip=111.7.63.111&ssid=CMCC
+import cookielib, urllib2,urllib
+import re
+import os
+import datetime,os
+CWD=os.getcwd()
+
+_f=file(os.path.join(CWD,"config.txt"),"r")
+CONFIG=_f.readlines()
+_f.close()
+username=CONFIG[0].strip()
+passwd=CONFIG[1].strip()
+
+def w(name):
+	_f=file(os.path.join(CWD,name+".html"),"w+")
+	_f.write(driver.page_source.encode("utf8"))
+	print driver.page_source.encode("utf8")
+	_f.close()
+
+cj = cookielib.CookieJar()
+opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
+
+test = opener.open('http://xiaoxia.org')
+index = opener.open(test.url).read()
+print test.url
+sec=re.findall('window.location="(.*)"',index)[0]
+print sec
+
+log_in_url="https://221.176.1.140/do_login.php"
+wlanuserip=''
+wlanacname=''
+
+print sec
+for i in sec.split("?")[1].split("&"):
+	print i
+	print i.split("=")
+	if i.split("=")[0]=="wlanuserip":
+		wlanuserip=i.split("=")[1]
+	if i.split("=")[0]=="wlanacname":
+		wlanacname=i.split("=")[1]
+	if i.split("=")[0]=="wlanacip":
+		wlanacip=i.split("=")[1]
+LogInpostData=\
+{"staticusername" : username,\
+"staticpassword" :passwd,\
+"loginmode":"static",\
+"wlanacname":wlanacname,
+"wlanuserip":wlanuserip,
+"wlanacip":wlanacip,
+"wlanacssid":"CMCC",
+"ualistindex":"UA0999"}
+LogInpostData=urllib.urlencode(LogInpostData)
+
+log_in=opener.open(log_in_url,LogInpostData)
+print log_in.url
+index=log_in.read()
+
+sec=re.findall("""<frame src='(.*)' name='status'""",index)[0]
+print sec
+
+f=file("sec.txt","w+")
+f.write(sec)
+f.close()
+

python/cmcc_logout.py

+#!/usr/bin/env python
+import cookielib, urllib2,urllib
+import re
+import os
+
+cj = cookielib.CookieJar()
+opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
+
+
+f=file("sec.txt","r")
+sec=f.read()
+f.close()
+
+#logout
+LogOutpostData={}
+
+
+for ce in sec.split("?")[1].split("&"):
+	LogOutpostData[ce.split("=")[0]]=ce.split("=")[1]
+
+LogOutpostData["logouttype"]="TYPESUBMIT"
+
+
+LogOutpostData=urllib.urlencode(LogOutpostData)
+print LogOutpostData
+
+print opener.open('http://221.176.1.140/cmcc_mobile_do_logout.php',LogOutpostData).read()
+

python/cmcc_logout_wlan_v.py

+#!/usr/bin/env python
+import cookielib, urllib2,urllib
+import re
+import os
+
+cj = cookielib.CookieJar()
+opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
+
+
+f=file("sec.txt","r")
+sec=f.read()
+f.close()
+
+#logout
+LogOutpostData={}
+
+
+for ce in sec.split("?")[1].split("&"):
+	LogOutpostData[ce.split("=")[0]]=ce.split("=")[1]
+
+LogOutpostData["logouttype"]="TYPESUBMIT"
+
+
+LogOutpostData=urllib.urlencode(LogOutpostData)
+print LogOutpostData
+
+print opener.open('http://221.176.1.140/do_logout.php',LogOutpostData).read()
+

python/cmcc_xiaoxia.py

+#!/usr/bin/env python
+import cookielib, urllib2
+import re
+import os
+import random
+import time
+
+username = ''
+passwd = ''
+
+cj = cookielib.CookieJar()
+opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
+
+test = opener.open('http://xiaoxia.org')
+data = test.read()
+userip = re.search(r'NAME="wlanuserip" value="(.+)">', data).group(1)
+acname = re.search(r'NAME="wlanacname" value="(.+)">', data).group(1)
+acip = re.search(r'NAME="wlanacip" value="(.+)">', data).group(1)
+
+url = os.path.join(os.path.dirname(test.url), 'index.jsp')
+data = 'wlanuserip=%s&wlanacname=%s&wlanacip=%s' % (userip, acname, acip)
+print 'opening', url, data
+data = opener.open(url, data).read()
+
+url = os.path.join(os.path.dirname(test.url), 'jsp/do_login.jsp')
+data = 'bpssUSERNAME=%s&bpssBUSPWD=%s&' +\
+ 'Submit=\xb5\xc7\xc2\xbc&bpssLoginType=1' % (username, passwd)
+print 'opening', url, data
+data = opener.open(url, data).read()
+print 'result', data

python/config.txt

+13829107673
+252806

python/handle_user_status.py

+#!/usr/bin/env python
+import re
+import os
+f=file("user_status.htm","r")
+for l in f.readlines():
+    print re.findall(""" <input type="hidden" name="(.*)" value="(.*)">.*""",l)
+http://221.176.1.140:80/user_status.php?username=13829107673&logonsessid=0361.0371.371.00;2012092100203802F9AD;ps007&wlanacip=221.176.119.178&wlanacname=0361.0371.371.00&wlanuserip=111.7.63.111&logintime=2012-09-21 00:20:38&remaintime=0&areacode=200&wlanacssid=&productid=22&effecttime=20120831 000000&expiretime=20380101 000000&keystr=dad2e30fdc65841fce1cded0f6aeeee7713ef3bb731ae0dc&cf=disabled

sec.txt

-http://221.176.1.140:80/user_status.php?username=13829107673&logonsessid=0361.0371.371.00;2012092022550804BAAA;ps060&wlanacip=221.176.119.178&wlanacname=0361.0371.371.00&wlanuserip=111.7.63.111&logintime=2012-09-20 22:55:08&remaintime=0&areacode=200&wlanacssid=&productid=22&effecttime=20120831 000000&expiretime=20380101 000000&keystr=dad2e30fdc65841fce1cded0f6aeeee7713ef3bb731ae0dc&cf=disabled
+#!/bin/sh
+echo $(date) > /tmp/cmcc_date
+wget 'http://www.google.com.hk/' -O /tmp/cmcc_touch --save-cookies /tmp/cmcc_cookies --keep-session-cookies
+
+username="13873772907"
+password="743482"
+
+
+wlanuserip=$(cat /tmp/cmcc_touch |grep 'wlanacip=' |awk -F'&' '{print  $3}'|awk -F'=' '{print  $2}')
+wlanacname=$(cat /tmp/cmcc_touch |grep 'wlanacip=' |awk -F'&' '{print  $2}'|awk -F'=' '{print  $2}')
+wlanacip=$(cat /tmp/cmcc_touch |grep 'wlanacip=' |awk -F'&' '{print  $1}'|awk -F'=' '{print  $3}')
+echo wlanuserip=$wlanuserip
+echo wlanacip=$wlanacip
+echo wlanacname=$wlanacname
+
+login_url="http://221.176.1.140/do_login.php"
+echo login_url
+wget "${login_url}" --post-data "wlanuserip=${wlanuserip}&wlanacname=${wlanacname}&wlanacip=${wlanacip}&wlancssid=CMCCualistindex=UA0999&loginmode=static&staticusername=$username&staticpassword=$password" -O /tmp/cmcc_login --load-cookies /tmp/cmcc_cookies --keep-session-cookies
+login_info=$(cat /tmp/cmcc_login |grep "name='status'"|awk -F"'" '{print $12}')
+echo login_info:=$login_info
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.