Advertisement
Guest User

Broadcom BCM96338 ADSL2+ USB Bridge/Router

a guest
Aug 19th, 2016
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2. import time
  3.  
  4. def renew_ip_addr(modem_type, modem_username, modem_password, modem_address, platform):
  5.     print "Resetting IP ..."
  6.     url = ""
  7.     command = ""
  8.     if modem_username != "":
  9.         url = "http://%s:%s@%s" % (modem_username, modem_password, modem_address)
  10.     else:
  11.          url = "http://%s" % modem_address
  12.  
  13.     if platform == "linux":
  14.         command = "curl "
  15.     if platform == "windows":
  16.         command = "curl.exe "
  17.        
  18.     if modem_type == "Webstar":
  19.         url = url + "/goform/RgSetup "
  20.         disconnect = command + url + " -d \"LocalIpAddressIP0=192&LocalIpAddressIP1=168&LocalIpAddressIP2=0&LocalIpAddressIP3=1&WanLeaseAction=1&HostName=&DomainName=&StaticWanIpAddressIP0=0&StaticWanIpAddressIP1=0&StaticWanIpAddressIP2=0&StaticWanIpAddressIP3=0&StaticWanIpMaskIP0=0&StaticWanIpMaskIP1=0&StaticWanIpMaskIP2=0&StaticWanIpMaskIP3=0&GatewayIpAddressIP0=0&GatewayIpAddressIP1=0&GatewayIpAddressIP2=0&GatewayIpAddressIP3=0&PrimaryDnsIpAddressIP0=0&PrimaryDnsIpAddressIP1=0&PrimaryDnsI\" -silent"
  21.         os.popen(disconnect)
  22.         time.sleep(10)
  23.        
  24.     if modem_type == "Thomson TWG850":
  25.         url = url + "/goform/RgDhcp "
  26.         disconnect = command + url + " -d \"WanLeaseAction=1&WanConnectionType=0&Mtu=0&HostName=&DomainName=&SpoofedMacAddressMA0=00&SpoofedMacAddressMA1=00&SpoofedMacAddressMA2=00&SpoofedMacAddressMA3=00&SpoofedMacAddressMA4=00&SpoofedMacAddressMA5=00\" -silent"
  27.         os.popen(disconnect)
  28.         time.sleep(15)
  29.  
  30.     if modem_type == "Paradigm":
  31.         url = url + "/goform/formStatus "
  32.         disconnect = command + url + " -d \"submit-url=/home.asp&submitppp0=Disconnect\" -silent"
  33.         connect = command + url + " -d \"submit-url=/home.asp&submitppp0=Connect\" -silent"
  34.         os.popen(disconnect)
  35.         time.sleep(3)
  36.         os.popen(connect)
  37.         time.sleep(4)
  38.  
  39.     if modem_type == "Thomson TG782":
  40.         os.system('"tst10.exe /r:reconnect.txt /m"');
  41.  
  42.     if modem_type == "Speedtouch 516i" or modem_type == "Speedtouch 780WL":
  43.         disconnect = command + url + " -d \"0=13&1=Internet&5=2\" -silent"
  44.         connect = command + url + " -d \"0=12&1=Internet&5=2\" -silent"
  45.         os.popen(disconnect)
  46.         time.sleep(5)
  47.         os.popen(connect)
  48.         time.sleep(10)
  49.  
  50.     if modem_type == "Speedtouch 546v6":
  51.         disconnect = command + url + " -d \"0=13&1=Shared_Internet&5=2\ -silent"
  52.         connect = command + url + " -d \"0=12&1=Shared_Internet&5=2\ -silent"
  53.         os.popen(disconnect)
  54.         time.sleep(5)
  55.         os.popen(connect)
  56.         time.sleep(10)
  57.  
  58.     if modem_type == "TP-Link TD-8817":
  59.         url = url + "/Forms/status_deviceinfo_1"
  60.         disconnect = command + url + " -d \"DvInfo_PVC=PVC0&PPPoEConn=Disconnect&PVC_or_Renew_or_Release=0\" -silent"
  61.         connect = command + url + " -d \"DvInfo_PVC=PVC0&PPPoEConn=Connect&PVC_or_Renew_or_Release=0\" -silent"
  62.         os.popen(disconnect)
  63.         time.sleep(5)
  64.         os.popen(connect)
  65.         time.sleep(10)
  66.  
  67.     if modem_type == "Alice Gate VoIP":
  68.         url = url + "/admin.cgi"
  69.         disconnect = command + url + " -d \"active_page=9117&page_title=Stato+Modem&mimic_button_field=submit_button_disattiva%3A+nat..&button_value=&strip_page_top=0\" -silent"
  70.         connect = command + url + " -d \"active_page=9117&page_title=Stato+Modem&mimic_button_field=submit_button_attiva%3A+nat..&button_value=nat&strip_page_top=0\" -silent"
  71.         os.popen(disconnect)
  72.         time.sleep(5)
  73.         os.popen(connect)
  74.         time.sleep(10)
  75.  
  76.     if modem_type == "D-Link DSL-584T":
  77.         url = url + "/cgi-bin/webcm"
  78.         disconnect = command + url + " -d \"getpage=../html/status/deviceinfofile.htm&encaps0:settings/manual_conn=0&var:conid=encaps0&var:mycon=connection0&var:contype=&connection0:pppoe:command/stop=&var:judge=\" -silent"
  79.         connect = command + url + " -d \"getpage=../html/status/deviceinfofile.htm&encaps0:settings/manual_conn=1&var:conid=encaps0&var:mycon=connection0&var:contype=&connection0:pppoe:command/start=&var:judge=1\" -silent"
  80.         os.popen(disconnect)
  81.         time.sleep(5)
  82.         os.popen(connect)
  83.         time.sleep(10)
  84.  
  85.     if modem_type == "Sagemcom Optima 1704":
  86.         disconnect = command + url + "/wancfg.cmd?action=pppinterconn&pppcmd=Disconnect -silent"
  87.         connect = command + url + " /wancfg.cmd?action=pppinterconn&pppcmd=Connect&pppUserName=jbozic16@optinet&pppPassword=326p&dddd=kkkk -silent"
  88.         os.popen(disconnect)
  89.         time.sleep(5)
  90.         os.popen(connect)
  91.         time.sleep(10)
  92.  
  93.     if modem_type == "Vodafone":
  94.         disconnect = "reconnect.exe"
  95.         os.popen(disconnect)
  96.         time.sleep(9)
  97.  
  98.     if modem_type == "Linksys AM200":
  99.         login = command + url + "/cgi-bin/login.exe -d \"username=" + modem_username + "&password=" + modem_password + "&x=39&y=13&exec_cgis=login_CGI\" -c \"cookies.txt\""
  100.         disconnect = command + url + "/cgi-bin/cgi.exe -d \"delay=0&_f_no_write_config=1&cmd_btn=Disconnect&exec_cgis=StaM&ret_url=%2Findex.stm%3Ftitle%3DStatus-Modem\" -b \"cookies.txt\" -silent"
  101.         connect = command + url + "/cgi-bin/cgi.exe -d \"delay=0&_f_no_write_config=1&cmd_btn=Connect&exec_cgis=StaM&ret_url=%2Findex.stm%3Ftitle%3DStatus-Modem\" -b \"cookies.txt\" -silent"
  102.         os.popen(login)
  103.         time.sleep(3)
  104.         os.popen(disconnect)
  105.         time.sleep(5)
  106.         os.popen(connect)
  107.         time.sleep(10)
  108.  
  109.     if modem_type == "Siemens Gigaset SX763":
  110.         login = command + url + "/UE/ProcessForm -d \"form_submission_type=login&form_submission_parameter=&current_page=welcome_login.html&next_page=home.html&i=1&admin_role_name=administrator&operator_role_name=operator&subscriber_role_name=subscriber&choose_role=0&your_password=" + modem_password + "&Login=OK\" -c \"cookies.txt\""
  111.         disconnect = command + url + "/UE/ProcessForm -d \"form_submission_type=ok_submit&form_submission_parameter=&current_page=home.html&next_page=home.html&0_set_IGD.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.V_ActionConnect=1\" -b \"cookies.txt\" -silent"
  112.         connect = command + url + "/UE/ProcessForm -d \"form_submission_type=ok_submit&form_submission_parameter=&current_page=home.html&next_page=home.html&0_set_IGD.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.V_ActionConnect=1\" -b \"cookies.txt\" -silent"
  113.         os.popen(login)
  114.         time.sleep(3)
  115.         os.popen(disconnect)
  116.         time.sleep(5)
  117.         os.popen(connect)
  118.         time.sleep(10)
  119.  
  120.     if modem_type == "D-Link DSL-584T":
  121.         url = url + "/rebootinfo.cgi"
  122.         connect = command + url + " -silent"
  123.         os.popen(connect)
  124.         time.sleep(20)
  125.  
  126.     if modem_type == "INB3040SRV":
  127.         url = url + "/adv_menu.cgi"
  128.         connect = command + url + " -silent  -d \"todo=restart&message=\""
  129.         os.popen(connect)
  130.         time.sleep(8)
  131.  
  132.     if modem_type == "Exper ECM-01":
  133.         url = url + "/rebootinfo.cgi"
  134.         connect = command + url + " -silent"
  135.         os.popen(connect)
  136.         time.sleep(65)
  137.  
  138.     if modem_type == "D-Link DKT-710":
  139.         url = url + "/reboot.html"
  140.         connect = command + url + " -silent"
  141.         os.popen(connect)
  142.         time.sleep(20)
  143.  
  144.     if modem_type == "connection":
  145.         if platform == "windows":
  146.             os.popen("rasdial \"" + modem_address + "\" /DISCONNECT")
  147.             time.sleep(8)
  148.             os.popen("rasdial \"" + modem_address + "\" " + modem_username + " " + modem_password)
  149.             time.sleep(8)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement