Jump to content

Recommended Posts

Posted (edited)

I'm searching a way to make a script for a simple TELNET login in my router, it would send username and password then would send a command and finally close telnet session, ALL of that using only AutoIT and without user interaction (AUTOMATED & HIDED).

If anyone wants to help me thanks in advance!

-----

What I want to automate? This:

(It's for reconnect to change IP, for the router of the ISP Arnet Discus DRG A112)

Start Menu > Run..: telnet 10.0.0.2

Username: admin

Password: alvlgeddl

Command 1: ppp config 0.0.33 down

Command 2: ppp config 0.0.33 up

Command 3: logout

-----

edit:

I made it!! YEAH! works fine full-auto.

But... have some problems because of my router, if session was not closed correctly or opens sessions too fast, it locks and not permit any more connections, even worse don't returns any error, just close your telnet session instantly after send "Start > Run..: telnet 10.0.0.2".

TcpStartUp ()
$RouterIP = tcpconnect("10.0.0.2", "23")
Do
Sleep(100)

Until $RouterIP <> "-1"
While 1
Sleep(100)

$TCPRecv = TCPRecv($RouterIP,"5000")

;~ ConsoleWrite($TCPRecv) ;for debug test
;~ MsgBox("","",$TCPRecv) ;for debug test

If StringInStr($TCPRecv, "Login:") > 0 Then
TCPSend($RouterIP, "admin" & @crlf)
ElseIf StringInStr($TCPRecv, "Password:") > 0 Then
TCPSend($RouterIP, "alvlgeddl" & @crlf)
TCPSend($RouterIP, "ppp config 0.0.33 down" & @crlf)
TCPSend($RouterIP, "ppp config 0.0.33 up" & @crlf)
TCPSend($RouterIP, "logout" & @crlf)
ElseIf StringInStr($TCPRecv, "have a nice day") > 0 Then
ExitLoop
EndIf
WEnd
TCPShutdown()
Edited by DarkBlood
  • 1 month later...
Posted (edited)

Thanks a lot man.. Saved a lot of nerves for me.. needed general idea how to go about implementing similar thing for SpeedTouch 780WL

Edited by shaqan

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...