line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: Parser.pm 71 2008-08-31 05:58:17Z jabra $ |
2
|
|
|
|
|
|
|
package MetasploitExpress::Parser; |
3
|
|
|
|
|
|
|
{ |
4
|
2
|
|
|
2
|
|
33377
|
use Object::InsideOut; |
|
2
|
|
|
|
|
197359
|
|
|
2
|
|
|
|
|
14
|
|
5
|
2
|
|
|
2
|
|
1621
|
use MetasploitExpress::Parser::Session; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my @session : Field : Arg(session) : Get(session) : |
7
|
|
|
|
|
|
|
Type(MetasploitExpress::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 MetasploitExpress::Parser->new( session => |
23
|
|
|
|
|
|
|
MetasploitExpress::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
|
|
|
|
|
|
|
return $self->session->scandetails->all_hosts(); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub get_all_services { |
42
|
|
|
|
|
|
|
my ($self) = @_; |
43
|
|
|
|
|
|
|
return $self->session->scandetails->all_services(); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub get_all_events { |
47
|
|
|
|
|
|
|
my ($self) = @_; |
48
|
|
|
|
|
|
|
return $self->session->scandetails->all_events(); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub get_all_tasks { |
52
|
|
|
|
|
|
|
my ($self) = @_; |
53
|
|
|
|
|
|
|
return $self->session->scandetails->all_tasks(); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub get_all_reports { |
57
|
|
|
|
|
|
|
my ($self) = @_; |
58
|
|
|
|
|
|
|
return $self->session->scandetails->all_reports(); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|