There will be times when you require automation of a telnet session. Although telnet program is considered to be an insecure method to connect to a device, there will be situation where you will need to use it, eg. telneting to your router, mail server etc.
The tool can be downloaded here, however we cannot support you on how to use it since we are the author but we’re making it available because it is getting very difficult to locate a copy of it elsewhere on the net.
Telnet Scripting Tool
We use this particular tool to automated opening of ports on our router only at certain time of the day & then closing those port automatically after the required time range. This would minimize hack attempts from outside of the network & reduces dictionary style or brute force type of attack from succeeding.
An example would be creating a text file (eg. create.txt) consist of the commands that you like to send to the router as follows;
192.168.1.100 23
WAIT “User :”
SEND “Admin\m”
WAIT “Password :”
SEND “poiuytr\m”
WAIT “=>”
SEND “nat create protocol=tcp inside_addr=192.168.1.106:3389 outside_addr=0.0.0.0:3389 \m”
WAIT “=>”
SEND “config save\m”
WAIT “=>”
SEND “exit\m”
WAIT “Connection to host lost.”
Create a batch file (eg. nat.bat) with the following line;
tst10.exe /r:create.txt /o:createout.txt /m
Set a scheduled task on your server to run the above batch & then set another task to delete the nat port mapping by done nat delete instead of create with the same parameters.
This script above is actually for Alcatel ST510 routers, thus it may differ from various models & makes. You may need to amend it accordingly. Basically, the WAIT is command to wait for remote to return & the SEND is the command to send to remote. The \m is the carriage return command to send to remote.
Other use of this tool would be for testing of your web, SMTP or POP3 servers which could save you a lot of typing.