Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import time
- def renew_ip_addr(modem_type, modem_username, modem_password, modem_address, platform):
- print "Resetting IP ..."
- url = ""
- command = ""
- if modem_username != "":
- url = "http://%s:%s@%s" % (modem_username, modem_password, modem_address)
- else:
- url = "http://%s" % modem_address
- if platform == "linux":
- command = "curl "
- if platform == "windows":
- command = "curl.exe "
- if modem_type == "Webstar":
- url = url + "/goform/RgSetup "
- 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"
- os.popen(disconnect)
- time.sleep(10)
- if modem_type == "Thomson TWG850":
- url = url + "/goform/RgDhcp "
- 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"
- os.popen(disconnect)
- time.sleep(15)
- if modem_type == "Paradigm":
- url = url + "/goform/formStatus "
- disconnect = command + url + " -d \"submit-url=/home.asp&submitppp0=Disconnect\" -silent"
- connect = command + url + " -d \"submit-url=/home.asp&submitppp0=Connect\" -silent"
- os.popen(disconnect)
- time.sleep(3)
- os.popen(connect)
- time.sleep(4)
- if modem_type == "Thomson TG782":
- os.system('"tst10.exe /r:reconnect.txt /m"');
- if modem_type == "Speedtouch 516i" or modem_type == "Speedtouch 780WL":
- disconnect = command + url + " -d \"0=13&1=Internet&5=2\" -silent"
- connect = command + url + " -d \"0=12&1=Internet&5=2\" -silent"
- os.popen(disconnect)
- time.sleep(5)
- os.popen(connect)
- time.sleep(10)
- if modem_type == "Speedtouch 546v6":
- disconnect = command + url + " -d \"0=13&1=Shared_Internet&5=2\ -silent"
- connect = command + url + " -d \"0=12&1=Shared_Internet&5=2\ -silent"
- os.popen(disconnect)
- time.sleep(5)
- os.popen(connect)
- time.sleep(10)
- if modem_type == "TP-Link TD-8817":
- url = url + "/Forms/status_deviceinfo_1"
- disconnect = command + url + " -d \"DvInfo_PVC=PVC0&PPPoEConn=Disconnect&PVC_or_Renew_or_Release=0\" -silent"
- connect = command + url + " -d \"DvInfo_PVC=PVC0&PPPoEConn=Connect&PVC_or_Renew_or_Release=0\" -silent"
- os.popen(disconnect)
- time.sleep(5)
- os.popen(connect)
- time.sleep(10)
- if modem_type == "Alice Gate VoIP":
- url = url + "/admin.cgi"
- 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"
- 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"
- os.popen(disconnect)
- time.sleep(5)
- os.popen(connect)
- time.sleep(10)
- if modem_type == "D-Link DSL-584T":
- url = url + "/cgi-bin/webcm"
- 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"
- 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"
- os.popen(disconnect)
- time.sleep(5)
- os.popen(connect)
- time.sleep(10)
- if modem_type == "Sagemcom Optima 1704":
- disconnect = command + url + "/wancfg.cmd?action=pppinterconn&pppcmd=Disconnect -silent"
- connect = command + url + " /wancfg.cmd?action=pppinterconn&pppcmd=Connect&pppUserName=jbozic16@optinet&pppPassword=326p&dddd=kkkk -silent"
- os.popen(disconnect)
- time.sleep(5)
- os.popen(connect)
- time.sleep(10)
- if modem_type == "Vodafone":
- disconnect = "reconnect.exe"
- os.popen(disconnect)
- time.sleep(9)
- if modem_type == "Linksys AM200":
- 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\""
- 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"
- 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"
- os.popen(login)
- time.sleep(3)
- os.popen(disconnect)
- time.sleep(5)
- os.popen(connect)
- time.sleep(10)
- if modem_type == "Siemens Gigaset SX763":
- login = command + url + "/UE/ProcessForm -d \"form_submission_type=login&form_submission_parameter=¤t_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\""
- disconnect = command + url + "/UE/ProcessForm -d \"form_submission_type=ok_submit&form_submission_parameter=¤t_page=home.html&next_page=home.html&0_set_IGD.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.V_ActionConnect=1\" -b \"cookies.txt\" -silent"
- connect = command + url + "/UE/ProcessForm -d \"form_submission_type=ok_submit&form_submission_parameter=¤t_page=home.html&next_page=home.html&0_set_IGD.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.V_ActionConnect=1\" -b \"cookies.txt\" -silent"
- os.popen(login)
- time.sleep(3)
- os.popen(disconnect)
- time.sleep(5)
- os.popen(connect)
- time.sleep(10)
- if modem_type == "D-Link DSL-584T":
- url = url + "/rebootinfo.cgi"
- connect = command + url + " -silent"
- os.popen(connect)
- time.sleep(20)
- if modem_type == "INB3040SRV":
- url = url + "/adv_menu.cgi"
- connect = command + url + " -silent -d \"todo=restart&message=\""
- os.popen(connect)
- time.sleep(8)
- if modem_type == "Exper ECM-01":
- url = url + "/rebootinfo.cgi"
- connect = command + url + " -silent"
- os.popen(connect)
- time.sleep(65)
- if modem_type == "D-Link DKT-710":
- url = url + "/reboot.html"
- connect = command + url + " -silent"
- os.popen(connect)
- time.sleep(20)
- if modem_type == "connection":
- if platform == "windows":
- os.popen("rasdial \"" + modem_address + "\" /DISCONNECT")
- time.sleep(8)
- os.popen("rasdial \"" + modem_address + "\" " + modem_username + " " + modem_password)
- time.sleep(8)
Add Comment
Please, Sign In to add comment