package NessusNBE; #arbitrary at the moment use strict; use vars qw/ $VERSION @ISA @EXPORT /; require Exporter; @ISA = qw/ Exporter /; @EXPORT = qw/ nbanners nports nplugin nwebdirs nnfs nos /; $VERSION = '1.0'; sub nbanners { my (@ndata) = @_; my (@banners); foreach my $nbanner (@ndata) { if ( $nbanner =~ /emote(.*)server (banner|type)/ ) { my @result = split ( /\|/, $nbanner ); $result[6] =~ s/^(.*)\:\\n|Solution (.*)$|\\r|\\n//g; push @banners, join "|", $result[2], $result[6]; } } return @banners; } sub nports { my (@ndata) = @_; my (@ports); my $nport = pop (@ndata); foreach my $ndata (@ndata) { my @result = split ( /\|/, $ndata ); if ( $result[4] ) { next; } elsif ( $result[3] =~ /\($nport\// ) { push @ports, join "|", $result[2], $result[3]; } } return @ports; } sub nplugin { my (@ndata) = @_; my (@plugins); my $nplugin = pop (@ndata); foreach my $ndata (@ndata) { my @result = split ( /\|/, $ndata ); if ( !$result[4] ) { next; } elsif ( $result[4] =~ /$nplugin/ ) { push @plugins, join "|", $result[2], $result[3], $result[4]; } } return @plugins; } sub nwebdirs { my (@ndata) = @_; my (@webdirs); my $webdirplugin = 11032; foreach my $ndata (@ndata) { my @result = split ( /\|/, $ndata ); if ( !$result[4] ) { next; } elsif ( $result[4] =~ /$webdirplugin/ ) { $result[6] =~ s/^(.*)discovered\:|\\n//g; $result[6] =~ s/The following(.*)authentication/ --auth required/; push @webdirs, join "|", $result[2], $result[3], $result[6]; } } return @webdirs; } sub nnfs { my (@ndata) = @_; my (@nfs); my $nfsplugin = 10437; foreach my $ndata (@ndata) { my @result = split ( /\|/, $ndata ); if ( !$result[4] ) { next; } elsif ( $result[4] =~ /$nfsplugin/ ) { $result[6] =~ s/^(.*) \: \\n|\\n\\n(.*)$//g; push @nfs, join "|", $result[2], $result[3], $result[6]; } } return @nfs; } sub nos { my (@nos) = @_; my (@os); foreach my $nos (@nos) { my @result = split ( /\|/, $nos ); if ( $nos =~ m/10336\|Security Note|11268\|Security Note/ ) { if ( $result[4] eq 10336 ) { $result[6] =~ s/(Nmap(.*)running |(\;|\\n))//g; push @os, join "|", $result[2], $result[6]; } elsif ( $result[4] eq 11268 ) { $result[6] =~ s/(Remote OS guess : |\\n\\n(.*)$)//g; push @os, join "|", $result[2], $result[6]; } } } return @os; } 1;