| 1 | package Nmap::Scanner::Backend::XML; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | @ISA = qw(Nmap::Scanner::Backend::Processor); | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use XML::SAX::ParserFactory; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Nmap::Scanner; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use Nmap::Scanner::Backend::Results; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use Nmap::Scanner::Backend::Processor; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | my $you = $class->SUPER::new(); | |||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | return bless $you, $class; | |||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | # Process results from "-oX -" | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | ▶ | sub process { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process: called CC=4 SCAR=16.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | my $pid = shift; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 2 | my $read = shift; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | my $cmdline = shift; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 2 | my $error = shift; | |||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | # Suppress warnings about reading unopened handle | ||||||||||||||||||||||||||||||||||||||||||
| 31 | 2 | $^W = 0; | |||||||||||||||||||||||||||||||||||||||||
| 32 | 2 | my $err = join('', (<$error>)); | |||||||||||||||||||||||||||||||||||||||||
| 33 | 2 | $^W = 1; | |||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | ▶ | if ($err ne '') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | close($read); | |||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | close($error); | |||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | warn <<EOF; | |||||||||||||||||||||||||||||||||||||||||
| 41 | <nmap-error> | ||||||||||||||||||||||||||||||||||||||||||
| 42 | <pid="$pid"/> | ||||||||||||||||||||||||||||||||||||||||||
| 43 | <cmdline="$cmdline"/> | ||||||||||||||||||||||||||||||||||||||||||
| 44 | <nmap-err>$err</nmap-msg> | ||||||||||||||||||||||||||||||||||||||||||
| 45 | </nmap-error> | ||||||||||||||||||||||||||||||||||||||||||
| 46 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | exit 1; | |||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 2 | my $handler = NmapHandler->new($self); | |||||||||||||||||||||||||||||||||||||||||
| 51 | 2 | my $parser = XML::SAX::ParserFactory->parser(Handler => $handler); | |||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 2 | eval { $parser->parse_file($read) }; | |||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 2 | ▶ | if (defined($@) && ($@ ne '')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $@ and $@ ne ""
MC/DC0%0/2
defined $@ and $@ ne ""
defined $@
$@ ne ""
Truth table33%1/3
A and B
A= defined $@B= $@ ne ""
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my $msg = join('', <$read>); | |||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | Nmap::Scanner::debug("bytes in input stream: " . tell($read)); | |||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | Nmap::Scanner::debug("bytes in error stream: " . tell($error)); | |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | warn <<EOF; | |||||||||||||||||||||||||||||||||||||||||
| 64 | <nmap-error> | ||||||||||||||||||||||||||||||||||||||||||
| 65 | <pid="$pid"/> | ||||||||||||||||||||||||||||||||||||||||||
| 66 | <cmdline="$cmdline"/> | ||||||||||||||||||||||||||||||||||||||||||
| 67 | <perl-msg>$@</perl-msg> | ||||||||||||||||||||||||||||||||||||||||||
| 68 | <nmap-msg>$msg</nmap-msg> | ||||||||||||||||||||||||||||||||||||||||||
| 69 | <nmap-err>$err</nmap-msg> | ||||||||||||||||||||||||||||||||||||||||||
| 70 | </nmap-error> | ||||||||||||||||||||||||||||||||||||||||||
| 71 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | close($read); | |||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | exit 1; | |||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 2 | close($read); | |||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 2 | return $handler->results(); | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | # | ||||||||||||||||||||||||||||||||||||||||||
| 86 | # SAX listener to process XML output from nmap. | ||||||||||||||||||||||||||||||||||||||||||
| 87 | # | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | package NmapHandler; | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 3 | ▶ | use base qw(XML::SAX::Base); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 3 | ▶ | use XML::SAX::Base; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 3 | ▶ | use Nmap::Scanner::Host; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 3 | ▶ | use Nmap::Scanner::Hostname; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 3 | ▶ | use Nmap::Scanner::Port; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 3 | ▶ | use Nmap::Scanner::Service; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 3 | ▶ | use Nmap::Scanner::Address; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 3 | ▶ | use Nmap::Scanner::Hosts; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 3 | ▶ | use Nmap::Scanner::ExtraPorts; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 3 | ▶ | use Nmap::Scanner::RunStats; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 3 | ▶ | use Nmap::Scanner::RunStats::Finished; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 3 | ▶ | use Nmap::Scanner::NmapRun; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 3 | ▶ | use Nmap::Scanner::ScanInfo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 3 | ▶ | use Nmap::Scanner::Task; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 3 | ▶ | use Nmap::Scanner::TaskProgress; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 3 | ▶ | use Nmap::Scanner::Distance; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 3 | ▶ | use Nmap::Scanner::Backend::Results; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 3 | ▶ | use Nmap::Scanner::OS; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 3 | ▶ | use Nmap::Scanner::OS::PortUsed; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 3 | ▶ | use Nmap::Scanner::OS::Uptime; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 3 | ▶ | use Nmap::Scanner::OS::Class; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 3 | ▶ | use Nmap::Scanner::OS::Match; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 3 | ▶ | use Nmap::Scanner::OS::TCPSequence; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 3 | ▶ | use Nmap::Scanner::OS::TCPTSSequence; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 3 | ▶ | use Nmap::Scanner::OS::IPIdSequence; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 3 | ▶ | use Nmap::Scanner::OS::Fingerprint; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | # One function per element .. fun! ;) | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 3 | my %HANDLERS = ( | |||||||||||||||||||||||||||||||||||||||||
| 125 | host => \&host, | ||||||||||||||||||||||||||||||||||||||||||
| 126 | hosts => \&hosts, | ||||||||||||||||||||||||||||||||||||||||||
| 127 | status => \&hoststatus, | ||||||||||||||||||||||||||||||||||||||||||
| 128 | hostname => \&hostname, | ||||||||||||||||||||||||||||||||||||||||||
| 129 | smurf => \&smurf, | ||||||||||||||||||||||||||||||||||||||||||
| 130 | address => \&hostaddress, | ||||||||||||||||||||||||||||||||||||||||||
| 131 | hostnames => \&hostnames, | ||||||||||||||||||||||||||||||||||||||||||
| 132 | port => \&port, | ||||||||||||||||||||||||||||||||||||||||||
| 133 | ports => \&ports, | ||||||||||||||||||||||||||||||||||||||||||
| 134 | state => \&state, | ||||||||||||||||||||||||||||||||||||||||||
| 135 | service => \&service, | ||||||||||||||||||||||||||||||||||||||||||
| 136 | owner => \&owner, | ||||||||||||||||||||||||||||||||||||||||||
| 137 | addport => \&addport, | ||||||||||||||||||||||||||||||||||||||||||
| 138 | extraports => \&extraports, | ||||||||||||||||||||||||||||||||||||||||||
| 139 | os => \&os, | ||||||||||||||||||||||||||||||||||||||||||
| 140 | portused => \&portused, | ||||||||||||||||||||||||||||||||||||||||||
| 141 | osclass => \&osclass, | ||||||||||||||||||||||||||||||||||||||||||
| 142 | osfingerprint => \&osfingerprint, | ||||||||||||||||||||||||||||||||||||||||||
| 143 | osmatch => \&osmatch, | ||||||||||||||||||||||||||||||||||||||||||
| 144 | uptime => \&uptime, | ||||||||||||||||||||||||||||||||||||||||||
| 145 | tcpsequence => \&tcpsequence, | ||||||||||||||||||||||||||||||||||||||||||
| 146 | tcptssequence => \&tcptssequence, | ||||||||||||||||||||||||||||||||||||||||||
| 147 | ipidsequence => \&ipidsequence, | ||||||||||||||||||||||||||||||||||||||||||
| 148 | nmaprun => \&nmaprun, | ||||||||||||||||||||||||||||||||||||||||||
| 149 | scaninfo => \&scaninfo, | ||||||||||||||||||||||||||||||||||||||||||
| 150 | taskbegin => \&taskbegin, | ||||||||||||||||||||||||||||||||||||||||||
| 151 | taskend => \&taskend, | ||||||||||||||||||||||||||||||||||||||||||
| 152 | taskprogress => \&taskprogress, | ||||||||||||||||||||||||||||||||||||||||||
| 153 | verbose => \&verbose, | ||||||||||||||||||||||||||||||||||||||||||
| 154 | debugging => \&debugging, | ||||||||||||||||||||||||||||||||||||||||||
| 155 | runstats => \&runstats, | ||||||||||||||||||||||||||||||||||||||||||
| 156 | finished => \&finished, | ||||||||||||||||||||||||||||||||||||||||||
| 157 | distance => \&distance, | ||||||||||||||||||||||||||||||||||||||||||
| 158 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 2 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 162 | 2 | my $backend = shift; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 2 | my $self = $class->SUPER::new(); | |||||||||||||||||||||||||||||||||||||||||
| 164 | 2 | $self->{NMAP_BACKEND} = $backend; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 2 | $self->{NMAP_PORT} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 166 | 2 | $self->{NMAP_HOST} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 2 | $self->{NMAP_RUNSTATS} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 2 | $self->{NMAP_NMAPRUN} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 2 | $self->{PORT_COUNT} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 2 | $self->{NMAP_OSGUESS} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 2 | $self->{NMAP_RESULTS} = Nmap::Scanner::Backend::Results->new(); | |||||||||||||||||||||||||||||||||||||||||
| 172 | 2 | $self->{NMAP_TASK} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 2 | $self->{NMAP_TASK_PROGRESS} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 174 | 2 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | # Controller for start element handlers | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 73 | ▶ | sub start_element { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_element: called CC=4 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 73 | my ($self, $el) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 181 | 73 | my $name = $el->{Name}; | |||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 73 | ▶ | if (exists $HANDLERS{$name}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 73 | Nmap::Scanner::debug("About to handle $name"); | |||||||||||||||||||||||||||||||||||||||||
| 185 | 73 | &{$HANDLERS{$name}}($self, $el->{Attributes}); | |||||||||||||||||||||||||||||||||||||||||
| 186 | 73 | Nmap::Scanner::debug("Handled $name"); | |||||||||||||||||||||||||||||||||||||||||
| 187 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | my %attrs = %{$el->{Attributes}}; | |||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | return unless Nmap::Scanner::debug("Received unhandled XML: $name"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | for my $key (keys %attrs) { | |||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | Nmap::Scanner::debug("Unhandled[$name]: $key = $attrs{$key}"); | |||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | # Controller for end element handlers | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 73 | ▶ | sub end_element { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_element: called CC=12 SCAR=25.5
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 73 | my ($self, $el) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 73 | ▶ | if ($el->{Name} eq 'host') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 9 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 2 | my $host = $self->{NMAP_HOST}; | |||||||||||||||||||||||||||||||||||||||||
| 207 | $self->{NMAP_HOST}->os($self->{NMAP_OSGUESS}) | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 2 | ▶ | if $self->{NMAP_OSGUESS}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 2 | $self->{NMAP_RESULTS}->add_host($host); | |||||||||||||||||||||||||||||||||||||||||
| 210 | 2 | $self->{NMAP_BACKEND}->notify_scan_complete($self->{NMAP_HOST}); | |||||||||||||||||||||||||||||||||||||||||
| 211 | 2 | undef $self->{NMAP_OSGUESS}; | |||||||||||||||||||||||||||||||||||||||||
| 212 | } elsif ($el->{Name} eq 'hosts') { | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 2 | $self->{NMAP_NMAPRUN}->run_stats($self->{NMAP_RUNSTATS}); | |||||||||||||||||||||||||||||||||||||||||
| 214 | } elsif ($el->{Name} eq 'port') { | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 12 | my $port = $self->{NMAP_PORT}; | |||||||||||||||||||||||||||||||||||||||||
| 216 | 12 | Nmap::Scanner::debug("Adding port: " . $port->portid()); | |||||||||||||||||||||||||||||||||||||||||
| 217 | 12 | $self->{NMAP_HOST}->add_port($port); | |||||||||||||||||||||||||||||||||||||||||
| 218 | 12 | $self->{PORT_COUNT}++; | |||||||||||||||||||||||||||||||||||||||||
| 219 | $self->{NMAP_BACKEND}->notify_port_found( | ||||||||||||||||||||||||||||||||||||||||||
| 220 | $self->{NMAP_HOST}, $self->{NMAP_PORT} | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 12 | ); | |||||||||||||||||||||||||||||||||||||||||
| 222 | 12 | undef $self->{NMAP_PORT}; | |||||||||||||||||||||||||||||||||||||||||
| 223 | } elsif ($el->{Name} eq 'ports') { | ||||||||||||||||||||||||||||||||||||||||||
| 224 | 2 | ▶ | unless ($self->{PORT_COUNT} > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | $self->{NMAP_BACKEND}->notify_no_ports_open( | ||||||||||||||||||||||||||||||||||||||||||
| 226 | $self->{NMAP_HOST}, $self->{NMAP_HOST}->extra_ports() | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 2 | $self->{PORT_COUNT} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 230 | } elsif ($el->{Name} eq 'hostnames') { | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 2 | $self->{NMAP_BACKEND}->notify_scan_started($self->{NMAP_HOST}); | |||||||||||||||||||||||||||||||||||||||||
| 232 | } elsif ($el->{Name} eq 'taskbegin') { | ||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | $self->{NMAP_BACKEND}->notify_task_started($self->{NMAP_TASK}); | |||||||||||||||||||||||||||||||||||||||||
| 234 | } elsif ($el->{Name} eq 'taskend') { | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $self->{NMAP_BACKEND}->notify_task_ended($self->{NMAP_TASK}); | |||||||||||||||||||||||||||||||||||||||||
| 236 | } elsif ($el->{Name} eq 'taskprogress') { | ||||||||||||||||||||||||||||||||||||||||||
| 237 | $self->{NMAP_BACKEND}->notify_task_progress( | ||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | $self->{NMAP_TASK_PROGRESS}); | |||||||||||||||||||||||||||||||||||||||||
| 239 | } elsif ($el->{Name} eq 'nmaprun') { | ||||||||||||||||||||||||||||||||||||||||||
| 240 | 2 | $self->{NMAP_RESULTS}->nmap_run($self->{NMAP_NMAPRUN}); | |||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 2 | ▶ | sub host { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
host: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 2 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 246 | 2 | $self->{NMAP_HOST} = Nmap::Scanner::Host->new(); | |||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 2 | ▶ | sub hoststatus { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hoststatus: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | 2 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 251 | 2 | my $state = $ref->{'{}state'}->{Value}; | |||||||||||||||||||||||||||||||||||||||||
| 252 | 2 | $self->{NMAP_HOST}->status($state); | |||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | 1 | ▶ | sub hostname { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hostname: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | 1 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 257 | 1 | my $host = $self->{NMAP_HOST}; | |||||||||||||||||||||||||||||||||||||||||
| 258 | 1 | my $hostname = Nmap::Scanner::Hostname->new(); | |||||||||||||||||||||||||||||||||||||||||
| 259 | 1 | $hostname->name($ref->{'{}name'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 260 | 1 | $hostname->type($ref->{'{}type'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 261 | 1 | $host->add_hostname($hostname); | |||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | 2 | ▶ | sub hostnames { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hostnames: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 266 | # Do nothing, as this is just an array of hostnames, held in Host object. | ||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 2 | ▶ | sub ports { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ports: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 271 | # Do nothing, as this is just an array of ports, held in Host object. | ||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | sub smurf { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
smurf: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | my $smurf = $ref->{'{}responses'}->{Value}; | |||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | $self->{NMAP_HOST}->smurf($smurf); | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 3 | ▶ | sub hostaddress { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hostaddress: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 3 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 282 | 3 | my $addr = Nmap::Scanner::Address->new(); | |||||||||||||||||||||||||||||||||||||||||
| 283 | 3 | $addr->addr($ref->{'{}addr'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 284 | 3 | $addr->addrtype($ref->{'{}addrtype'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 285 | $addr->vendor($ref->{'{}vendor'}->{Value}) | ||||||||||||||||||||||||||||||||||||||||||
| 286 | 3 | ▶ | if $ref->{'{}vendor'}->{Value}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | 3 | $self->{NMAP_HOST}->add_address($addr); | |||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | 12 | ▶ | sub port { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
port: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | 12 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 292 | 12 | my $port = Nmap::Scanner::Port->new(); | |||||||||||||||||||||||||||||||||||||||||
| 293 | 12 | $port->protocol($ref->{'{}protocol'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 294 | 12 | $port->portid($ref->{'{}portid'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 295 | 12 | $self->{NMAP_PORT} = $port; | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 12 | ▶ | sub state { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
state: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 12 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 300 | 12 | $self->{NMAP_PORT}->state($ref->{'{}state'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | sub owner { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
owner: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | my $owner = $ref->{'{}name'}->{Value}; | |||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | $self->{NMAP_PORT}->owner($owner); | |||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | 11 | ▶ | sub service { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
service: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | 11 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 312 | 11 | my $port = $self->{NMAP_PORT}; | |||||||||||||||||||||||||||||||||||||||||
| 313 | 11 | my $svc = Nmap::Scanner::Service->new(); | |||||||||||||||||||||||||||||||||||||||||
| 314 | 11 | $svc->name($ref->{'{}name'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 315 | 11 | $svc->proto($ref->{'{}proto'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 316 | 11 | $svc->rpcnum($ref->{'{}rpcnum'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 317 | 11 | $svc->lowver($ref->{'{}lowver'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 318 | 11 | $svc->highver($ref->{'{}highver'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 319 | 11 | $svc->method($ref->{'{}method'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 320 | 11 | $svc->conf($ref->{'{}conf'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 321 | 11 | $svc->tunnel($ref->{'{}tunnel'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 322 | 11 | $svc->product($ref->{'{}product'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 323 | 11 | $svc->version($ref->{'{}version'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 324 | 11 | $svc->extrainfo($ref->{'{}extrainfo'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 325 | 11 | $port->service($svc); | |||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | sub addport { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
addport: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | my $port = Nmap::Scanner::Port->new(); | |||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | $port->state($ref->{'{}state'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $port->protocol($ref->{'{}protocol'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | $port->portid($ref->{'{}portid'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 335 | $port->owner($ref->{'{}owner'}->{Value}) | ||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | if $ref->{'{}owner'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | $self->{NMAP_BACKEND}->notify_port_found( | ||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | $self->{NMAP_HOST}, $port | |||||||||||||||||||||||||||||||||||||||||
| 339 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | 2 | ▶ | sub extraports { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extraports: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | 2 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 344 | 2 | my $extras = Nmap::Scanner::ExtraPorts->new(); | |||||||||||||||||||||||||||||||||||||||||
| 345 | 2 | $extras->state($ref->{'{}state'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 346 | 2 | $extras->count($ref->{'{}count'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 347 | 2 | $self->{NMAP_HOST}->extra_ports($extras); | |||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | 1 | ▶ | sub os { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
os: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | 1 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 352 | 1 | $self->{NMAP_OSGUESS} = Nmap::Scanner::OS->new(); | |||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | 2 | ▶ | sub osclass { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
osclass: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | 2 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 357 | 2 | my $os = $self->{NMAP_OSGUESS}; | |||||||||||||||||||||||||||||||||||||||||
| 358 | 2 | my $class = Nmap::Scanner::OS::Class->new(); | |||||||||||||||||||||||||||||||||||||||||
| 359 | 2 | $class->type($ref->{'{}type'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 360 | 2 | $class->vendor($ref->{'{}vendor'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 361 | 2 | $class->osfamily($ref->{'{}osfamily'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 362 | 2 | $class->osgen($ref->{'{}osgen'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 363 | 2 | $class->accuracy($ref->{'{}accuracy'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 364 | 2 | $os->add_os_class($class); | |||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | sub osfingerprint { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
osfingerprint: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | my $os = $self->{NMAP_OSGUESS}; | |||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | my $fingerprint = Nmap::Scanner::OS::Fingerprint->new(); | |||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | $fingerprint->fingerprint($ref->{'{}fingerprint'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $os->osfingerprint($fingerprint); | |||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 1 | ▶ | sub osmatch { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
osmatch: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 376 | 1 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 377 | 1 | my $os = $self->{NMAP_OSGUESS}; | |||||||||||||||||||||||||||||||||||||||||
| 378 | 1 | my $match = Nmap::Scanner::OS::Match->new(); | |||||||||||||||||||||||||||||||||||||||||
| 379 | 1 | $match->name($ref->{'{}name'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 380 | 1 | $match->accuracy($ref->{'{}accuracy'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 381 | 1 | $os->add_os_match($match); | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | 2 | ▶ | sub portused { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
portused: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | 2 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 386 | 2 | my $os = $self->{NMAP_OSGUESS}; | |||||||||||||||||||||||||||||||||||||||||
| 387 | 2 | my $port = Nmap::Scanner::OS::PortUsed->new(); | |||||||||||||||||||||||||||||||||||||||||
| 388 | 2 | $port->state($ref->{'{}state'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 389 | 2 | $port->proto($ref->{'{}proto'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 390 | 2 | $port->portid($ref->{'{}portid'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 391 | 2 | $os->add_port_used($port); | |||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | 1 | ▶ | sub uptime { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uptime: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | 1 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 396 | 1 | my $os = $self->{NMAP_OSGUESS}; | |||||||||||||||||||||||||||||||||||||||||
| 397 | 1 | my $u = Nmap::Scanner::OS::Uptime->new(); | |||||||||||||||||||||||||||||||||||||||||
| 398 | 1 | $u->seconds($ref->{'{}seconds'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 399 | 1 | $u->lastboot($ref->{'{}lastboot'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 400 | 1 | $os->uptime($u); | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | 1 | ▶ | sub tcpsequence { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tcpsequence: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 404 | 1 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 405 | 1 | my $os = $self->{NMAP_OSGUESS}; | |||||||||||||||||||||||||||||||||||||||||
| 406 | 1 | my $t = Nmap::Scanner::OS::TCPSequence->new(); | |||||||||||||||||||||||||||||||||||||||||
| 407 | 1 | $t->index($ref->{'{}index'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 408 | 1 | $t->class($ref->{'{}class'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 409 | 1 | $t->difficulty($ref->{'{}difficulty'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 410 | 1 | $t->values($ref->{'{}values'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 411 | 1 | $os->tcpsequence($t); | |||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | 1 | ▶ | sub tcptssequence { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tcptssequence: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | 1 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 416 | 1 | my $os = $self->{NMAP_OSGUESS}; | |||||||||||||||||||||||||||||||||||||||||
| 417 | 1 | my $t = Nmap::Scanner::OS::TCPTSSequence->new(); | |||||||||||||||||||||||||||||||||||||||||
| 418 | 1 | $t->class($ref->{'{}class'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 419 | 1 | $t->values($ref->{'{}values'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 420 | 1 | $os->tcptssequence($t); | |||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | 1 | ▶ | sub ipidsequence { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ipidsequence: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | 1 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 425 | 1 | my $os = $self->{NMAP_OSGUESS}; | |||||||||||||||||||||||||||||||||||||||||
| 426 | 1 | my $t = Nmap::Scanner::OS::IPIdSequence->new(); | |||||||||||||||||||||||||||||||||||||||||
| 427 | 1 | $t->class($ref->{'{}class'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 428 | 1 | $t->values($ref->{'{}values'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 429 | 1 | $os->ipidsequence($t); | |||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | 2 | ▶ | sub nmaprun { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nmaprun: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | 2 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 434 | 2 | my $run = Nmap::Scanner::NmapRun->new(); | |||||||||||||||||||||||||||||||||||||||||
| 435 | 2 | $run->scanner($ref->{'{}scanner'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 436 | 2 | $run->args($ref->{'{}args'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 437 | 2 | $run->start($ref->{'{}start'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 438 | 2 | $run->startstr($ref->{'{}startstr'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 439 | 2 | $run->version($ref->{'{}version'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 440 | 2 | $run->xmloutputversion($ref->{'{}xmloutputversion'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 441 | 2 | $self->{NMAP_NMAPRUN} = $run; | |||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | 2 | ▶ | sub scaninfo { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scaninfo: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | 2 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 446 | 2 | my $info = Nmap::Scanner::ScanInfo->new(); | |||||||||||||||||||||||||||||||||||||||||
| 447 | 2 | $info->type($ref->{'{}type'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 448 | 2 | $info->protocol($ref->{'{}protocol'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 449 | 2 | $info->numservices($ref->{'{}numservices'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 450 | 2 | $info->services($ref->{'{}services'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 451 | 2 | $self->{NMAP_NMAPRUN}->add_scan_info($info); | |||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | ▶ | sub taskbegin { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
taskbegin: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | my $name = $ref->{'{}task'}->{'Value'}; | |||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | my $time = $ref->{'{}time'}->{'Value'}; | |||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | my $task = Nmap::Scanner::Task->new(); | |||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | $task->name($name); | |||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | $task->begin_time($time); | |||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | $self->{NMAP_TASK} = $task; | |||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | ▶ | sub taskprogress { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
taskprogress: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | my $time = $ref->{'{}time'}->{'Value'}; | |||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my $percent = $ref->{'{}percent'}->{'Value'}; | |||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | my $remaining = $ref->{'{}remaining'}->{'Value'}; | |||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | my $etc = $ref->{'{}etc'}->{'Value'}; | |||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | my $tp = Nmap::Scanner::TaskProgress->new(); | |||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | $tp->task($self->{NMAP_TASK}); | |||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | $tp->time($time); | |||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | $tp->percent($percent); | |||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | $tp->remaining($remaining); | |||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | $tp->etc($etc); | |||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | $self->{NMAP_TASK_PROGRESS} = $tp; | |||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | sub taskend { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
taskend: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | my $name = $ref->{'{}task'}->{'Value'}; | |||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | my $time = $ref->{'{}time'}->{'Value'}; | |||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | my $task = $self->{NMAP_TASK}; | |||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | $task->end_time($time); | |||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | $self->{NMAP_NMAPRUN}->add_task($task); | |||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | ▶ | sub distance { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
distance: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | my $distance = Nmap::Scanner::Distance->new(); | |||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | my $value = $ref->{'{}value'}->{Value}; | |||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | $distance->value($value); | |||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | $self->{NMAP_HOST}->distance($distance); | |||||||||||||||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||
| 505 | 2 | ▶ | sub verbose { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
verbose: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 506 | 2 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 507 | 2 | $self->{NMAP_NMAPRUN}->verbose($ref->{'{}level'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||
| 510 | 2 | ▶ | sub debugging { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debugging: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 511 | 2 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 512 | 2 | $self->{NMAP_NMAPRUN}->debugging($ref->{'{}level'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | 2 | ▶ | sub runstats { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
runstats: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | 2 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 517 | 2 | my $stats = Nmap::Scanner::RunStats->new(); | |||||||||||||||||||||||||||||||||||||||||
| 518 | 2 | $self->{NMAP_RUNSTATS} = $stats; | |||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | 2 | ▶ | sub hosts { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hosts: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 522 | 2 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 523 | 2 | my $hosts = Nmap::Scanner::Hosts->new(); | |||||||||||||||||||||||||||||||||||||||||
| 524 | 2 | $hosts->up($ref->{'{}up'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 525 | 2 | $hosts->down($ref->{'{}down'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 526 | 2 | $hosts->total($ref->{'{}total'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 527 | 2 | $self->{NMAP_RUNSTATS}->hosts($hosts); | |||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | 2 | ▶ | sub finished { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finished: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 531 | 2 | my ($self, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 532 | 2 | my $f = Nmap::Scanner::RunStats::Finished->new(); | |||||||||||||||||||||||||||||||||||||||||
| 533 | 2 | $f->time($ref->{'{}time'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 534 | 2 | $f->timestr($ref->{'{}timestr'}->{Value}); | |||||||||||||||||||||||||||||||||||||||||
| 535 | 2 | $self->{NMAP_RUNSTATS}->finished($f); | |||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||
| 538 | 2 | ▶ | sub results { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
results: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 539 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 540 | 2 | return $self->{NMAP_RESULTS}; | |||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||