line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# network::nikto Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::Network::Nikto; |
7
|
1
|
|
|
1
|
|
703
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use base qw(Metabrik::System::Package); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
511
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub brik_properties { |
13
|
|
|
|
|
|
|
return { |
14
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
15
|
|
|
|
|
|
|
tags => [ qw(unstable security scanner vulnerability vuln scan) ], |
16
|
|
|
|
|
|
|
author => 'GomoR ', |
17
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
18
|
|
|
|
|
|
|
attributes => { |
19
|
|
|
|
|
|
|
datadir => [ qw(datadir) ], |
20
|
|
|
|
|
|
|
uri => [ qw(uri) ], |
21
|
|
|
|
|
|
|
args => [ qw(nikto_arguments) ], |
22
|
|
|
|
|
|
|
output => [ qw(output_file.html) ], |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
attributes_default => { |
25
|
|
|
|
|
|
|
uri => 'http://127.0.0.1/', |
26
|
|
|
|
|
|
|
args => '-Display V -Format html', |
27
|
|
|
|
|
|
|
output => 'last.html', |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
commands => { |
30
|
|
|
|
|
|
|
install => [ ], # Inherited |
31
|
|
|
|
|
|
|
start => [ qw(uri|OPTIONAL) ], |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
require_modules => { |
34
|
|
|
|
|
|
|
'Metabrik::String::Uri' => [ ], |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
require_binaries => { |
37
|
|
|
|
|
|
|
'nikto' => [ ], |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
need_packages => { |
40
|
|
|
|
|
|
|
ubuntu => [ qw(nikto) ], |
41
|
|
|
|
|
|
|
debian => [ qw(nikto) ], |
42
|
|
|
|
|
|
|
kali => [ qw(nikto) ], |
43
|
|
|
|
|
|
|
}, |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _nikto_parse { |
48
|
0
|
|
|
0
|
|
|
my $self = shift; |
49
|
0
|
|
|
|
|
|
my ($cmd, $result) = @_; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $parsed = {}; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
push @{$parsed->{raw}}, $cmd; |
|
0
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
for (split(/\n/, $result)) { |
56
|
0
|
|
|
|
|
|
push @{$parsed->{raw}}, $_; |
|
0
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
return $parsed; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# nikto -host XXX.com -root /XXX -Display V -port 443 -ssl -Format html -output /root/XXX/outil_nikto/XXX_nikto_https.html 2>&1 | tee /root/XXX/outil_nikto/XXX_nikto_https.txt |
63
|
|
|
|
|
|
|
# nikto -host 127.0.0.1 -port 80 -root /path -Display V -Format html -ssl -output /home/gomor/metabrik/nikto.html |
64
|
|
|
|
|
|
|
sub start { |
65
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
66
|
0
|
|
|
|
|
|
my ($uri, $output) = @_; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
0
|
|
|
|
$output ||= $self->output; |
69
|
0
|
|
0
|
|
|
|
$uri ||= $self->uri; |
70
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('start', $uri) or return; |
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
my $su = Metabrik::String::Uri->new_from_brik_init($self) or return; |
73
|
0
|
0
|
|
|
|
|
my $p = $su->parse($uri) or return; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
my $host = $p->{host}; |
76
|
0
|
|
|
|
|
|
my $port = $p->{port}; |
77
|
0
|
|
|
|
|
|
my $path = $p->{path}; |
78
|
0
|
|
|
|
|
|
my $use_ssl = $su->is_https_scheme($p); |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
my $args = $self->args; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my $datadir = $self->datadir; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
my $cmd = "nikto -host $host -port $port -root $path $args"; |
85
|
0
|
0
|
|
|
|
|
if ($use_ssl) { |
86
|
0
|
|
|
|
|
|
$cmd .= " -ssl"; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
$cmd .= " -output $datadir/$output 2>&1 | tee $datadir/$output.txt"; |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
my $result = `$cmd`; |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
my $parsed = $self->_nikto_parse($cmd, $result); |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
return $parsed; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
__END__ |