El mensaje de error a compilar el archivo perl es este:
Name "main::perl" used only once: possible typo at roto2.pl line 4.
Use of uninitialized value $ARGV[0] in string at roto2.pl line 4.
Use of uninitialized value $ARGV[0] in concatenation (.) or string at roto2.pl line 4
Use of uninitialized value $perl in concatenation (.) or string at roto2.pl line 4.
Cannot connect to Host
y el codigo es:
#!/usr/bin/perl -w
use Net::FTP;
$ftp=Net::FTP->new("$ARGV[0]",Debug=>0) || die "Cannot connect to Host $ARGV[0]\n Usage: $perl script_name.pl target_ip\n";
$ftp -> login("anonymous","anonymous") || die "Could not Login...Retry";
while(1)
{
#this loop runs infinitely
$ftp -> cwd();
}
$ftp->quit;
Hay un problema con los die' s, así debería de ser:
#!/usr/bin/perl
use strict;
use Net::FTP;
my $ftp=Net::FTP->new("$ARGV[0]",Debug=>0) || die ("Cannot connect to Host $ARGV[0]\n Usage: perl script_name.pl target_ip\n");
$ftp -> login("anonymous","anonymous") || die ("Could not Login...Retry");
while(1)
{
#this loop runs infinitely
$ftp -> cwd();
}
$ftp->quit;
Ahora a probarlo:
Abriendo el puerto con netcat en el puerto 21 (ftp):
leo@lein:~/Escritorio$ sudo nc -vlp 21
listening on [any] 21 ...
connect to [127.0.0.1] from localhost [127.0.0.1] 56821
leo@lein:~/Escritorio$ perl pl.pl 127.0.0.1
PD: También tu indentación estaba mal.
grax
Cita de: Fritos en 25 Junio 2010, 17:18 PM
grax
Aviso
La palabra grax no está en el Diccionario.
rae.es (http://rae.es)