line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: Parser.pm 71 2008-08-31 05:58:17Z jabra $ |
2
|
|
|
|
|
|
|
package NexposeSimpleXML::Parser; |
3
|
|
|
|
|
|
|
{ |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
34859
|
use Object::InsideOut; |
|
2
|
|
|
|
|
151625
|
|
|
2
|
|
|
|
|
15
|
|
6
|
2
|
|
|
2
|
|
1559
|
use NexposeSimpleXML::Parser::Session; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my @session : Field : Arg(session) : Get(session) : Type(NexposeSimpleXML::Parser::Session); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# parse_file |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# Input: |
12
|
|
|
|
|
|
|
# argument - self obj - |
13
|
|
|
|
|
|
|
# argument - xml scalar |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# Ouptut: |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
sub parse_file { |
18
|
|
|
|
|
|
|
my ( $self, $file ) = @_; |
19
|
|
|
|
|
|
|
my $parser = XML::LibXML->new(); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $doc = $parser->parse_file($file); |
22
|
|
|
|
|
|
|
return NexposeSimpleXML::Parser->new( |
23
|
|
|
|
|
|
|
session => NexposeSimpleXML::Parser::Session->parse( $parser, $doc ) ); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub get_session { |
27
|
|
|
|
|
|
|
my ($self) = @_; |
28
|
|
|
|
|
|
|
return $self->session; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub get_host { |
32
|
|
|
|
|
|
|
my ($self, $ip) = @_; |
33
|
|
|
|
|
|
|
return $self->session->scandetails->get_host_ip($ip); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub get_all_hosts { |
37
|
|
|
|
|
|
|
my ($self) = @_; |
38
|
|
|
|
|
|
|
my @all_hosts = $self->session->scandetails->all_hosts(); |
39
|
|
|
|
|
|
|
return @all_hosts; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub get_port { |
43
|
|
|
|
|
|
|
my ($self, $port) = @_; |
44
|
|
|
|
|
|
|
return $self->session->scandetails->get_port($port); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub get_all_ports { |
48
|
|
|
|
|
|
|
my ($self) = @_; |
49
|
|
|
|
|
|
|
return $self->session->scandetails->all_ports(); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|