[Perl-unix-users] telnet using perl

2001-06-01 Thread Mr. Zalewski

I'm trying to telnet from a solaris 2.7 machine to an AIX 4.3 machine. I am using a 
perl program to do this. After the first command, the screen just sorta hangs there, 
until I type control C. Any insight?

The first command is displayed and I assume goes through, but nothing happens unless I 
press the control C and cancel the process. Then I am returned to my original prompt.

10 $command="telnet aixbox\r\n";$
11 &ExecuteAndPrint ($command);$
12 $command="root\r\n";$
13 &ExecuteAndPrint ($command);$
14 $command="password\r\n";$

The numbers and the dollar signs at the end are just a display in vi text editor. (you 
probably knew that)

I tried \r\n \n\r \012\015 \012\012\015 \015\012 at the end of the command, from 
someone's suggestions

Somehow there must be a way to send a command, have the other machine acknowledge it 
and then have it accept a new command.

when I type a control C (to break out of this) I get messages for each line like this 
one for the password line

": No such file or directory at zaleudb.pl line 5.
password

zaleudb.pl is the perl program I am executing. The word "password" (changed for 
security purposes) is the password I tried to send.

Thanks


 
Win a LAPTOP Computer and get your FREE KEYEMAIL.COM E-mail Account at  http://keye.com
___
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users



[Perl-unix-users] Net::Telnet

2001-06-06 Thread Mr. Zalewski

I'm trying to set up Net::Telnet  so I may or may not have done it correctly.  It also 
gave an example program that I tried, but I got an error.
Example program:
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10, Prompt => '/bash\$ $/');
$t->open ("sparky");
$t->login($username, $passwd);
@lines = $t->cmd("/usr/bin/who");
print @lines;

sparky is the machine name.
username and passwd   I replaced with the appropriate.

The error I get is:
Can't locate object method "Use" via package Net::Telnet at test.pl line 1.

I used the install instructions of:
perl makefile.pl \INSTALLSITELIB=$HOME/lib/perl \
  INSTALLMAN3DIR=$HOME/lib/perl/man/man3
make
make test
make pure_install

Any thoughts of what I missed and/or need to do is greatly appreciated.

The url I got this from is:
http://www.perlfect.com/articles/telnet.shtml

Thanks


 
Win a LAPTOP Computer and get your FREE KEYEMAIL.COM E-mail Account at  http://keye.com
___
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users



RE: [Perl-unix-users] Login Security

2001-06-08 Thread Mr. Zalewski

on the program line
$t= new Net::Telnet (Timeout=>10; Prompt => '/bash\$ $/');

What is the Prompt portion mean? I think it's saying look for a bash$ prompt minus the 
$. I don't know. Please explain.

Also, how would I set up the Prompt command to have the system look for the prompt   
ftp>

My original problem was connecting via telnet from one unix machine to another.  I was 
able to make it work, once I took the "prompt" portion out of my program. That portion 
is suppose to check for the specific prompt, and I'm not sure what the slashes mean ( 
I thought esc key)


Past history...
Now I'm trying to ftp from the machine I telneted to.
My commands without perl are
ftp
open  machine.name.com
root
password

I'm not able to get the ftp to work from inside my telneted session. Maybe I need to 
have the net::telnet module set up on the machine I just telneted to.

thanks



___
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users



[Perl-unix-users] FTP from a telnet session

2001-06-12 Thread Mr. Zalewski

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="login1"."\!a";
$login2="Login2"."\!hard";
$| = 1;
$\="\n";
$t->open('tzale.com');
$t->login(root, $login1);
$t->cmd ('rm lines.log');
$t->cmd ('ls >> lines.log');
$t->cmd('ftp');
$t->print ("open chavin.com");
$t->waitfor('/ftp> $/i);
$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");

The only line that worked without an error was the print statement and only after I 
enter the  \n

Any ideas?
Thanks



___
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users