Anonymous | Login | 2024-12-04 14:14 EST |
Main | My View | View Issues | Change Log | Roadmap |
View Revisions: Issue #1841 | [ Back to Issue ] | ||
Summary | 0001841: Issue with Nessus and Net::Nessus::XMLRPC | ||
Revision | 2014-10-30 09:41 by dwuelfrath | ||
Additional Information | See the following bug: https://rt.cpan.org/Public/Bug/Display.html?id=78274 [^] Hi, i am using Net-Nessus-XMLRPC in the PacketFence project and i need nbe export. So i write the function to export in nbe format and in csv format too. For SSL i just add ssl_opts => { verify_hostname => 0 } to remove the SSL problem. Regards Fabrice Durand diff -ruN Net-Nessus-XMLRPC-0.30.ori/lib/Net/Nessus/XMLRPC.pm Net-Nessus-XMLRPC-0.30/lib/Net/Nessus/XMLRPC.pm --- Net-Nessus-XMLRPC-0.30.ori/lib/Net/Nessus/XMLRPC.pm 2010-05-21 12:16:45.000000000 -0400 +++ Net-Nessus-XMLRPC-0.30/lib/Net/Nessus/XMLRPC.pm 2012-07-09 10:09:53.795285182 -0400 @@ -126,10 +126,16 @@ =cut sub nessus_http_request { my ( $self, $uri, $post_data ) = @_; - my $ua = $self->{_ua}; - # my $ua = LWP::UserAgent->new; + #my $ua = $self->{_ua}; + my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 }); my $furl = $self->nurl.$uri; - my $r = POST $furl, $post_data; + my $r =''; + if (not defined($post_data)) { + $r = GET $furl; + } + else { + $r = POST $furl, $post_data; + } my $result = $ua->request($r); # my $filename="n-".time; open (FILE,">$filename"); # print FILE $result->as_string; close (FILE); @@ -941,6 +947,50 @@ return $file; } +=head2 report_filenbe_download ($report_id) + +returns NBE report identified by $report_id (Nessus NBE) +=cut +sub report_filenbe_download { + my ( $self, $uuid ) = @_; + + my $post=[ + "token" => $self->token, + "report" => $uuid, + ]; + + my $get = $self->nessus_http_request("file/xslt/?report=".$uuid."&xslt=nbe.xsl&token=".$self->token); + sleep 10; + if($get =~ /<meta http-equiv="refresh" content="5;url=\/(.*)"/) { + my $file = $self->nessus_http_request($1."&token=".$self->token."&step=2"); + return $file; + } + + return $get; +} + +=head2 report_filecsv_download ($report_id) + +returns CSV report identified by $report_id (Nessus CSV) +=cut +sub report_filecsv_download { + my ( $self, $uuid ) = @_; + + my $post=[ + "token" => $self->token, + "report" => $uuid, + ]; + + my $get = $self->nessus_http_request("file/xslt/?report=".$uuid."&xslt=csv.xsl&token=".$self->token); + sleep 10; + if($get =~ /<meta http-equiv="refresh" content="5;url=\/(.*)"/) { + my $file = $self->nessus_http_request($1."&token=".$self->token."&step=2"); + return $file; + } + + return $get; +} + =head2 report_delete ($report_id) delete report identified by $report_id |
||
Revision | 2014-10-30 09:37 by dwuelfrath | ||
Additional Information | See the following bug: https://rt.cpan.org/Public/Bug/Display.html?id=78274 [^] |
Copyright © 2000 - 2012 MantisBT Group |