Telnet in a script

Telnet in a script

Post by harikrishn.. » Wed, 22 Dec 1999 04:00:00



Hi:

How do I invoke telnet inside a ksh script. Like i want to telnet to
port 80(http) of a machine do a GET /some.html and come out of that
script.

Any Help WOW will be a life saver

Thanks

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

Telnet in a script

Post by Tony Curti » Wed, 22 Dec 1999 04:00:00



> How do I invoke telnet inside a ksh script. Like i want to telnet to
> port 80(http) of a machine do a GET /some.html and come out of that
> script.

expect will help you here.

OTOH writing this in a language like perl would be a
major win since it supports lots of nice WWW/HTTP
modules.

Or, you could get URLs using something like "lynx".

It would be more helpful to say what it is you want
to do in terms of the problem you're trying to
solve.

hth
tony

 
 
 

Telnet in a script

Post by Jim Levi » Thu, 23 Dec 1999 04:00:00


Quote:>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<


Telnet in a script:

Quote:> Hi:
> How do I invoke telnet inside a ksh script. Like i want to telnet to
> port 80(http) of a machine do a GET /some.html and come out of that
> script.

You could do it with an Expect script, but it would be easier to do
with wget (www.gnu.org) as it's designed for non-interactive fetching
of things off of web servers.
--
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
+=+
  Jim Levie                               email:

  Dynetics, Inc.  Huntsville, AL          phone: (256) 964-4337
  The opinions expressed above are just that...
 
 
 

Telnet in a script

Post by Robert B. Kast » Fri, 24 Dec 1999 04:00:00




>> How do I invoke telnet inside a ksh script. Like i want to telnet to
>> port 80(http) of a machine do a GET /some.html and come out of that
>> script.
> Or, you could get URLs using something like "lynx".

"wget" is probably a better choice for getting URLs--it's lighter
weight for one. It should be available at a GNU mirror.

Opinions expressed herein are my own and may not represent those of my employer.

 
 
 

Telnet in a script

Post by local.. » Fri, 24 Dec 1999 04:00:00


The best way is abandoning the SHELL interpreter,

I had wroten such a program using PERL+PERL MODULE

very easy,the module is powerful.

you can find the on CPAN.

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

Telnet in a script

Post by Michael B. Trausc » Wed, 29 Dec 1999 04:00:00



> Hi:

> How do I invoke telnet inside a ksh script. Like i want to telnet to
> port 80(http) of a machine do a GET /some.html and come out of that
> script.

> Any Help WOW will be a life saver

> Thanks

telnet somehost.com 80 < command-file > output

command-file is the name of the file which commands to telnet are put
in.  it would read as follows

GET /path/to/file.html

and output would be the output from the webserver.

Very simple.

        - Mike

--
                              ,-._.-._.-._.-._.-.
                              `-.             ,-'
                                |             |     Michael B. Trausch

|   I love Linux!  In    |      |             |     AIM:  CSMFSOBW
| fact, so does my mom!  |      |             |     ----------------------
|                        |     ,';".________.-.     Need your computer
|   Wait'll I tell Big   |     ;';_'         )]     upgraded or repaired?
|    Bill that my mom    |    ;             `-|     E-mail me!
|      uses Linux!       `.    `T-            |     ----------------------
 `----------------------._ \    |             |
                          `-;   |             |
                                |..________..-|
                               /\/ |________..|
                          ,'`./  >,(           |
                          \_.-|_/,-/   ii  |   |
                           `."' `-/  .-"""||    |
                            /`^"-;   |    ||____|
                           /     /   `.__/  | ||
                                /           | ||
                                            | ||

 Sent via Deja.com http://www.deja.com/
 Before you buy.

 
 
 

Telnet in a script

Post by Andrew Gabri » Wed, 29 Dec 1999 04:00:00




Quote:

>telnet somehost.com 80 < command-file > output
>Very simple.

Unfortunately, too simple to work :-)

--
Andrew Gabriel
Consultant Software Engineer

 
 
 

Telnet in a script

Post by Robert McGra » Wed, 29 Dec 1999 04:00:00





> >telnet somehost.com 80 < command-file > output

> >Very simple.

> Unfortunately, too simple to work :-)

You might want to look a wget.  http://www.sunfreeware.com/

Robert

Quote:

> --
> Andrew Gabriel
> Consultant Software Engineer

--


Computer Systems Manager            VOICE:   (505) 434-7038
National Solar Observatory/SP       FAX:     (505) 434-7029
Sunspot, NM 88349 USA               WWW: http://www.sunspot.noao.edu

  mcgraw.vcf
< 1K Download
 
 
 

Telnet in a script

Post by Jan Bir » Thu, 30 Dec 1999 04:00:00


Telnet is an interactive appliacation, so I do not belive that you can
redirect anything to it. But if you use "expect" telnet will think that you
are typing at the keyboard.

Ex:

#!/usr/local/bin/expect -f
spawn telnet HOSTNAME 80
send "GET index.phtml\r"
expect eof

Best regards

Jan Birk



...


> > Hi:

> > How do I invoke telnet inside a ksh script. Like i want to telnet to
> > port 80(http) of a machine do a GET /some.html and come out of that
> > script.

> > Any Help WOW will be a life saver

> > Thanks

> telnet somehost.com 80 < command-file > output

> command-file is the name of the file which commands to telnet are put
> in.  it would read as follows

> GET /path/to/file.html

> and output would be the output from the webserver.

> Very simple.

> - Mike

> --
>                               ,-._.-._.-._.-._.-.
>                               `-.             ,-'
>                                 |             |     Michael B. Trausch

> |   I love Linux!  In    |      |             |     AIM:  CSMFSOBW
> | fact, so does my mom!  |      |             |     ----------------------
> |                        |     ,';".________.-.     Need your computer
> |   Wait'll I tell Big   |     ;';_'         )]     upgraded or repaired?
> |    Bill that my mom    |    ;             `-|     E-mail me!
> |      uses Linux!       `.    `T-            |     ----------------------
>  `----------------------._ \    |             |
>                           `-;   |             |
>                                 |..________..-|
>                                /\/ |________..|
>                           ,'`./  >,(           |
>                           \_.-|_/,-/   ii  |   |
>                            `."' `-/  .-"""||    |
>                             /`^"-;   |    ||____|
>                            /     /   `.__/  | ||
>                                 /           | ||
>                                             | ||

>  Sent via Deja.com http://www.deja.com/
>  Before you buy.

 
 
 

1. telnet 0 vs telnet `hostname` vs telnet 127.0.0.1

Hello all,

    I have a question in networking

What does the command telnet 0 do? I know it will telnet to itself, but does
it go through anything? I mean gateway and anything else? How is it
different from telnet-ing to its nodename? Also What about "telnet
127.0.0.1?" All these telnet do the same thing but are they different? and
How?

Regards,

Benny Pei

2. buffer-layer cleanup

3. telnet shell script

4. IRCd 2.8.21 on FreeBSD 2.1.0 | HELP |

5. Automating telnet connection from shell script

6. Linux 1.0.9 and UMSDOS 0.3a

7. telnet script

8. LINUX featuring ORACLE 7

9. Script to telnet to remote units and execute commands

10. Telnet/ftp in scripts?

11. telnet from a script

12. Telnet scripting problem

13. using telnet in a script