Example telnet script. This one telnets my modem and displays the list of open ports (including dynamic ones)
- #!/bin/sh
- host=10.0.0.138
- port=23
- cmd="nat list"
- ( echo open ${host} ${port}
- sleep 1
- echo -e "\r"
- sleep 1
- echo ${cmd}
- sleep 1
- echo -e "\r"
- sleep 1
- echo exit ) | telnet
Shorter URL
Want to share or tweet this post? Please use this short URL: http://ozh.in/n


commented, on 04/May/04 at 12:15 am # :
FirstPost
(au cas ou)
said, on 20/Oct/05 at 11:30 pm # :
VERY VERY VERY VERY VERY VERY VERY THANKS A LOT!!!!
You saved me!!! God bless you 4 ever!!!
replied, on 10/Mar/08 at 10:07 pm # :
Thanks a lot for this, really appreciated!
replied, on 22/Mar/08 at 7:27 pm # :
Thx!
Really needed that sort of thing to do a fine little router reconnecter on my ubuntu!
thought, on 23/Jun/08 at 3:49 am # :
Thanks a lot for this script, with a few mods it saved my life :D
said, on 05/Nov/10 at 2:06 pm # :
Hi,
I want to make a script that telnet the device (not a computer) after every hour and dumps the data in database.
I have to run it from windows.
Kindly help me in this problem
Regards