码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2016-06-17 22:24:13      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:

#幻境拨号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+"2007"+encryptStr2+account
 return encryptAccount

account=getAccount(account,password)
setClipboard(account)
print(account+\r\n加密账号已复制到剪贴板)
sendToRoute(account,password)

 

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

标签:

原文地址:http://www.cnblogs.com/ghostr/p/5595254.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!