lib/Net/SinFP3/Output/ExportP.pm

filter: Statementstmt 21.1% 11 / 52 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 100% 2 / 2 totaltotal 24.2% 16 / 66 CC 7 SCAR 26.2
CC
7
Cov
19%
run
20.0
_printSignatureP
20.0
new
2.0
CRAP 13.8
« lib/Net/SinFP3/Output/Export.pm ↑ Summary script/sinfp3-plugin-add-signature.pl »
1 #
2 # $Id: ExportP.pm 22 2015-01-04 16:42:47Z gomor $
3 #
4 package Net::SinFP3::Output::ExportP;
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 [".
28 ref($db)."]");
29 }
30  
31 0 my $idList = $db->searchSignaturePIds;
32 0 for my $id (sort { $a <=> $b } @$idList) {
33 0 my $s = $db->retrieveSignatureP($id);
34 0 $s = $db->lookupPatternsP($s);
35 0 _printSignatureP($db, $s);
36 }
37 }
38  
39 0 ▶sub _printSignatureP {
Subroutine _printSignatureP: not called CC=4 SCAR=30.0
40 0 my ($db, $s) = @_;
41  
42 print
43 $s->{ipVersion}. ': '.
44 $s->{systemClass}. ': '.
45 $s->{vendor}. ': '.
46 $s->{os}. ': '.
47 $s->{osVersion}. ': ['.
48 0 $s->{osVersionFamily}. ']';
49  
50 0 my $osVersionChildren = $db->getOsVersionChildrenPList($s->{idSignatureP});
51 0 my $buf = '';
52 0 for my $osVersion (@$osVersionChildren) {
53 0 $buf .= $osVersion.', ';
54 }
55 0 $buf =~ s/, $//;
56 0 ▶ print " ($buf)" if $buf;
Branch: 1 branch
BranchTrueFalseTotal
if $buf 0 0 0
57 0 print "\n";
58  
59 print
60 'ID: '. $s->{idSignatureP}. "\n".
61 0 'Trusted: '.$s->{trusted}."\n";
62  
63 0 for my $h ('Heuristic0', 'Heuristic1', 'Heuristic2') {
64 0 my $mTcpFlagsHeuristic = 'patternTcpFlags'.$h;
65 0 my $mTcpWindowHeuristic = 'patternTcpWindow'.$h;
66 0 my $mTcpOptionsHeuristic = 'patternTcpOptions'.$h;
67 0 my $mTcpMssHeuristic = 'patternTcpMss'.$h;
68 0 my $mTcpWScaleHeuristic = 'patternTcpWScale'.$h;
69 0 my $mTcpOLengthHeuristic = 'patternTcpOLength'.$h;
70  
71 0 my $idTcpFlags = 'idPatternTcpFlags';
72 0 my $idTcpWindow = 'idPatternTcpWindow';
73 0 my $idTcpOptions = 'idPatternTcpOptions';
74 0 my $idTcpMss = 'idPatternTcpMss';
75 0 my $idTcpWScale = 'idPatternTcpWScale';
76 0 my $idTcpOLength = 'idPatternTcpOLength';
77  
78 0 (my $hn = $h) =~ s/euristic//;
79  
80 print
81 "SP$hn: ".
82 $s->{$mTcpFlagsHeuristic}.' '.
83 $s->{$mTcpWindowHeuristic}.' '.
84 $s->{$mTcpOptionsHeuristic}.' '.
85 $s->{$mTcpMssHeuristic}.' '.
86 $s->{$mTcpWScaleHeuristic}.' '.
87 0 $s->{$mTcpOLengthHeuristic}.
88 "\n";
89 }
90  
91 0 print "\n";
92  
93 0 return 1;
94 }
95  
96 1 1;
97  
98 __END__
« lib/Net/SinFP3/Output/Export.pm ↑ Summary script/sinfp3-plugin-add-signature.pl »