モジュールNmap::Scannerのすべての依存関係をPerlでcpanと一緒にインストールする方法は?やった、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.