File Coverage

blib/lib/Burpsuite/Parser/ScanDetails.pm
Criterion Covered Total %
statement 4 6 66.6
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 6 8 75.0


line stmt bran cond sub pod time code
1             # $Id: ScanDetails.pm 18 2008-05-05 23:55:18Z jabra $
2             package Burpsuite::Parser::ScanDetails;
3             {
4             our $VERSION = '0.01';
5             $VERSION = eval $VERSION;
6              
7 1     1   8821 use Object::InsideOut;
  1         4  
  1         11  
8 1     1   558 use XML::LibXML;
  0            
  0            
9             use Burpsuite::Parser::Issue;
10              
11             my @issues : Field : Arg(issues) : Get(issues) : Type( List(Burpsuite::Parser::Issue) );
12              
13             sub parse {
14             my ( $self, $parser, $doc ) = @_;
15              
16             my $xpc = XML::LibXML::XPathContext->new($doc);
17             my @issues;
18             foreach my $h ( $xpc->findnodes('//issues/issue') ) {
19             my $confidence
20             = @{$h->getElementsByTagName('confidence')}[0]->textContent();
21             my $serial_number
22             = @{$h->getElementsByTagName('serialNumber')}[0]->textContent();
23             my $type
24             = @{$h->getElementsByTagName('type')}[0]->textContent();
25             my $name
26             = @{$h->getElementsByTagName('name')}[0]->textContent();
27             my $host
28             = @{$h->getElementsByTagName('host')}[0]->textContent();
29             my $path
30             = @{$h->getElementsByTagName('path')}[0]->textContent();
31             my $location
32             = @{$h->getElementsByTagName('location')}[0]->textContent();
33             my $severity
34             = @{$h->getElementsByTagName('severity')}[0]->textContent();
35              
36              
37             my $issue_background =
38             scalar( @{$h->getElementsByTagName('issueBackground')} ) > 0
39             ? @{$h->getElementsByTagName('issueBackground')}[0]->textContent()
40             : '';
41            
42             my $remediation_background =
43             scalar( @{$h->getElementsByTagName('remediationBackground')} ) > 0
44             ? @{$h->getElementsByTagName('remediationBackground')}[0]->textContent()
45             : '';
46              
47             my $issue_detail =
48             scalar( @{$h->getElementsByTagName('issueDetail')} ) > 0
49             ? @{$h->getElementsByTagName('issueDetail')}[0]->textContent()
50             : '';
51            
52             my $issue = Burpsuite::Parser::Issue->new(
53             serial_number => $serial_number,
54             type => $type,
55             name => $name,
56             host => $host,
57             path => $path,
58             location => $location,
59             severity => $severity,
60             confidence => $confidence,
61             issue_background => $issue_background,
62             issue_detail => $issue_detail,
63             remediation_background => $remediation_background,
64             request => '',
65             response => '',
66             );
67              
68             push( @issues, $issue );
69             }
70            
71             return Burpsuite::Parser::ScanDetails->new( issues => \@issues );
72             }
73              
74             sub all_issues {
75             my ($self) = @_;
76             my @issues = @{ $self->issues };
77             return @issues;
78             }
79             }
80             1;