| 1 | |||
| 2 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 3 | ▶ | use Class::Generate qw(class); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 3 | class 'Nmap::Scanner::Port' => { | |
| 6 | qw(owner $ | ||
| 7 | portid $ | ||
| 8 | protocol $ | ||
| 9 | state $ | ||
| 10 | service Nmap::Scanner::Service | ||
| 11 | ), | ||
| 12 | '&as_xml' => q! | ||
| 13 | |||
| 14 | my $service_xml = ($self->{'service'} ? $service->as_xml() : ''); | ||
| 15 | my $owner_xml = ($self->{'owner'} ? qq(owner="$self->{'owner'}" ) : ''); | ||
| 16 | |||
| 17 | my $xml = qq(<port protocol="$self->{protocol}" ) . | ||
| 18 | qq(portid="$self->{portid}" $owner_xml> | ||
| 19 | <state state="$self->{state}"/> | ||
| 20 | $service_xml | ||
| 21 | </port>); | ||
| 22 | |||
| 23 | return $xml; | ||
| 24 | |||
| 25 | ! | ||
| 26 | }; | ||
| 27 | |||
| 28 | =pod | ||
| 29 | |||
| 30 | =head1 Name | ||
| 31 | |||
| 32 | Port - Holds information about a remote port as detected by nmap. | ||
| 33 | |||
| 34 | =head2 portid() | ||
| 35 | |||
| 36 | Port number | ||
| 37 | |||
| 38 | =head2 owner() | ||
| 39 | |||
| 40 | If ident scan was performed and succeeded, this will contain | ||
| 41 | the username the service on the port runs as. | ||
| 42 | |||
| 43 | =head2 protocol() | ||
| 44 | |||
| 45 | Protocol of the port, 'TCP' or 'UDP' for application level ports, | ||
| 46 | 'BGP,' 'ICMP,' etc for protocol level ports. | ||
| 47 | |||
| 48 | =head2 state() | ||
| 49 | |||
| 50 | Textual representation of the state of the port: `open', `closed', | ||
| 51 | `filtered', etc. | ||
| 52 | |||
| 53 | =head2 service() | ||
| 54 | |||
| 55 | Service this port represents if known (Nmap::Scanner::Service reference) | ||
| 56 | |||
| 57 | =cut | ||
| 58 | |||
| 59 | 3 | 1; | |