line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: IPv4.pm 2234 2014-04-08 13:05:14Z gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::SinFP3::Ext::IP::IPv4; |
5
|
1
|
|
|
1
|
|
459
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use base qw(Net::SinFP3::Ext::IP); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
177
|
|
9
|
|
|
|
|
|
|
our @AS = qw( |
10
|
|
|
|
|
|
|
global |
11
|
|
|
|
|
|
|
next |
12
|
|
|
|
|
|
|
_ipid |
13
|
|
|
|
|
|
|
_tcp |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
16
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
650
|
use Net::Frame::Layer qw(:subs); |
|
1
|
|
|
|
|
136079
|
|
|
1
|
|
|
|
|
325
|
|
19
|
1
|
|
|
1
|
|
815
|
use Net::Frame::Layer::ETH qw(:consts); |
|
1
|
|
|
|
|
3461
|
|
|
1
|
|
|
|
|
307
|
|
20
|
1
|
|
|
1
|
|
759
|
use Net::Frame::Layer::IPv4 qw(:consts); |
|
1
|
|
|
|
|
6508
|
|
|
1
|
|
|
|
|
359
|
|
21
|
1
|
|
|
1
|
|
791
|
use Net::Frame::Layer::TCP qw(:consts); |
|
1
|
|
|
|
|
3002
|
|
|
1
|
|
|
|
|
812
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
0
|
|
|
0
|
1
|
|
my $self = shift->SUPER::new( |
25
|
|
|
|
|
|
|
@_, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $ipid = $self->_getInitial16bits; |
29
|
0
|
|
|
|
|
|
$self->_ipid($ipid); |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
return $self; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _getInitial16bits { |
35
|
0
|
|
|
0
|
|
|
my $self = shift; |
36
|
0
|
|
|
|
|
|
my $i16 = getRandom16bitsInt(); |
37
|
0
|
0
|
|
|
|
|
$i16 += 666 unless $i16 > 0; |
38
|
0
|
|
|
|
|
|
return $i16; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub getResponseIpTtl { |
42
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
43
|
0
|
|
|
|
|
|
my ($response) = @_; |
44
|
0
|
|
|
|
|
|
return $response->reply->ref->{IPv4}->ttl; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub getResponseIpId { |
48
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
49
|
0
|
|
|
|
|
|
my ($response) = @_; |
50
|
0
|
|
|
|
|
|
return $response->reply->ref->{IPv4}->id; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub getResponseIpDfBit { |
54
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
55
|
0
|
|
|
|
|
|
my ($response) = @_; |
56
|
0
|
|
|
|
|
|
return $response->reply->ref->{IPv4}->flags & NF_IPv4_DONT_FRAGMENT; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub getProbeIpId { |
60
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
61
|
0
|
|
|
|
|
|
my ($response) = @_; |
62
|
0
|
|
|
|
|
|
return $response->ref->{IPv4}->id; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _getIpv4Header { |
66
|
0
|
|
|
0
|
|
|
my $self = shift; |
67
|
0
|
|
|
|
|
|
my ($id) = @_; |
68
|
0
|
|
|
|
|
|
return Net::Frame::Layer::IPv4->new( |
69
|
|
|
|
|
|
|
tos => 0, |
70
|
|
|
|
|
|
|
id => $id, |
71
|
|
|
|
|
|
|
flags => 0, |
72
|
|
|
|
|
|
|
offset => 0, |
73
|
|
|
|
|
|
|
ttl => 255, |
74
|
|
|
|
|
|
|
protocol => NF_IPv4_PROTOCOL_TCP, |
75
|
|
|
|
|
|
|
src => $self->global->ip, |
76
|
|
|
|
|
|
|
dst => $self->next->ip, |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub getP1 { |
81
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
82
|
0
|
|
|
|
|
|
my $ip4 = $self->_getIpv4Header($self->_ipid); |
83
|
0
|
|
|
|
|
|
my $tcp = $self->_tcp->_getP1Tcp; |
84
|
0
|
|
|
|
|
|
return Net::Frame::Simple->new(layers => [ $ip4, $tcp, ]); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub getP2 { |
88
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
89
|
0
|
|
|
|
|
|
my $ip4 = $self->_getIpv4Header($self->_ipid + 1); |
90
|
0
|
|
|
|
|
|
my $tcp = $self->_tcp->_getP2Tcp; |
91
|
0
|
|
|
|
|
|
return Net::Frame::Simple->new(layers => [ $ip4, $tcp, ]); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub getP3 { |
95
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
96
|
0
|
|
|
|
|
|
my $ip4 = $self->_getIpv4Header($self->_ipid + 2); |
97
|
0
|
|
|
|
|
|
my $tcp = $self->_tcp->_getP3Tcp; |
98
|
0
|
|
|
|
|
|
return Net::Frame::Simple->new(layers => [ $ip4, $tcp, ]); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
__END__ |