Telnet Scripting Tool a.k.a TST10.exe

I have been thinking for a long time that i need to write about this tool that i found. Its quite interesting that this tool is really helpful in automating many of the routine sessions that i as a tester came across. This is by far the best automation tool that i found for telnet sessions.

Imagine these scenarios :

  • You need to do BSO authentications frequently when you switch networks
  • Get intermittent logs from the server for analysis
  • Run automated tests on remote systems (something which i have started to call as run-and-forget)
  • stuck in traffic…no way

Lets get into what this tool is and how to use it.

The tool is for windows (one of the things that i felt bad). To make use of this tool, u will need the exe file, i.e., tst10.exe and an input commands file. The input file will has the first line as the hostname/IP and port, which is followed by alternating SEND and WAIT commands.

Consider this example. I need to connect to a server of IP – 192.168.1.100, where a telnet service is running at PORT – 2300. This is how my script/input file will look like :

192.168.1.100 2300
SEND "\m"
WAIT "login:"
SEND "admin\m"
WAIT "Password:"
SEND "admin1\m"
WAIT "s1#"
SEND "co\m"
WAIT "s1(config)#"
SEND "show load; show cpu\m"
WAIT "s1(config)#"

“\m” = \n in C/PERL/Java/most programming langunages = CR or in non-techie terms “Enter”. SEND, sends the commands to be executed and the WAIT that follows tried to match the string in the output of the SEND commands before it.

How to run it?. There are 2 ways to do it. You can open up the command prompt navigate to the directory where the files are and then issue this command -

tst10.exe /r:IN /o:OUT

where IN is the input file and OUT stores the complete output of the session, so that you can skim through the file and have a look at what happened. OR, put the command in a batch file and double click it every time you need to run it.

Here is the screen capture -

tst10 Telnet Scripting Tool a.k.a TST10.exe

TST10 Screen Capture

How is it different from Net::Telnet module of Perl or something similar in TCL or Python? Think about it.

  • Time to write the code – 30min to ? depending upon how complex the situation is
  • Trying to match the output to with REGEX, which means that you need to spend time in coming up with the right regex. Now you have 2 problems in hand
  • Testing time to make sure that the script is robust enough

So this is perfect! NO. This doesn’t work for ssh sessions. Since telnet is getting substituted by ssh in most of the servers due to the secure nature of the connection its kind of difficult to fit it in a normal installation of Linux. I’m not sure about the telnet-ssh thingie happening in Solaris or any of the other servers.

Is there something like this for Linux? icon sad Telnet Scripting Tool a.k.a TST10.exe No. Hey, but look at it this way. Its some relief for us on windows platform for scripting.

You can build complex automatons with this combined with a little bit of Perl and Outlook. Here is one typical scenario that i made and which i have presented as a white-paper.

  • Outlook has a setting that detects for incoming mails with a specific subject line.
  • When the mail comes it evokes a Perl script.
  • The Perl script will go ahead an call the TST’s batch file, which initiates the TST10 session, connects to the remote server starts/runs the automation. The output will be stored in OUT file
  • The Perl script will skim the OUT file for any errors reported during the run.
  • Then it calls an FTP script that will go ahead and get the log files from the remote system
  • The log files are read, the results extracted and neatly formatted into mail and send to the required email-ids

icon smile Telnet Scripting Tool a.k.a TST10.exe sounds complex, but this script gave me enough time to hut for a new job and quit the previous employer.

Who wrote this? Someone by the name of Albert Yale. His home page is – http://ay.home.ml.org/, sadly the site is no longer online.

What happened to the white-paper? It got rejected icon wink Telnet Scripting Tool a.k.a TST10.exe , humor was not the order of the day.

