Re: info

Michel Arboi <[email protected]> Fri, 18 Feb 2005 13:03:54 +0100
Newsgroups gmane.comp.security.nessus.devel
Message-ID <[email protected]>
On Fri Feb 11 2005 at 10:01, dv wrote:

> Can I see the nessus report in excel format  or similar ?

I wrote a quick and dirty tool to convert old NSR reports into DIF
It can easily be converted for NBE

_______________________________________________
Nessus-devel mailing list
[email protected]
http://mail.nessus.org/mailman/listinfo/nessus-devel
nsr2dif.pl (application/x-perl, 1.2 KB)
#!/usr/bin/perl
# Copyright Michel Arboi 2001
# GNU Public Licence, bla bla bla.

$nLines = 0;
@addr = ();
@srv = ();
@mark = ();
@txt = ();

while(<STDIN>) {
  $nLines ++;
  # Yes, I know, arrays starts at zero in Perl. 
  # So I lose a couple of bytes. Who cares?
  if (! /^([^|]+)\|([^|]+)\|/) {
    warn "cannot parse line $nLines";
  } else {
    $addr[$nLines] = $1; $srv[$nLines] = $2;
    if ($' =~ /^([^|]+)\|/) {
      $sid[$nLines] = $1;
      if ($' =~ /^([^|]+)\|/) {
	$mark[$nLines] = $1;
	$txt[$nLines] = $';
	# Do not choke on double quotes. Replaced by two single quotes.
	$txt[$nLines] =~ s/\"/''/g;
	# Remove ";". We can not replace them by a "new line", that's a pity.
	$txt[$nLines] =~ s/;/ /g;
	# Remove NL too
	$txt[$nLines] =~ s/[\n\r]//g;
      }
    }
  }
}

$title = "NSR export";
print "TABLE\n0,1\n\"$title\"\n";

$nCol = 5;
print "VECTORS\n0,$nCol\n\"\"\nTUPLES\n0,$nLines\n\"\"\nDATA\n0,0\n\"\"\n-1,0\n";

for ($i = 1; $i <= $nLines; $i++) {
  print "BOT\n1,0\n\"$addr[$i]\"\n1,0\n\"$srv[$i]\"\n";
  if (defined $sid[$i]) { print "0,$sid[$i]\nV\n" }
  else { print "0,0\nNA\n"; }
  print "1,0\n\"$mark[$i]\"\n1,0\n\"$txt[$i]\"\n-1,0\n";
}

print "EOD\n";