Telnet script

Example telnet script. This one telnets my modem and displays the list of open ports (including dynamic ones)

  1. #!/bin/sh
  2. host=10.0.0.138
  3. port=23
  4. cmd="nat list"
  5.  
  6. ( echo open ${host} ${port}
  7. sleep 1
  8. echo -e "\r"
  9. sleep 1
  10. echo ${cmd}
  11. sleep 1
  12. echo -e "\r"
  13. sleep 1
  14. echo exit ) | telnet

6 comments

  1. TomBoss

    FirstPost
    (au cas ou)

  2. Francisco Dreyfuss

    VERY VERY VERY VERY VERY VERY VERY THANKS A LOT!!!!
    You saved me!!! God bless you 4 ever!!!

  3. Thanks!

    Thanks a lot for this, really appreciated!

  4. ottidsl

    Thx!
    Really needed that sort of thing to do a fine little router reconnecter on my ubuntu!

  5. LeMMiNGS

    Thanks a lot for this script, with a few mods it saved my life :D

  6. Leo

    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

Comments are closed.