lib/Net/SinFP3/Output/Export.pm

filter: Statementstmt 19.6% 11 / 56 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 100% 2 / 2 totaltotal 22.8% 16 / 70 CC 8 SCAR 28.9
CC
8
Cov
18%
_printSignature
30.0
run
20.0
new
2.0
CRAP 18.1
« lib/Net/SinFP3/Output/AddSignature.pm ↑ Summary lib/Net/SinFP3/Output/ExportP.pm »
1 #
2 # $Id: Export.pm 22 2015-01-04 16:42:47Z gomor $
3 #
4 package Net::SinFP3::Output::Export;
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use base qw(Net::SinFP3::Output);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 __PACKAGE__->cgBuildIndices;
10  
11 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
12 0 my $self = shift->SUPER::new(
13 @_,
14 );
15  
16 0 return $self;
17 }
18  
19 0 ▶sub run {
Subroutine run: not called CC=4 SCAR=30.0
Pod documented
20 0 ▶ my $self = shift->SUPER::run(@_) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $self = (shift())->SUPER::run(@_) or return 0 0 0
21  
22 0 my $global = $self->global;
23 0 my $log = $global->log;
24 0 my $db = $global->db;
25  
26 0 ▶ if (ref($db) !~ /Net::SinFP3::DB::SinFP3/) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref($db) =~ /Net::SinFP3::DB::SinFP3/) 0 0 0
27 0 $log->fatal("Give a Net::SinFP3::DB::SinFP3 object (you gave [".ref($db)."]");
28 }
29  
30 0 my $idList = $db->searchSignatureIds;
31 0 for my $id (sort { $a <=> $b } @$idList) {
32 0 my $s = $db->retrieveSignature($id);
33 0 $s = $db->lookupPatterns($s);
34 0 _printSignature($db, $s);
35 }
36  
37 0 return 1;
38 }
39  
40 0 ▶sub _printSignature {
Subroutine _printSignature: not called CC=5 SCAR=34.0
41 0 my ($db, $s) = @_;
42  
43 print
44 $s->{ipVersion}. ': '.
45 $s->{systemClass}. ': '.
46 $s->{vendor}. ': '.
47 $s->{os}. ': '.
48 $s->{osVersion}. ': ['.
49 0 $s->{osVersionFamily}. ']';
50  
51 0 my $osVersionChildren = $db->getOsVersionChildrenList($s->{idSignature});
52 0 my $buf = '';
53 0 for my $osVersion (@$osVersionChildren) {
54 0 $buf .= $osVersion.', ';
55 }
56 0 $buf =~ s/, $//;
57 0 ▶ print " ($buf)" if $buf;
Branch: 1 branch
BranchTrueFalseTotal
if $buf 0 0 0
58 0 print "\n";
59  
60 print
61 'ID: '. $s->{idSignature}. "\n".
62 0 'Trusted: '.$s->{trusted}."\n";
63  
64 0 for my $h ('Heuristic0', 'Heuristic1', 'Heuristic2') {
65 0 my $mBinaryHeuristic = 'patternBinary'.$h;
66 0 my $mTcpFlagsHeuristic = 'patternTcpFlags'.$h;
67 0 my $mTcpWindowHeuristic = 'patternTcpWindow'.$h;
68 0 my $mTcpOptionsHeuristic = 'patternTcpOptions'.$h;
69 0 my $mTcpMssHeuristic = 'patternTcpMss'.$h;
70 0 my $mTcpWScaleHeuristic = 'patternTcpWScale'.$h;
71 0 my $mTcpOLengthHeuristic = 'patternTcpOLength'.$h;
72 0 (my $hn = $h) =~ s/euristic//;
73 0 for my $p ('S1', 'S2', 'S3') {
74 0 my $idBinary = 'id'.$p.'PatternBinary';
75 0 my $idTcpFlags = 'id'.$p.'PatternTcpFlags';
76 0 my $idTcpWindow = 'id'.$p.'PatternTcpWindow';
77 0 my $idTcpOptions = 'id'.$p.'PatternTcpOptions';
78 0 my $idTcpMss = 'id'.$p.'PatternTcpMss';
79 0 my $idTcpWScale = 'id'.$p.'PatternTcpWScale';
80 0 my $idTcpOLength = 'id'.$p.'PatternTcpOLength';
81  
82 print
83 $p.$hn.': '.
84 $s->{$p.$mBinaryHeuristic}.' '.
85 $s->{$p.$mTcpFlagsHeuristic}.' '.
86 $s->{$p.$mTcpWindowHeuristic}.' '.
87 $s->{$p.$mTcpOptionsHeuristic}.' '.
88 $s->{$p.$mTcpMssHeuristic}.' '.
89 $s->{$p.$mTcpWScaleHeuristic}.' '.
90 0 $s->{$p.$mTcpOLengthHeuristic}.
91 "\n";
92 }
93 }
94  
95 0 print "\n";
96  
97 0 return 1;
98 }
99  
100 1 1;
101  
102 __END__
« lib/Net/SinFP3/Output/AddSignature.pm ↑ Summary lib/Net/SinFP3/Output/ExportP.pm »