Parser.pm

filter: Statementstmt 31.4% 11 / 35 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 28.5% 2 / 7 Podpod 80.0% 4 / 5 totaltotal 31.4% 17 / 54 CC 4 SCAR 22.0
CC
4
Cov
27%
parse_scan
20.0
parse_file
2.0
get_session
2.0
CRAP 9.0
« Parser/DomainScanDetails.pm ↑ Summary Parser/Session.pm »
1 # $Id: Parser.pm 302 2009-11-21 02:31:24Z jabra $
2 package Fierce::Parser;
3 {
4 1 our $VERSION = '0.08';
5 1 $VERSION = eval $VERSION;
6  
7 1 ▶ use Object::InsideOut;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶ use Fierce::Parser::Session;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 my @session : Field : Arg(session) : Get(session) :
10 Type(Fierce::Parser::Session);
11  
12 # parse_file
13 #
14 # Input:
15 # argument - self obj -
16 # argument - xml scalar
17 #
18 # Ouptut:
19 #
20 0 ▶ sub parse_file {
Subroutine parse_file: not called CC=1 SCAR=6.9
Pod documented
21 0 my ( $self, $file ) = @_;
22 0 my $parser = XML::LibXML->new();
23  
24 0 my $doc = $parser->parse_file($file);
25 0 return Fierce::Parser->new(
26 session => Fierce::Parser::Session->parse( $parser, $doc ) );
27 }
28  
29 0 ▶ sub parse_scan {
Subroutine parse_scan: not called CC=4 SCAR=30.0
Pod undocumented
30 0 my ( $self, $args, @domains ) = @_;
31 0 my $FH;
32  
33 0 ▶ if ( $args =~ /-format/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args =~ /-format/i) 0 0 0
34 0 die
35 "[Fierce::Parser] Cannot pass option '-format ' to parse_scan()";
36 }
37  
38 0 ▶ if ( $args =~ /-output/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args =~ /-output/i) 0 0 0
39 0 die
40 "[Fierce::Parser] Cannot pass option '-output ' to parse_scan()";
41 }
42  
43 0 my $cmd = "fierce -format xml $args -dns " . ( join ',', @domains );
44  
45 #print "$cmd\n";
46 0 ▶ open $FH, "$cmd |"
Condition0%0/2
"$cmd |" || die("[Fierce::Parser] Could not perform nikto scan - $!")
l!l
00
MC/DC0%0/1
"$cmd |" || die("[Fierce::Parser] Could not perform nikto scan - $!")
"$cmd |"
Truth table0%0/2
A
A= "$cmd |"
Aresult
11
00
47 || die "[Fierce::Parser] Could not perform nikto scan - $!";
48 0 my $p = XML::LibXML->new();
49 0 my $doc = $p->parse_fh($FH);
50 0 my $parser = Fierce::Parser->new(
51 session => Fierce::Parser::Session->parse( $p, $doc ) );
52 0 close $FH;
53 0 return $parser;
54 }
55  
56 0 ▶ sub get_session {
Subroutine get_session: not called CC=1 SCAR=6.9
Pod documented
57 0 my ($self) = @_;
58 0 return $self->session;
59 }
60  
61 0 ▶ sub get_node {
Subroutine get_node: not called CC=1 SCAR=6.9
Pod documented
62 0 my ( $self, $domain ) = @_;
63 0 return $self->session->domainscandetails->get_host_hostname($domain);
64 }
65  
66 0 ▶ sub get_all_nodes {
Subroutine get_all_nodes: not called CC=1 SCAR=6.9
Pod documented
67 0 my ($self) = @_;
68 0 my @all_hosts = $self->session->domainscandetails->all_hosts();
69 0 return @all_hosts;
70 }
71 }
72 1 1;
73  
« Parser/DomainScanDetails.pm ↑ Summary Parser/Session.pm »