Download TST10 : tst10.exe | tst10.zip

  • http://hi.baidu.com/zhitenglin ZhitengLin

    Use NTAutoScript
    more powerful than TST 1.0
    email zhitenglin@163.com
    reply you a copy.

  • Bret

    WOW, this works great.

    But, if you run this from a script via scheduled tasks make sure and unblock the application.

    THANKS!

  • http://www.gghorg.ca Bryan Dearlove

    hmmm, it is working well for me with one issue, it seems to double everything, so if I do:

    WAIT “User Name:”
    SEND “admin\m”
    WAIT “Password:”
    SEND “password\m”

    It will send admin and password twice…..

    • Diego

      Just remove the wait lines, I know the documentation said you can’t sent 2 send together, but it work I did try it.

    • @!!ex

      each second line in out file – just echo

  • http://www.myvpnreviews.com/ hublady

    thanks for your post,great info.

  • Dennis

    Linux/Unix has had this type of utility for many years.

    It is called “expect”

  • Pingback: superdrupermegapuper54321

  • George

    I’m glad you are hosting a copy of the file, I was having trouble tracking it down.

  • will

    How should I handle the long strings of text?
    For example, after loggin in with this

    192.168.1.1

    WAIT “Password:”

    SEND “1234\m”

    I get this

    7 [1;24r 8 [;H [2J [5;6HGetting [5;14HStarted [6;8H1. [6;11HGeneral [6;19HSetup [7;8H2. [7;11HWAN [7;15HBackup [7;22HSetup [8;8H3. [8;11HLAN [8;15HSetup [9;8H4. [9;11HInternet [9;20HAccess [9;27HSetup [10;8H [11;6HAdvanced [11;15HApplications [12;8H11. [12;12HRemote [12;19HNode [12;24HSetup [13;8H12. [13;12HStatic [13;19HRouting [13;27HSetup [14;8H14. [14;12HDial-in [14;20HUser [14;25HSetup [15;8H15. [15;12HNAT [15;16HSetup [16;8H [5;43HAdvanced [5;52HManagement [6;45H21. [6;49HFilter [6;56HSet [6;60HConfiguration [7;45H22. [7;49HSNMP [7;54HConfiguration [8;45H23. [8;49HSystem [8;56HSecurity [9;45H24. [9;49HSystem [9;56HMaintenance [10;45H25. [10;49HIP [10;52HRouting [10;60HPolicy [10;67HSetup [11;45H26. [11;49HSchedule [11;58HSetup [13;45H [14;45H [15;45H [14;45H99. [14;49HExit [21;27HEnter [21;33HMenu [21;38HSelection [21;48HNumber: [1;21HCopyright [1;31H(c) [1;35H1994 [1;40H- [1;42H2005 [1;47HZyXEL [1;53HCommunications [1;68HCorp. [1;21H [3;31HPrestige [3;40H660HW-61 [3;49HMain [3;54HMenu [3;31H [21;56H

    It’s the menu of the router, so it has loads of options and my question is, what should I put in the WAIT command so it let me keep moving? Is it possible to use a * to replace long strings or something similar?

    Thanks in advance.

    • Orlando

      That’s a Zyxel router. You don’t need to wait anything, just send “24″ then send “8″ and you are at the command line.

  • Orlando

    Do you know if there is a way to construct a loop for wait a certain time, or another way to do this, instead of wait for a text chain?
    Thanks for this, and kind regards.

  • http://toptwittertools.wordpress.com/category/twitter-stuff/ twitter stuff

    Some of these tools are new to me, maybe you could add them to my site for review.

  • http://www.emailsorterwizard.com Alec

    Wow! Fine contribution. Thank you!

  • gary

    anyone tried using this on nortel switches? I want to automate config backups… thanks

  • Trinity

    When I try using this on a Unix system it works great for accounts that don’t have passwords. However, when using an account that has a passwords (optimal of course), it hangs up at the first Wait after the password.

    WAIT “login:”
    SEND “account\m”
    WAIT “Password:”
    SEND “password\m”
    WAIT “system prompt” <– hangs up here waiting according to the current state window. "system prompt" is not actually what is sent as what is sent is system specific. This also happens if I remove the WAIT between the account login and the password SEND. Any ideas? Thanks.

  • Darren

    I’ve been using this tool and it’s great – with one exception. I can’t seem to run escape commands. Anything wrapped in the “” it treats as plain text, anything outside it, the session just ignores. Anyone found a solution to this?

  • Sandbird

    Its not working in Win7 x32 :( it crashes….
    Any ideas ?

  • arhip

    A newer version of TST utility — Telnet Scripter by Neo — can be downloaded here: http://www.neolics.com/index.php?s=software

  • http://www.haytone.cn Jack

    How to send “backspace” to TST10?

    Thanks in advance.

  • Pingback: If you want to get along, Go along. » Blog Archive » How To Automate Multiple Rapidshare Downloads

  • Jack

    why I send “20″ can not be excuted? Please help me!!

  • Jack

    How to capture all of content into a txt file with TST10? I type “32″ “3″ can not excuted.

  • Pingback: BSNL 500C Auto+Download b/w 2-8 AM - Digit's Technology Discussion Forum

  • Anna Rossi

    Hello! I tried to tst10 in order to telnet a Unix system from a W2000 server and it worked. Then I tried to reach a Windows CE device but it didn’t work
    This is the .txt I wrote :
    10.111.2.222
    WAIT “login:”
    SEND “adminm”
    WAIT “Password:”
    SEND “selestam”
    WAIT “\>”
    SEND “dirm”
    WAIT “\>”
    SEND “exitm”

    In effect when I put the command “manually” I obtain the following answers:
    (W: what I write R: what the terminal replies)
    W:telnet 10.111.2.222
    R:Welcome to the Windows CE Telnet Service on TAU35T890397
    R:login:
    W:admin
    R:Password:
    W:selesta
    R:
    R:
    R:Pocket CMD v 5.0
    R:>
    W:dir

    ecc
    Where is the error???

    • siva

      Hi ,

      I also have a similar kind of requirement.
      Will this tst10 works to telnet to a windows machine and run some scripts remotely.

      –siva

    • Rbologna

      just wait for “>” instead of “\>”

  • Pingback: Update date and time on Unix machine - Linux / UNIX Forum

  • Bigfoot18_ar

    i’m driving fuck*** mad , how can i pass the dot “.” (without the quotes) with tst10
    it goes flawless until i’ve got to finish typing the message

    data
    lalallal
    .

    send “datam”
    send “lalalaal ”
    send  “.” >> this is not working, also .   also  “.” also “.” 
    can someone point in the right direction?

  • Tongcc8

    found it was useful for me to remote reset the BB router, thanks!

  • Rbologna

    About this sentence: “Is there something like this for Linux? No. Hey, but look at it this way. Its some relief for us on windows platform for scripting.”

    Linux supports EXPECT that is similar

  • Jtang

    How to do do sleep? And how to send command such as ?
    Thanks,
    Joseph

  • Dk Ukedo

    Hi,

    i am trying to fire idsn through this script but it is not working…… any sugestion

  • Sanchit Rasiya

     Hi,

    I used your TST10 tool. It is a fantastic tool.

    But I am facing a little issue with it. Below is the description:

    File which I used as /r:

    192.168.200.2

    WAIT “login:”
    SEND “demoadmin”

    SEND “m”

    WAIT “password:”

    SEND “passwdm”

    etc..etc..

    So, the problem is when I am executing it it is taking login value as demoadminemoadmin instead of demoadmin due to which the login is getting failed.

    It will be a great pleasure for me if I can get a solution from you.

    • Asd

      no way to have 2 SEND commands in a row, must alternate with WAIT – right way: SEND “demoadminm”

      • Sanchit Rasiya

        That too doesn’t work! It manages the first input wrongly but after it everything is properly working. Thanks!

  • Mike

    Think you could make it possible to telnet into multiple devices from one input file? Right now to telnet into multiple devices you need to create multiple input files then script on top of this program.

  • Wahoo

    Hi, is there a way to send CTRL-Z in a script ? Thank you for the answer. I would like to use the script for use with GSM gateway Portech MV-370 and it requires the CTRL-Z at the end. Thank you for the answer.

  • Chamil

    Helo, Can anybody please tell me how to send DEL key using TST10, as I need to press DEL key during the telnet session. Thanking you,

  • Johnny Bravo

    Not accepting the password … wonder if i am missing a step.

    192.168.1.20
    SEND “m”
    WAIT “login:”
    SEND “abcm”
    WAIT “Password:”
    SEND “abc”
    WAIT “->”
    SEND “updateallm”
    WAIT “->”
    SEND “rebootm”

  • Johnny Bravo

    Fixed it … it had logged in, but was indicating incorrect login????

    Sending a couple more “m” appeared to kick the prompt into view, after which i passed the commands

    Also had to send the password twice … probably something to do with the timing i guess.

  • Martin Andersson

    Hi there. This program seemed like the stuff I needed until I tried to copy files from the computer running TST10 to the computer it is connected to. I then wrote “SEND “copy \\computername\folder\file.ext destination-folderm”.

    The first four ” was only interpreted as one. Any suggestions?

  • SteveCamper

    Amazing that in this day and age of technology that a little program like this works great! Great work!