In: , , ,
On: 2004 / 02 / 12 Viewed: 82267 times
Shorter URL for this post: http://ozh.in/n

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

Shorter URL

Want to share or tweet this post? Please use this short URL: http://ozh.in/n

Metastuff

This entry "Telnet script" was posted on 12/02/2004 at 1:17 pm and is tagged with , , ,
Watch this discussion : Comments RSS 2.0.

6 Blablas

  1. 1
    TomBoss France »
    replied, on 04/May/04 at 12:15 am # :

    FirstPost
    (au cas ou)

  2. 2
    Francisco Dreyfuss Brazil »
    commented, 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!!!

  3. 3
    Thanks! United Kingdom »
    wrote, on 10/Mar/08 at 10:07 pm # :

    Thanks a lot for this, really appreciated!

  4. 4
    ottidsl Austria »
    commented, 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!

  5. 5
    LeMMiNGS Brazil »
    thought, on 23/Jun/08 at 3:49 am # :

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

  6. 6
    Leo Pakistan »
    thought, 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

Leave a Reply

Comment Guidelines or Die

  • HTML: You can use these tags: <a href=""> <em> <i> <b> <strong> <blockquote>
  • Posting code: Post raw code (no <> &lt; etc) within appropriate tags : [php][/php], [css][/css], [html][/html], [js][/js], [sql][/sql], [xml][/xml], or generic [code][code]
  • Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar.
  • Spam: Various spam plugins on patrol. I'll put pins in a Voodoo doll if you spam me.
  • I will mark as Spam test comments, all comments with SEO names (ie "My Cool Online Shop" instead of "Joe") or containing forum-like signatures.

Read more ?

 « Alias 
 NAT list »