如何在 Perl 中使用 cpan 安装模块 Nmap::Scanner 的所有依赖项?我做到了,cpan Nmap::Scanner。但是,需要模块的其他依赖项。
#!/bash/perl
use Nmap::Scanner;
my $scan = Nmap::Scanner->new();
$scan->add_target('localhost');
$scan->add_target('host.i.administer');
$scan->add_scan_port('1-1024');
$scan->add_scan_port('31337');
$scan->tcp_syn_scan();
$scan->noping();
my $results = $scan->scan();
my $hosts = $results->gethostlist();
while (my $host = $hosts->get_next()) {
print "On " . $host->hostname() . ": \n";
my $ports = $host->get_port_list();
while (my $port = $ports->get_next()) {
print join(' ',
'Port',
$port->service() . '/' . $port->portid(),
'is in state',
$port->state(),
"\n"
);
}
}
我做到了,但是在 perl 中运行脚本时,在控制台中显示了这一点。
Can't locate XML/SAX/Exception.pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl` /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at /usr/local/share/perl5/XML/SAX/ParserFactory.pm line 12.
BEGIN failed--compilation aborted at /usr/local/share/perl5/XML/SAX/ParserFactory.pm line 12.
Compilation failed in require at /usr/local/share/perl5/Nmap/Scanner/Backend/XML.pm line 8.
BEGIN failed--compilation aborted at /usr/local/share/perl5/Nmap/Scanner/Backend/XML.pm line 8.
Compilation failed in require at /usr/local/share/perl5/Nmap/Scanner/Scanner.pm line 4.
BEGIN failed--compilation aborted at /usr/local/share/perl5/Nmap/Scanner/Scanner.pm line 4.
Compilation failed in require at /usr/local/share/perl5/Nmap/Scanner.pm line 10.
BEGIN failed--compilation aborted at /usr/local/share/perl5/Nmap/Scanner.pm line 10.
Compilation failed in require at e1-insecure.pl line 3.
BEGIN failed--compilation aborted at e1-insecure.pl line 3.