I'm new to programming in Perl and I'm trying to get a script to automate a login to a FTP server using Telnet. I've searched the net and everything I see does not work for me for some reason. Here is my code
This is where it diesCode:#!/usr/bin/perl -w use strict; use Net::Telnet; my ($host, $port, $user, $pass, $command); ##### get host info print 'Enter host: '; chop($host = <STDIN>); ##### get port info print 'Enter port: '; chop($port = <STDIN>); ##### get user info print 'Enter user: '; chop($user = <STDIN>); ##### get user info & hide input print 'Enter password: '; system 'stty -echo'; chop($pass = <STDIN>); system 'stty echo'; print "\n"; my $tn = new Net::Telnet(Host => $host, Port => $port, Timeout => 20) or die "connect failed: $!"; $tn->open ($host); $tn->login($user, $pass) or die "login failed: $!"; print 'Hostname: '; print $tn->cmd('/bin/hostname'), "\n"; my @who = $tn->cmd('/usr/bin/who'); print "Here's who:\n", @who, "\n"; print "\nWhat is your command: "; chop($command = <STDIN>); print $tn->cmd($command), "\n"; $tn->close or die "close fail: $!";
And here is the error:Code:$tn->login($user, $pass)
The FTP server I'm trying to get into is FileCOPA.Code:timed-out waiting for login prompt at ./test2.pl line 26
Thanks for any help you can give a noobie.




Bookmarks