File Coverage

blib/lib/Dirbuster/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 Dirbuster::Parser::ScanDetails;
3             {
4             our $VERSION = '0.01';
5             $VERSION = eval $VERSION;
6              
7 1     1   1957 use Object::InsideOut;
  1         3  
  1         6  
8 1     1   600 use XML::LibXML;
  0            
  0            
9             use Dirbuster::Parser::Result;
10             my @results : Field : Arg(results) : Get(results) : Type(List(Dirbuster::Parser::Result));
11              
12             sub parse {
13             my ( $self, $parser, $doc ) = @_;
14              
15             my $xpc = XML::LibXML::XPathContext->new($doc);
16             my @results;
17              
18             foreach my $h ( $xpc->findnodes('//DirBusterResults/Result') ) {
19             my $type = $h->getAttribute('type');
20             my $path = $h->getAttribute('path');
21             my $response_code = $h->getAttribute('responseCode');
22            
23             my $result = Dirbuster::Parser::Result->new(
24             type => $type,
25             path => $path,
26             response_code => $response_code,
27             );
28              
29             push( @results, $result );
30             }
31              
32             return Dirbuster::Parser::ScanDetails->new( results => \@results );
33             }
34              
35             sub all_results {
36             my ($self) = @_;
37             my @results = @{ $self->results };
38             return @results;
39             }
40              
41             sub print_hosts {
42             my ($self) = @_;
43             foreach my $r ( @{ $self->results } ) {
44             print "Path: " . $r->path . "\n";
45             print "Type: " . $r->type . "\n";
46             print "Response Code: " . $r->response_code . "\n";
47             }
48             }
49             }
50             1;