Jump to content
Sign in to follow this  
xeroTechnologiesLLC

telnet and stdinwrite stdoutread help request

Recommended Posts

xeroTechnologiesLLC

I'm working on a project to login to a cmts, get some basic data and then take that data to a text file.

I found the following link that sort of got me started:

...but I'm not sure what I am doing wrong.

When I setup my code and run it, nothing shows up at all and the process just runs forever.

Dim $ourTelnet, $ourRead, $totalRead = ""
EnvSet("TELNET_REDIR", "1")
$ourTelnet = Run("Console telnettelnet.exe", "console telnet", @SW_SHOW, 3)
$ourRead = StdoutRead($ourTelnet)
StdinWrite($ourTelnet, "open " & $ip & @CR)
Sleep(500)
While 1
$ourRead = StdoutRead($ourTelnet)
If StringInStr($ourRead, "Username:") > 0 Then
  MsgBox(0, "un", "username")
  StdinWrite($ourTelnet, $username & @CR)
ElseIf StringInStr($ourRead, "Password:") > 0 Then
  MsgBox(0, "pw", "password")
  StdinWrite($ourTelnet, $password & @CRLF)
ElseIf StringInStr($ourRead, "#") > 0 Then
  MsgBox(0, "#", "#")
  StdinWrite($ourTelnet, "exit" & @CR
        Run("notepad.exe")
        WinWait("Untitled")
        WinActivate("Untitled")
        send($totalRead)
ElseIf @error Then
  ExitLoop
Else
  ContinueLoop
EndIf
$totalRead &= $ourRead
WEnd

The telnet to the CMTS is the best option I have available to me at this time.

I was going through CMD, but as you can imagine... it's unreliable at best and when we are working outages of 5000 modems or more, we need reliability to be 100% :

I've attempted this a few times in the past but didn't have the time with the project load to follow through on it further and really want to hunker down and figure it out now that i have a little bit of time.

Any help, insight or direction pointing is always appreciated.

Thanks and happy coding!

edit:

i'm a moron...figured it out...

Found this link right after I posted this...

sorry guys... ;) to me

Edited by xeroTechnologiesLLC

Share this post


Link to post
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
Sign in to follow this  

×