PacketFence - BTS - PacketFence
View Issue Details
0001841PacketFenceupstreampublic2014-10-30 09:372015-03-04 12:05
dwuelfrath 
dwuelfrath 
normalminorhave not tried
assignedopen 
 
 
0001841: Issue with Nessus and Net::Nessus::XMLRPC
Some issues with Net::Nessus::XMLRPC upstream module may prevent Nessus scan succeed.

Impacts:
- Issue with SSL communication when a self-signed certificate is being used between PacketFence and the Nessus server (https)
- Issue when trying to export the report

Patch have been submitted but never merged.
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
No tags attached.
Issue History
2014-10-30 09:37dwuelfrathNew Issue
2014-10-30 09:41dwuelfrathAdditional Information Updatedbug_revision_view_page.php?rev_id=12#r12
2015-03-04 12:05lmunroAssigned To => dwuelfrath
2015-03-04 12:05lmunroStatusnew => assigned

There are no notes attached to this issue.