Automate telnet from unix to unix

I am on a unix box and have a script that is being executed in a program (the username and password will change depending on the program).  Because of security reasons I am restricted to telnet.  I have checked all the solutions in here and the send & expect commands will not work on my machine.  Are there any other options open to me?
CherylvanAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
TintinConnect With a Mentor Commented:
If you have Solaris 9 or 10, then you will already have ssh installed on the server.  If you are using an older Solaris version, it may still be installed, usually in /usr/local/bin/ssh

ssh is very much like telnet in that you need a client on your local machine and a server on the remote machine.

If ssh is not feasible, then install expect (if not already installed) as per yuzh's instructions.
0
 
TintinCommented:
How can security reasons restrict you to telnet?  Do you mean as in "our environment doesn't care about security, that's why we have to use telnet"?

Why won't expect work on your machine?  Is it installed?  Are you getting errors?

Can you use ssh?
0
 
yuzhCommented:
telnet is insecure (plain text passwork), a sniffer can catch your password, consider use
secure shell.

If you are inside a secure network (or you don't care about security), then have a look at;
http:Q_21179831.html
0
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

 
CherylvanAuthor Commented:
I am inside a secure network in what they call a 'red zone'.  The code that is in my program is:
unix silent value(search("tcp-connect.sh") + " " + address + " " +
p-word + " " + p-user).                                          

tcp-connect.sh contains the following:
telnet $1 << exit  
expect "login:"    
send "$3\n"        
expect "ssword:"  
send "$2\r"        
interact          
mget cheryl        
close              
exit      

Please don't laugh at my code, I am totally unfamiliar with telnet using scripts.  When I execute my code, it will connect to the other unix box and the login prompt will come up but it won't allow me to enter anything.  If I remove the << exit from the first line, it will let me type in the login and password but won't do anything else.        
0
 
TintinCommented:
What you have there is a confusion of scripting languages.

Your script is a combination of shell, expect and FTP.

The "expect" and "send" are the nuts and bolts of the expect scripting language, which is ideal for these types of interactive processes.

"Interact", "mget", "close" are FTP commands, so they certainly aren't going to work with a telnet session.

Do you have expect installed on your server?

Are you just wanting to retrieve a file or run a particular command on the remote server?

0
 
CherylvanAuthor Commented:
The interact, mget and close were just left in there from a copy of an old ftp shell script.  I am currently just trying to do a test by getting to another box without entering a password or login and retrieve a file with my name and bring it back.  We don't have the equipment in place at the moment to do much else but what I am ultimately trying to do is on the other box, when you login with a specific login and password, I will send it a specific command which will cause the other box to run a 'polling' program which will create a file that I will bring back.  I thought expect and send were part of telnet, is there something else I need to install to use these commands within telnet?
0
 
TintinCommented:
Expect is a seperate package and has no relationship to telnet.

What Unix flavour are you running?

It's a real shame your "secure" network doesn't won't/can't use a secure mechanism like ssh, as this would make the task *very* easy as well as being secure.
0
 
CherylvanAuthor Commented:
Tintin,

I'm using the Sun-Solaris type unix.  I can try and see if I can use ssh.  I know there are some sites that I am to telnet to and some sites that I'm going to have to dial into.  I'm not sure of the reason why, I think its because of the equipment out at the sites.  To use ssh, do you have to have that on both sites?  Could that be why they want me to use telnet, or could it just be because they don't know any better?  I apologize for all the stupid questions, and I really do appreciate your helping me.

Cheryl
0
 
yuzhCommented:
For Solaris you can download expect from:
http://sunfreeware.com/

Please remember to install the depandences as well.

You script http:#12443523 will not work, as Tintin pointed out in http:#12454571

If you still want to use expect, you can use "autoexect" to create an expect script
and then modify it.

man autoexpect
to learn more details.

If you need more help on expect script, please post the script created by "autoexpect"
we'll help you out.

Since you don't worry about security, you can try my suggestion in http:#12440277
(see the link, pay attention to my version of telnet script)





0
 
CherylvanAuthor Commented:
I'm going to give the ssh a try.  Trying to get expect installed on the machine would be like pulling teeth.  Where I am at, just to get a bug fixed installed you practically have to get the approval of the president of the company (who could care less) before installing it.  Thanks for sticking with me.
0
All Courses

From novice to tech pro — start learning today.