2012-08-15 1 views
0

모든 의존성을 설치하는 방법 Nmap :: Scanner cpan in perl? 나, cpan Nmap :: 스캐너. 그러나 모듈에 대한 다른 종속성이 필요합니다.CPAN 모듈에 대한 재귀 종속성, 방법?

이 코드.

#!/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. 

답변

3

cpan은 자동으로 의존성을 해결합니다. 설치하려면 다음 명령을 실행하십시오.

cpan Nmap::Scanner 

CPAN 모듈의 다른 설치 관리자는 cpanminus입니다. cpanm을 사용하는 경우 :

cpanm Nmap::Scanner 
+0

하지만 필자는 perl에서 스크립트를 실행할 때이를 보여줍니다. – opmeitle

+0

다음과 같이하면됩니다 :'cpan XML :: SAX :: Exception' –

+0

이 "Class/Generate.pm을 찾을 수 없습니까?" >> cpan 클래스 : Generate .. y listo, gracias amigo – opmeitle