line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Parse::Nessus::ENX;
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
32678
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
5
|
1
|
|
|
1
|
|
6
|
use vars qw/ $VERSION @ISA @EXPORT_OK %EXPORT_TAGS /;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
139
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter;
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
@ISA = qw/ Exporter /;
|
10
|
|
|
|
|
|
|
@EXPORT_OK =
|
11
|
|
|
|
|
|
|
qw/ ebanners eports eplugin ewebdirs enfs eos esnmp estatos estatservices estatvulns /;
|
12
|
|
|
|
|
|
|
%EXPORT_TAGS = (all => [qw/ ebanners eports eplugin ewebdirs enfs eos esnmp estatos estatservices estatvulns /] );
|
13
|
|
|
|
|
|
|
$VERSION = '1.1';
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
17
|
use constant WEBDIR => 11032; # nessus plugin id for web directories discovered
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
86
|
|
16
|
1
|
|
|
1
|
|
5
|
use constant NFS => 10437; # nessus plugin id for nfs shares discovered
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
17
|
1
|
|
|
1
|
|
5
|
use constant NMAP1 => 10336; # nessus plugin id for Nmap OS guess
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
18
|
1
|
|
|
1
|
|
5
|
use constant NMAP2 => 11268; # nessus plugin id for Nmap OS guess
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
19
|
1
|
|
|
1
|
|
4
|
use constant QUESO => 10337; # nessus plugin id for QueSO OS guess
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3118
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub ebanners {
|
22
|
0
|
|
|
0
|
0
|
|
my (@ndata) = @_;
|
23
|
0
|
|
|
|
|
|
my (@banners);
|
24
|
0
|
|
|
|
|
|
foreach my $nbanner (@ndata) {
|
25
|
0
|
0
|
|
|
|
|
if ( $nbanner =~ /emote(.*)server (banner|type)/ ) {
|
26
|
0
|
|
|
|
|
|
my @result = split ( /\|/, $nbanner );
|
27
|
0
|
|
|
|
|
|
$result[4] =~ s/^(.*?) \:\;|Solution (.*)$|r\;|\;|This is(.*)$//g;
|
28
|
0
|
|
|
|
|
|
push @banners, join "|", $result[0], $result[4];
|
29
|
|
|
|
|
|
|
}
|
30
|
|
|
|
|
|
|
}
|
31
|
0
|
|
|
|
|
|
return @banners;
|
32
|
|
|
|
|
|
|
}
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub eports {
|
35
|
0
|
|
|
0
|
0
|
|
my (@ndata) = @_;
|
36
|
0
|
|
|
|
|
|
my (@ports);
|
37
|
0
|
|
|
|
|
|
my $nport = pop (@ndata);
|
38
|
0
|
|
|
|
|
|
foreach my $ndata (@ndata) {
|
39
|
0
|
|
|
|
|
|
my @result = split ( /\|/, $ndata );
|
40
|
0
|
0
|
0
|
|
|
|
if ( $result[3] || $ndata =~ /\[NessusWX|\$DATA/ ) {
|
|
|
0
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
next;
|
42
|
|
|
|
|
|
|
}
|
43
|
|
|
|
|
|
|
elsif ( $result[1] =~ /\($nport\// ) {
|
44
|
0
|
|
|
|
|
|
push @ports, join "|", $result[0], $result[1];
|
45
|
|
|
|
|
|
|
}
|
46
|
|
|
|
|
|
|
}
|
47
|
0
|
|
|
|
|
|
return @ports;
|
48
|
|
|
|
|
|
|
}
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub eplugin {
|
51
|
0
|
|
|
0
|
0
|
|
my (@ndata) = @_;
|
52
|
0
|
|
|
|
|
|
my (@plugins);
|
53
|
0
|
|
|
|
|
|
my $eplugin = pop (@ndata);
|
54
|
0
|
|
|
|
|
|
foreach my $ndata (@ndata) {
|
55
|
0
|
|
|
|
|
|
my @result = split ( /\|/, $ndata );
|
56
|
0
|
0
|
|
|
|
|
if ( !$result[4] ) {
|
|
|
0
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
next;
|
58
|
|
|
|
|
|
|
}
|
59
|
|
|
|
|
|
|
elsif ( $result[2] =~ /$eplugin/ ) {
|
60
|
0
|
|
|
|
|
|
push @plugins, join "|", $result[0], $result[1], $result[4];
|
61
|
|
|
|
|
|
|
}
|
62
|
|
|
|
|
|
|
}
|
63
|
0
|
|
|
|
|
|
return @plugins;
|
64
|
|
|
|
|
|
|
}
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub ewebdirs {
|
67
|
0
|
|
|
0
|
0
|
|
my (@ndata) = @_;
|
68
|
0
|
|
|
|
|
|
my (@webdirs);
|
69
|
0
|
|
|
|
|
|
my $webdirplugin = WEBDIR;
|
70
|
0
|
|
|
|
|
|
foreach my $ndata (@ndata) {
|
71
|
0
|
|
|
|
|
|
my @result = split ( /\|/, $ndata );
|
72
|
0
|
0
|
|
|
|
|
if ( !$result[4] ) {
|
|
|
0
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
next;
|
74
|
|
|
|
|
|
|
}
|
75
|
|
|
|
|
|
|
elsif ( $result[2] =~ /$webdirplugin/ ) {
|
76
|
0
|
|
|
|
|
|
$result[4] =~ s/(^(.*)discovered\:\;|\;|\,)//g;
|
77
|
0
|
|
|
|
|
|
$result[4] =~ s/The following(.*)authentication:/\|/;
|
78
|
0
|
|
|
|
|
|
push @webdirs, join "|", $result[0], $result[1], $result[4];
|
79
|
|
|
|
|
|
|
}
|
80
|
|
|
|
|
|
|
}
|
81
|
0
|
|
|
|
|
|
return @webdirs;
|
82
|
|
|
|
|
|
|
}
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub enfs {
|
85
|
0
|
|
|
0
|
0
|
|
my (@ndata) = @_;
|
86
|
0
|
|
|
|
|
|
my (@nfs);
|
87
|
0
|
|
|
|
|
|
my $nfsplugin = NFS;
|
88
|
0
|
|
|
|
|
|
foreach my $ndata (@ndata) {
|
89
|
0
|
|
|
|
|
|
my @result = split ( /\|/, $ndata );
|
90
|
0
|
0
|
|
|
|
|
if ( !$result[4] ) {
|
|
|
0
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
next;
|
92
|
|
|
|
|
|
|
}
|
93
|
|
|
|
|
|
|
elsif ( $result[2] =~ /$nfsplugin/ ) {
|
94
|
0
|
|
|
|
|
|
$result[4] =~ s/(^(.*?) \: \;|\;\;CVE(.*)$)//g;
|
95
|
0
|
|
|
|
|
|
$result[4] =~ s/\;/,/g;
|
96
|
0
|
|
|
|
|
|
push @nfs, join "|", $result[0], $result[1], $result[4];
|
97
|
|
|
|
|
|
|
}
|
98
|
|
|
|
|
|
|
}
|
99
|
0
|
|
|
|
|
|
return @nfs;
|
100
|
|
|
|
|
|
|
}
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub eos {
|
103
|
0
|
|
|
0
|
0
|
|
my (@ndata) = @_;
|
104
|
0
|
|
|
|
|
|
my (@os);
|
105
|
0
|
|
|
|
|
|
foreach my $ndata (@ndata) {
|
106
|
0
|
0
|
|
|
|
|
if ( $ndata =~
|
107
|
|
|
|
|
|
|
m/10336\|(INFO|NOTE)|11268\|(INFO|NOTE)|10337\|(INFO|NOTE)/ )
|
108
|
|
|
|
|
|
|
{
|
109
|
0
|
|
|
|
|
|
my @result = split ( /\|/, $ndata );
|
110
|
0
|
0
|
|
|
|
|
if ( $result[2] eq NMAP1 ) {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
$result[4] =~ s/(Nmap(.*)running |\;)//g;
|
112
|
0
|
|
|
|
|
|
push @os, join "|", $result[0], $result[4];
|
113
|
|
|
|
|
|
|
}
|
114
|
|
|
|
|
|
|
elsif ( $result[2] eq NMAP2 ) {
|
115
|
0
|
|
|
|
|
|
$result[4] =~ s/(Remote OS guess : |\;\;(.*)$)//g;
|
116
|
0
|
|
|
|
|
|
push @os, join "|", $result[0], $result[4];
|
117
|
|
|
|
|
|
|
}
|
118
|
|
|
|
|
|
|
elsif ( $result[2] eq QUESO ) {
|
119
|
0
|
|
|
|
|
|
$result[4] =~
|
120
|
|
|
|
|
|
|
s/(QueSO has(.*) \;\* |\;\;\;CVE (.*)$| \(by (.*)$)//g;
|
121
|
0
|
|
|
|
|
|
push @os, join "|", $result[0], $result[4];
|
122
|
|
|
|
|
|
|
}
|
123
|
|
|
|
|
|
|
}
|
124
|
|
|
|
|
|
|
}
|
125
|
0
|
|
|
|
|
|
return @os;
|
126
|
|
|
|
|
|
|
}
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub esnmp {
|
129
|
0
|
|
|
0
|
0
|
|
my (@ndata) = @_;
|
130
|
0
|
|
|
|
|
|
my (@snmp);
|
131
|
0
|
|
|
|
|
|
foreach my $ndata (@ndata) {
|
132
|
0
|
0
|
|
|
|
|
if ( $ndata =~ m/10264\|REPORT\|/ ) {
|
133
|
0
|
|
|
|
|
|
my @result = split ( /\|/, $ndata );
|
134
|
0
|
|
|
|
|
|
$result[4] =~ s/\;SNMP Agent(.*?)community name: //;
|
135
|
0
|
|
|
|
|
|
$result[4] =~ s/(\;SNMP Agent (.*?)community name: |\;CVE(.*)$)/ /g;
|
136
|
0
|
|
|
|
|
|
push @snmp, join "|", $result[0], $result[4];
|
137
|
|
|
|
|
|
|
}
|
138
|
|
|
|
|
|
|
}
|
139
|
0
|
|
|
|
|
|
return @snmp;
|
140
|
|
|
|
|
|
|
}
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub estatos {
|
143
|
0
|
|
|
0
|
0
|
|
my (@ndata) = @_;
|
144
|
0
|
|
|
|
|
|
my (@allos);
|
145
|
0
|
|
|
|
|
|
foreach my $ndata (@ndata) {
|
146
|
0
|
0
|
|
|
|
|
if ( $ndata =~
|
147
|
|
|
|
|
|
|
m/10336\|(INFO|NOTE)|11268\|(INFO|NOTE)|10337\|(INFO|NOTE)/ )
|
148
|
|
|
|
|
|
|
{
|
149
|
0
|
|
|
|
|
|
my @result = split ( /\|/, $ndata );
|
150
|
0
|
|
|
|
|
|
chomp $result[4];
|
151
|
0
|
0
|
|
|
|
|
if ( $result[2] eq NMAP1 ) {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
$result[4] =~ s/(Nmap(.*)running |\;)//g;
|
153
|
0
|
|
|
|
|
|
push @allos, $result[4];
|
154
|
|
|
|
|
|
|
}
|
155
|
|
|
|
|
|
|
elsif ( $result[2] eq NMAP2 ) {
|
156
|
0
|
|
|
|
|
|
$result[4] =~ s/(Remote OS guess : |\;\;(.*)$)//g;
|
157
|
0
|
|
|
|
|
|
push @allos, $result[4];
|
158
|
|
|
|
|
|
|
}
|
159
|
|
|
|
|
|
|
elsif ( $result[2] eq QUESO ) {
|
160
|
0
|
|
|
|
|
|
$result[4] =~
|
161
|
|
|
|
|
|
|
s/(QueSO has(.*) \;\* |\;\;\;CVE (.*)$| \(by (.*)$)//g;
|
162
|
0
|
|
|
|
|
|
push @allos, $result[4];
|
163
|
|
|
|
|
|
|
}
|
164
|
|
|
|
|
|
|
}
|
165
|
|
|
|
|
|
|
}
|
166
|
0
|
|
|
|
|
|
my %count;
|
167
|
0
|
|
|
|
|
|
map { $count{$_}++ } @allos;
|
|
0
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
|
my @rearranged = sort { $count{$b} <=> $count{$a} } keys %count;
|
|
0
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
|
my @graphos;
|
170
|
0
|
|
|
|
|
|
foreach (@rearranged) {
|
171
|
0
|
|
|
|
|
|
push @graphos, join "|", $_, "$count{$_}\n";
|
172
|
|
|
|
|
|
|
}
|
173
|
0
|
|
|
|
|
|
return @graphos;
|
174
|
|
|
|
|
|
|
}
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
sub estatservices {
|
177
|
0
|
|
|
0
|
0
|
|
my (@ndata) = @_;
|
178
|
0
|
|
|
|
|
|
my (@allports);
|
179
|
0
|
|
|
|
|
|
foreach my $ndata (@ndata) {
|
180
|
0
|
|
|
|
|
|
my @result = split ( /\|/, $ndata );
|
181
|
0
|
0
|
0
|
|
|
|
if ( $result[3] || $ndata =~ /\[NessusWX|\$DATA/ ) {
|
182
|
0
|
|
|
|
|
|
next;
|
183
|
|
|
|
|
|
|
}
|
184
|
|
|
|
|
|
|
else {
|
185
|
0
|
|
|
|
|
|
chomp $result[1];
|
186
|
0
|
|
|
|
|
|
push @allports, $result[1];
|
187
|
|
|
|
|
|
|
}
|
188
|
|
|
|
|
|
|
}
|
189
|
0
|
|
|
|
|
|
my %count;
|
190
|
0
|
|
|
|
|
|
map { $count{$_}++ } @allports;
|
|
0
|
|
|
|
|
|
|
191
|
0
|
|
|
|
|
|
my @rearranged = sort { $count{$b} <=> $count{$a} } keys %count;
|
|
0
|
|
|
|
|
|
|
192
|
0
|
|
|
|
|
|
my @graphservices;
|
193
|
0
|
|
|
|
|
|
foreach (@rearranged) {
|
194
|
0
|
|
|
|
|
|
push @graphservices, join "|", $_, "$count{$_}\n";
|
195
|
|
|
|
|
|
|
}
|
196
|
0
|
|
|
|
|
|
return @graphservices;
|
197
|
|
|
|
|
|
|
}
|
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub estatvulns {
|
200
|
0
|
|
|
0
|
0
|
|
my (@edata) = @_;
|
201
|
0
|
|
|
|
|
|
my (@allvuln);
|
202
|
0
|
|
|
|
|
|
my $esevval = pop (@edata);
|
203
|
0
|
|
|
|
|
|
my $eseverity;
|
204
|
0
|
0
|
|
|
|
|
if ($esevval == 1) {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
205
|
0
|
|
|
|
|
|
$eseverity = "REPORT";
|
206
|
|
|
|
|
|
|
}
|
207
|
|
|
|
|
|
|
elsif ($esevval == 2) {
|
208
|
0
|
|
|
|
|
|
$eseverity = "INFO";
|
209
|
|
|
|
|
|
|
}
|
210
|
|
|
|
|
|
|
elsif ($esevval == 3) {
|
211
|
0
|
|
|
|
|
|
$eseverity = "NOTE";
|
212
|
|
|
|
|
|
|
}
|
213
|
0
|
|
|
|
|
|
foreach my $edata (@edata) {
|
214
|
0
|
|
|
|
|
|
my @result = split ( /\|/, $edata );
|
215
|
0
|
0
|
|
|
|
|
if (! $result[3]) {
|
|
|
0
|
|
|
|
|
|
216
|
0
|
|
|
|
|
|
next;
|
217
|
|
|
|
|
|
|
}
|
218
|
|
|
|
|
|
|
elsif ( $result[3] =~ /$eseverity/ ) {
|
219
|
0
|
|
|
|
|
|
push @allvuln, $result[2];
|
220
|
|
|
|
|
|
|
}
|
221
|
|
|
|
|
|
|
}
|
222
|
0
|
|
|
|
|
|
my %count;
|
223
|
0
|
|
|
|
|
|
map { $count{$_}++ } @allvuln;
|
|
0
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
|
my @rearranged = sort { $count{$b} <=> $count{$a} } keys %count;
|
|
0
|
|
|
|
|
|
|
225
|
0
|
|
|
|
|
|
my @graphvuln;
|
226
|
0
|
|
|
|
|
|
foreach (@rearranged) {
|
227
|
0
|
|
|
|
|
|
push @graphvuln, join "|", $_, "$count{$_}\n";
|
228
|
|
|
|
|
|
|
}
|
229
|
0
|
|
|
|
|
|
return @graphvuln;
|
230
|
|
|
|
|
|
|
}
|
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
1;
|
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
__END__
|