lib/Net/SinFP3/Ext/IP.pm

filter: Statementstmt 25.0% 11 / 44 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 37.5% 3 / 8 Podpod n/a totaltotal 16.8% 14 / 83 CC 12 SCAR 32.7
CC
12
Cov
16%
__analyzeIpTtl
56.0
__analyzeIpId
20.0
__analyzeIpDfBit
6.0
CRAP 26.4
« lib/Net/SinFP3/Result/Unknown.pm ↑ Summary lib/Net/SinFP3/Output/OsOnly.pm »
1 #
2 # $Id: IP.pm,v 008243d3e89a 2018/07/21 14:54:07 gomor $
3 #
4 package Net::SinFP3::Ext::IP;
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(Class::Gomor::Array);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 __PACKAGE__->cgBuildIndices;
10  
11 # This is to verify that RST packets are generated from the target with
12 # the same TTL as a SYN|ACK packet. We accept a difference of 3 hops, but
13 # if this is greater, we consider to not be the same generated TTL
14 # Example: SunOS 5.9 generates a TTL of 60 in a SYN|ACK from our probe,
15 # but a TTL of 64 for a RST from our probe. So, $ttl = 0.
16 0 ▶sub __analyzeIpTtl {
Subroutine __analyzeIpTtl: not called CC=7 SCAR=40.3
17 0 my $self = shift;
18 0 my ($p, $p2) = @_;
19 0 ▶ return 1 if ! $p2 || ! $p2->reply;
Branch: 1 branch
BranchTrueFalseTotal
unless $p2 and $p2->reply 0 0 0
Condition0%0/3
$p2 and $p2->reply
!ll&&!rl&&r
000
MC/DC0%0/2
$p2 and $p2->reply
$p2 $p2->reply
Truth table0%0/3
A and B
A= $p2B= $p2->reply
ABresult
0X0
100
111
20 0 my $ttlSrc = $self->getResponseIpTtl($p2);
21 0 my $ttlDst = $self->getResponseIpTtl($p);
22 0 my $ttl = 1;
23 0 ▶ $ttl = 0 if (($ttlSrc > $ttlDst) && ($ttlSrc - $ttlDst > 3));
Branch: 1 branch
BranchTrueFalseTotal
if $ttlSrc > $ttlDst and $ttlSrc - $ttlDst > 3 0 0 0
Condition0%0/3
$ttlSrc > $ttlDst and $ttlSrc - $ttlDst > 3
!ll&&!rl&&r
000
MC/DC0%0/2
$ttlSrc > $ttlDst and $ttlSrc - $ttlDst > 3
$ttlSrc > $ttlDst $ttlSrc - $ttlDst > 3
Truth table0%0/3
A and B
A= $ttlSrc > $ttlDstB= $ttlSrc - $ttlDst > 3
ABresult
0X0
100
111
24 0 ▶ $ttl = 0 if (($ttlDst > $ttlSrc) && ($ttlDst - $ttlSrc > 3));
Branch: 1 branch
BranchTrueFalseTotal
if $ttlDst > $ttlSrc and $ttlDst - $ttlSrc > 3 0 0 0
Condition0%0/3
$ttlDst > $ttlSrc and $ttlDst - $ttlSrc > 3
!ll&&!rl&&r
000
MC/DC0%0/2
$ttlDst > $ttlSrc and $ttlDst - $ttlSrc > 3
$ttlDst > $ttlSrc $ttlDst - $ttlSrc > 3
Truth table0%0/3
A and B
A= $ttlDst > $ttlSrcB= $ttlDst - $ttlSrc > 3
ABresult
0X0
100
111
25 0 return $ttl;
26 }
27  
28 0 ▶sub __analyzeIpDfBit {
Subroutine __analyzeIpDfBit: not called CC=2 SCAR=17.9
29 0 my $self = shift;
30 0 my ($p) = @_;
31 0 ▶ return $self->getResponseIpDfBit($p) ? '1' : '0';
Branch: 1 branch
BranchTrueFalseTotal
$self->getResponseIpDfBit($p) ? : 0 0 0
32 }
33  
34 0 ▶sub __analyzeIpIdPassive {
Subroutine __analyzeIpIdPassive: not called CC=2 SCAR=17.9
35 0 my $self = shift;
36 0 my ($p) = @_;
37 0 ▶ return $self->getResponseIpId($p) ? '1' : '0';
Branch: 1 branch
BranchTrueFalseTotal
$self->getResponseIpId($p) ? : 0 0 0
38 }
39  
40 0 ▶sub __analyzeIpId {
Subroutine __analyzeIpId: not called CC=4 SCAR=30.0
41 0 my $self = shift;
42 0 my ($p) = @_;
43 0 my $reqId = $self->getProbeIpId($p);
44 0 my $repId = $self->getResponseIpId($p);
45 0 my $flag = 1;
46 0 ▶ if ($repId == 0) { $flag = 0 }
Branch: 3 branches
BranchTrueFalseTotal
if ($repId == 0) { } 0 0 0
elsif ($repId == $reqId) { } 0 0 0
elsif ($repId == ++$reqId) { } 0 0 0
47 0 elsif ($repId == $reqId) { $flag = 2 }
48 0 elsif ($repId == ++$reqId) { $flag = 3 } # There is no reason for that, but
49 # anyway, we have nothing to loose
50 0 return $flag;
51 }
52  
53 0 ▶sub _analyzeBinary {
Subroutine _analyzeBinary: not called CC=1 SCAR=6.9
54 0 my $self = shift;
55 0 my ($p, $p2) = @_;
56 0 my $flagTtl = $self->__analyzeIpTtl($p, $p2);
57 0 my $flagId = $self->__analyzeIpId($p);
58 0 my $flagDf = $self->__analyzeIpDfBit($p);
59 0 my $flagSeq = $self->_tcp->__analyzeTcpSeq($p);
60 0 my $flagAck = $self->_tcp->__analyzeTcpAck($p);
61 0 return 'B'.$flagTtl.$flagId.$flagDf.$flagSeq.$flagAck;
62 }
63  
64 1 1;
65  
66 __END__
« lib/Net/SinFP3/Result/Unknown.pm ↑ Summary lib/Net/SinFP3/Output/OsOnly.pm »