Jump to content

Run telnet cmd ???


kctvt
 Share

Recommended Posts

Hi, i'm trying to write a programe can login to my modem, but i dont know how, so... I need help.

To login to modem, :

- open Cmd:

- type "telnet 192.168.1.1"

- It'll ask the username,and password . Such as, Pass and user is "Luku"

=> Login to modem.

So, how can we do that when using autoit ?

Link to comment
Share on other sites

First, make sure that the Telnet Client is installed on your PC -> C:\Windows\System32\Telnet.exe

If not, then you will have to add it using "Turn Windows Features On or Off" (Vista) or "Add/Remove Windows Components" (XP).

Second, check the AutoIt help file for the ShellExecute() function.

ShellExecute("telnet", "open 192.168.1.1")
Link to comment
Share on other sites

Personally I would use putty for this then you could FileInstall it and wouldn't have to worry about if it was there. You can download it Here and its free. Now it depends on what your trying to do but if your trying to automate the entire thing then you should use plink which is the command line version. I use it for backing up our network configurations and here is what I use

FileInstall("E:\plink.exe", @TempDir & "\plink.exe", 1)

$PID = Run(@TempDir & "\plink.exe -SSH -l " & $User & " -pw " & $Pass & " " & $Target & " copy run tftp:", "", @SW_HIDE, 7)
For $n = 1 To 45
    Sleep(1000)
    $OUT = StdoutRead($PID)
    If StringInStr($OUT, "Address or name of remote host []?") Then
        StdinWrite($PID, $IP & @CRLF & @CRLF)
        Sleep(5000)
        ExitLoop
    EndIf
Next

You can probibility modify it for your needs.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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