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?
Who is Participating?
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.
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?
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;
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

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("") + " " + address + " " +
p-word + " " + p-user).                                   contains the following:
telnet $1 << exit  
expect "login:"    
send "$3\n"        
expect "ssword:"  
send "$2\r"        
mget cheryl        

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.        
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?

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?
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.
CherylvanAuthor Commented:

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.

For Solaris you can download expect from:

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)

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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.