使用Qpython3制作老版天翼飞TP路由器拨号脚本

#幻境拨号python版
#by 1414641776
account='xxxxxx@96301'
password='xxxxx' # 路由器脚本
def sendToRoute(account,password):
import urllib.request,base64
ip = '192.168.1.1'
login_user = 'admin'
login_pw = 'admin'
url="http://192.168.1.1/userRpm/PPPoECfgRpm.htm?wan=0&wantype=2&acc="+account+"&psw="+password+"&confirm="+password+"&specialDial=0&SecType=0&sta_ip=0.0.0.0&sta_mask=0.0.0.0&linktype=1&waittime=15&Connect=%C1%AC+%BD%D3"
auth =str(base64.b64encode((login_user+':'+login_pw).encode('utf-8')))
auth = 'Basic ' + auth[2:len(auth)-1]
heads = { 'Referer' : 'http://' + ip + '/userRpm/SysRebootRpm.htm',
'Authorization' : auth #'Basic YWRtaW46emhpZGlhbnpoZW5h'
}
request = urllib.request.Request(url, None, heads)
response = urllib.request.urlopen(request)
print(response.read()) #sl4a的Android的API调用
#剪贴板复制函数
def setClipboard(string):
import sl4a
droid = sl4a.Android()
droid.setClipboard(string) #md5加密函数
def md5(string):
import hashlib
m = hashlib.md5()
m.update(string.encode('utf-8'))
#参数必须是byte类型,否则报Unicode-objects must be encoded before hashing错误
md5=m.hexdigest()
return md5.upper() #天翼老版加密函数
def getAccount(account,password):
import time
now=time.localtime()
time_string = str(now[3])+str(now[4])+str(now[5])
encryptStr1 = md5(time_string)[0:8]
encryptStr2 = md5("jepyid"+account.upper()+encryptStr1+password.upper())[0:20]
encryptAccount = "~ghca"+encryptStr1+""+encryptStr2+account
return encryptAccount account=getAccount(account,password)
setClipboard(account)
print(account+'\r\n加密账号已复制到剪贴板')
sendToRoute(account,password)
上一篇:玩转spring boot——结合redis


下一篇:Comet技术