Grabbing data from telnet host

Discussion in 'Perl Misc' started by Mark, Apr 16, 2004.

  1. Mark

    Mark Guest

    I have a script setup to log into a host using the Net::Telnet CPAN
    module.
    It logs on to this host, sends a username and password and then sends
    some commands, prints a message to the screen and then closes the
    session.

    This is working fine for the purpose but I would like to modify it so
    that I can get a status of the host before I send commands to change
    the configuration of the host.

    I would like to do something like the following: (bear with me my
    psuedocode aint that great)

    get <system route table>
    put output -> $variable
    grep $variable "0.0.0.0 0.0.0.0 192.168.1.1" -> $newvariable
    if $newvariable = "0.0.0.0 0.0.0.0 192.168.1.1" then
    print = "Device online"
    else
    print = "Device not online"
    end if

    Any ideas?
     
    Mark, Apr 16, 2004
    #1
    1. Advertising

  2. Mark

    Anno Siegel Guest

    Mark <> wrote in comp.lang.perl.misc:
    > I have a script setup to log into a host using the Net::Telnet CPAN
    > module.
    > It logs on to this host, sends a username and password and then sends
    > some commands, prints a message to the screen and then closes the
    > session.
    >
    > This is working fine for the purpose but I would like to modify it so
    > that I can get a status of the host before I send commands to change
    > the configuration of the host.
    >
    > I would like to do something like the following: (bear with me my
    > psuedocode aint that great)
    >
    > get <system route table>
    > put output -> $variable
    > grep $variable "0.0.0.0 0.0.0.0 192.168.1.1" -> $newvariable
    > if $newvariable = "0.0.0.0 0.0.0.0 192.168.1.1" then
    > print = "Device online"
    > else
    > print = "Device not online"
    > end if
    >
    > Any ideas?


    Most people use ping for that.

    Anno
     
    Anno Siegel, Apr 16, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Forty Two

    Can ASP.NET emulate a Telnet host?

    Forty Two, Dec 24, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    4,730
    Forty Two
    Dec 25, 2004
  2. Orpheus66
    Replies:
    0
    Views:
    4,440
    Orpheus66
    Jul 30, 2003
  3. Jim Isaacson
    Replies:
    5
    Views:
    606
    Default User
    Nov 5, 2004
  4. Carcarius
    Replies:
    0
    Views:
    296
    Carcarius
    Dec 6, 2007
  5. Zhao Yi

    How to telnet to a host?

    Zhao Yi, Sep 7, 2008, in forum: Ruby
    Replies:
    1
    Views:
    108
    Zhao Yi
    Sep 7, 2008
Loading...

Share This Page