?
Solved

running script *inside* telnet

Posted on 1997-08-05
1
Medium Priority
?
328 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 80 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

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

839 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