Help With Script Line - Telnet


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help With Script Line - Telnet
# 1  
Old 04-17-2009
Help With Script Line - Telnet

I am running Ubunto 8.10 and I am trying to issue crendtials ( $LOGIN=login & Password) to my telnet command and would like some advice as to what other ways I could write it - currently as shown - doesn't work.. GGrrr

Code:
( echo $LOGIN; sleep 1; echo $LOGIN; sleep 1; echo $UPDATE | telnet $i 24; );



I have to go into my device under port 24 and the $i is the ip address, $UPDATE is my http:software update. I am using this script to update software on remote devices where I don't have root access to add my host to the rhosts file or I would use something else other than telnet. Any ideas appreciated. You guys out there usually have something good and I appreciate your time and advice. Dale
# 2  
Old 04-17-2009
You need to use 'expect' to interact with the 'telnet' utility. You can get help for 'expect' at http:<slash><slash>www.tcl.tk<slash>man<slash>expect5.31<slash>expect.1.html
# 3  
Old 04-17-2009
I can't find it on my system 'whereis expect' comes back with nothing. Will this still help?
# 4  
Old 04-17-2009
you could use something that supports telnet protocol better. eg Perl (Net::Telnet) or Python(telnetlib).
# 5  
Old 04-17-2009
You can download and install expect if your system does not have it installed. Mine is located in /usr/bin/. The other suggestion of using perl will also require the download of the telnet module for perl. If you choose to use expect also download autoexpect it will create the expect script for just like a macro by invoking it and then manualy running through what you want to do. At the end you will have an expect script you can then expand on if needed.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Telnet Script

Hello, I wrote a script for doing telnet.However the requirement got changed and now I have to write a telnet script that will 1. Do the telnet from all the virtual ips in a box(Ex: x.x.x.x is the box ip, and x.x.x.1,x.x.x.2 etc are virtual ips associated with that box.) 2. The port range... (3 Replies)
Discussion started by: coolkid
3 Replies

2. Shell Programming and Scripting

Telnet Script

Hello, I wrote a script for doing telnet.However the requirement got changed and now I have to write a telnet script that will 1. Do the telnet from all the virtual ips in a box(Ex: x.x.x.x is the box ip, and x.x.x.1,x.x.x.2 etc are virtual ips associated with that box.) 2. The port range... (0 Replies)
Discussion started by: coolkid
0 Replies

3. Shell Programming and Scripting

telnet script

Hi, I need a script that take one parameter as destination hostname and two parameter as ranges and tries telnet and records the successful connections. fo reg: ./testtelnet.sh destination-host 1000 1050 should give me all the port between 1000 and 1050 what successfully connected to... (10 Replies)
Discussion started by: shifahim
10 Replies

4. Shell Programming and Scripting

telnet script help

Hi Guys, How do I write the script for the following telnet 192.168.1.100 9002 if the result is less than 1 second. The script should say as port open if the result takes more than 3 seconds. The script should display as port closed. Thanks, Charan (1 Reply)
Discussion started by: charan314
1 Replies

5. Shell Programming and Scripting

how to use telnet in script

I am trying to use telnet in shell script but getting following error error Connected to crmapp00.agf.ca. Escape character is '^]'. Connection closed by foreign host. Script #!/bin/ksh PATH=/usr/sbin/:/usr/bin:/usr/ucb:/etc:/usr/local/bin:. telnet HOSTNAME <<SCRIPT user userid... (9 Replies)
Discussion started by: sibghat
9 Replies

6. Shell Programming and Scripting

telnet shell script on red hat 9 cmd line only

i would like to make a shell script (red hat 9 cmd line only) to telnet to my local isp's webmail server on port 25 and send it commands such as helo :) help would be much appreciated, and i found no posts similar that answered my question... the closest i've gotten to an answer from about 8... (3 Replies)
Discussion started by: kypeswith
3 Replies

7. UNIX for Dummies Questions & Answers

telnet through script

Hi, How to write a script to perform telnet/ftp operation. Also please refer some site to get reference about shell scripting. Thanks in advance -Arun. (1 Reply)
Discussion started by: arun.viswanath
1 Replies

8. UNIX for Dummies Questions & Answers

telnet in a script

I'm need to connect to another host in a script using the telnet command. How do I pass the login and password to be able to connect to the other host from within the script? (10 Replies)
Discussion started by: vaccari
10 Replies

9. UNIX for Dummies Questions & Answers

Using telnet client from MacOSX's command line terminal

I'm completely new to Unix, but familiar with Mac OSX. I've just discovered the command line terminal feature of this new OS and I'm trying to learn how to telnet into my host's server to change permissions to allow executable cgi scripts for my website. Is there anyone who might be able to... (2 Replies)
Discussion started by: tylerl
2 Replies

10. IP Networking

telnet in a script

Does anyone have a script that contains the telnet command and passes the login and password in the script as well? (4 Replies)
Discussion started by: vaccari
4 Replies
Login or Register to Ask a Question