Solved

running script *inside* telnet

Posted on 1997-08-05
1
319 Views
Last Modified: 2012-08-13
How can I run a script inside telnet?
I don't need to wait for an input, just send some text.
I tried "telnet address < script", where script is the script file, but it's too fast and the connection is lost.
I wrote a tiny filter that copies stdin to stdout after sleeping for a few seconds, but it also fails. I use it like this:
"cat script | delay | telnet address"
What am I doing wrong?
0
Comment
Question by:yairh
1 Comment
 
LVL 1

Accepted Solution

by:
ragnar earned 20 total points
ID: 2006630
Do the following as an example:

cat >> /homepath/telnet.error <<-EOF
telnet [host]
username
password
commands
...
...
...
logout
EOF

it is very important that you put no white spaces in the front or behind the commands or it won't work.  you can declare some of the items to be variables and the shell will expand them for you.  i would reccomend stripping read privs off the script since it must have the username & password in it.  you can do that by typeing chmod g-wrx,o-wrx [filename].

good luck and ask if you have questions!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question