
zale1
Deleted
Jun 12, 2001, 8:54 AM
Post #1 of 3
(285 views)
|
|
FTP from a Telnet session
|
Can't Post
|
|
I had recently asked for help on telneting from one unix box to another. With your help; I'm pleased to say I can now telnet from solaris to an AIX machine. I've also learned that the backslash does not work (in this case) to tell perl that the ! is not a special character. I had to concatenate the ! into my variable in order for it to work. What I'm trying to do now is to ftp back, in order to send some data. I show the "print" command in the following lines. I've also tried the "cmd" command, and even the "waitfor" command. This program goes through all the way without any errors, however, I know that I'm not logging into the machine (the FTP session) because I cannot see any additional processes opened when I do the "who" command. use lib '/lib/perl/5.00503'; use Net::Telnet; $t = new Net::Telnet (Timeout=> 15); $root=root; $login1="Howdy"."\!a"; $login2="Play"."\!hard"; $| = 1; $\="\n"; $t->open('zale1.com'); $t->login(root, $login1); $t->cmd ('rm lines.log'); $t->cmd ('ls >> lines.log'); $t->cmd('ftp'); $t->print ("open chavin.com"); $t->print ("root \n"); $t->print ("$login2 \n"); $t->print("cd /data \n"); $t->print("bin \n"); $t->print ("put lines.log \n"); $t->print("bye \n"); $t->print("exit \n"); For this line $t->print ("open chavin.com"); I've also tried $t->open ("chavin.com"); $t->cmd ("open chavin.com"); $t->waitfor('/ftp> $/i); The only line that worked without an error was the print statement and only after I enter the \n My main goal is to telnet to another machine, get some data and ftp it back to the machine that I ran my perl script from. Any ideas? Thanks
|