Solved

running script *inside* telnet

Posted on 1997-08-05
1
322 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

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 …
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

717 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