Jump to content
rawkhopper

Help with learning TCP type stuff

Recommended Posts

Hello everybody,

I have a tool that I need to send some commands to over telnet.  I hate repetitive tasks.  AutoIt is great for removing the need for me to do repitive tasks.  Anyway when I am aligning a tool there are a few commands I send over telnet.  This changes the conditions of the tool for alignment.  I have a working script.  But I was going to try to make a gui to include several scripts into one so that I could just click the corresponding button.  Before I go that route I was wondering how hard it would be to get rid of plink.exe and use TCPConnect and such? Can someone one help me adapt this script to do that?  I am not a programmer I am a hack that tends to cut and paste until it works but was hoping to up my game with this little project.

Or is this project too difficult for someone like me?  Seems like once I have a simple script I could do a lot with it.  Please help!

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\Icons\Company.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <WindowsConstants.au3>
#include <Constants.au3>

If Not FileExists ("C:\Comany\Service\TelnetTools\") Then ; Checks to see if the Dir exists and creates it if it is not there
    DirCreate ("C:\Comany\Service\TelnetTools\")
EndIf

If Not FileExists ("C:\Comany\Service\TelnetTools\plink.exe") Then ; Checks to see if the File exists and creates it if it is not there
    FileInstall (".\plink.exe", "C:\Comany\Service\TelnetTools\plink.exe")
EndIf

Run ("C:\Comany\Service\TelnetTools\plink.exe 192.168.0.2 -l Comany -pw password -no-antispoof")

WinWait ("C:\Comany\Service\TelnetTools\plink.exe", "", 10)
Sleep (1000)

WinActivate ("C:\Comany\Service\TelnetTools\plink.exe")
Sleep (2000)

Send ("cmdtest")
Send("{Enter}")
Sleep (1000)

Send ("293")
Send("{Enter}")
Sleep (1000)

Send ("0")
Send ("{Enter}")
Sleep (1000)

Send ("fff")
Send ("{Enter}")
Sleep (1000)

Send ("logout")
Send ("{Enter}")
Sleep (500)

Exit

 

Share this post


Link to post
Share on other sites

There a very good examples in help file using TCP* functions.  Look under Network / TCPRecv function, there are 2 examples that can serve as the basis of your script.

Share this post


Link to post
Share on other sites

So I see lots of TCP examples but not much in the way of interacting with an existing telnet server.  Is this something that is difficult to do and requires a full telnet client?

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...