Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Capture telnet output

  • 10-10-2005 03:47PM
    #1
    Registered Users, Registered Users 2 Posts: 21,265 ✭✭✭✭


    Hi Folks,

    Would appreciate a hand here:

    I am trying to automate a hit to a webserver on our LAN, and use the results to send an email to a specified person. The problem is that I can only get the output from the page when I run a telnet manually. If I try to automate it, the results do not appear.

    This is what I am doing at the moment:
    [me@server]echo "get /MyPage.asp" | telnet MyWebserver 80
    Trying <the ip address>
    Connected to MyWebserver
    Escape character is '^]'.
    Connection closed by foreign host.
    

    I know that the page is being hit properly, it's just that the results are not being captured. For instance, if I do it manually the results are outputted as expected.
    [me@server] $ telnet MyWebserver 80
    Trying <the ip address>
    Connected to MyWebserver
    Escape character is '^]'.
    get /MyPage.asp
    HTTP/1.1 200 OK
    Server: Microsoft-IIS/4.0
    Date: Mon, 10 Oct 2005 14:15:40 GMT
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDQQQGGQEX=FJGQMOPZDAIFCFLGIFOMIOKK; path=/
    Cache-control: private

    Name :
    Phone :
    Email :
    Connection closed by foreign host.

    Any tips would be appreciated...

    Eoin


Comments

  • Closed Accounts Posts: 95 ✭✭krinDar


    eoin_s wrote:
    I am trying to automate a hit to a webserver on our LAN, and use the results to send an email to a specified person.

    Do you really need to use telnet ? It is an awkward kludge - why not use
    one of a buch of existing utilies such as wget, curl, GET etc ?
    Any tips would be appreciated...

    Here is two:
    Methylated spirits is very useful for removing grease stains from glass.
    Include the OS that you are using when asking questions on the Unix
    board.


  • Registered Users, Registered Users 2 Posts: 21,265 ✭✭✭✭Eoin


    krinDar wrote:
    Do you really need to use telnet ? It is an awkward kludge - why not use
    one of a buch of existing utilies such as wget, curl, GET etc ?
    That would be the preferred option, but they are not installed on the server and our sysadmins are very slow to install extra utilities.
    krinDar wrote:
    Here is two:
    Methylated spirits is very useful for removing grease stains from glass.
    Include the OS that you are using when asking questions on the Unix
    board.

    Don't eat yellow snow is another handy one...

    It's Solaris 8.

    A colleague of mine actually sorted it out. If you put the commands into a shell script like so:
    #!/bin/sh
    echo open MyWebserver 80
    sleep 1
    echo get /MyPage.asp
    sleep 1
    echo exit
    

    and run it like this:
    ./myScript.sh | telnet
    

    The output is captured...

    Thanks anyway for the response.

    Eoin


Advertisement