Jump to content

Recommended Posts

Posted

Hey, as im sure many of you have witnessed, routers can be kind of tempamental...ive written a function that would be called, if another part of my program that requires the internet to be active, can't access it...So, it would then restart the router as this is very likely to be the cause...

All ive written so far is...

Func RouterRestart()  
    
    $ip=IniRead("router.ini","settings","ipaddress","192.168.1.1")
    $port_numin=IniRead("router.ini","settings","portnumberin","23")
    $username=IniRead("router.ini","settings","username","admin")
    $password=IniRead("router.ini","settings","password","admin")
    $bootattempt=1
    
    TCPStartup();Start TCP
    
    $ping_test = Ping($ip, 5000);Check if router is on
    If @ERROR Then
        Call("RouterRestart")
    EndIf
    
    $portin=TCPConnect($ip,$portnumin);Connect using IP, on port "$port_numin"
    If $portin=-1 Then
        Call("RouterRestart")
    Else
        TCPSend($portin,$username);Send user name to login
        Sleep(500)
        TCPSend($portin,$password);Send password to login
        Sleep(500)
    EndIf
    
    $portout=TCPRecv($portin,2048);Checks login details
    If @ERROR Then
        Call("RouterRestart")
    Else
        
;HOW WOULD I WRITE THE REST SO THAT THE ROUTER COULD REBOOT
        
    EndIf

EndFunc

Assuming this all works, how would i sent a "reboot" signal to the router so that it would restart itself?? Also, if you can see mistakes in my code or suggestions, i would love to hear them! Thank You!

Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Posted (edited)

@furrycow...I am not sure it's possible the way you are doing it. I restart my router by using the IE functions. The scripts goes to the routers ip and simply clicks on the restart button. Done...

:)

Edited by DjDeep00
Posted

@furrycow...I am not sure it's possible the way you are doing it. I restart my router by using the IE functions. The scripts goes to the routers ip and simply clicks on the restart button. Done...

:)

DJDeep, does that mean yours opens an IE window and does MouseClick() when it reads restart? or something like IEAction($o_object,"click")? Also, i am kind of a newbie, and was wondering that with IEAction($o_object,"click"), does it need to open up a window so that it is visible or would i be able to do IECreate(invisible), and still simulate a click?? Thanks for getting back!

Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Posted

DJDeep, does that mean yours opens an IE window and does MouseClick() when it reads restart? or something like IEAction($o_object,"click")? Also, i am kind of a newbie, and was wondering that with IEAction($o_object,"click"), does it need to open up a window so that it is visible or would i be able to do IECreate(invisible), and still simulate a click?? Thanks for getting back!

@furrycow...the script I have uses all IE functions and no mouse clicks or send keys and its uses the invisible flag. :)

Posted

Another possibility, if the router supports telnet, is to use Teraterm to script a logon and reset. This is a very old program but a useful one as it has a good scripting language. (Well, not as good as AutoIt, but you know what I mean..)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...