zoukankan      html  css  js  c++  java
  • 使用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+"2007"+encryptStr2+account
     return encryptAccount
    
    account=getAccount(account,password)
    setClipboard(account)
    print(account+'
    加密账号已复制到剪贴板')
    sendToRoute(account,password)
  • 相关阅读:
    tcp/ip_properties_file
    tcp_ip/udp
    笔记1
    css样式使用_css
    常用的html标签总结_html
    利用sqlalchemy(ORM框架)连接操作mysql_mysql
    mysql基础命令_mysql
    redis使用_python
    RabitMQ使用_python
    后台管理页面2种常用模板_html
  • 原文地址:https://www.cnblogs.com/ghostr/p/5595254.html
Copyright © 2011-2022 走看看