line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id: IPv4.pm,v 451c3602d7b2 2015/11/25 06:13:53 gomor $ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
package Net::SinFP3::Ext::IP::IPv4; |
5
|
1
|
|
|
1
|
|
613
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use base qw(Net::SinFP3::Ext::IP); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
112
|
|
9
|
|
|
|
|
|
|
our @AS = qw( |
10
|
|
|
|
|
|
|
global |
11
|
|
|
|
|
|
|
next |
12
|
|
|
|
|
|
|
_ipid |
13
|
|
|
|
|
|
|
_tcp |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
16
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
844
|
use Net::Frame::Layer qw(:subs); |
|
1
|
|
|
|
|
79574
|
|
|
1
|
|
|
|
|
251
|
|
19
|
1
|
|
|
1
|
|
907
|
use Net::Frame::Layer::ETH qw(:consts); |
|
1
|
|
|
|
|
2809
|
|
|
1
|
|
|
|
|
249
|
|
20
|
1
|
|
|
1
|
|
873
|
use Net::Frame::Layer::IPv4 qw(:consts); |
|
1
|
|
|
|
|
5632
|
|
|
1
|
|
|
|
|
263
|
|
21
|
1
|
|
|
1
|
|
840
|
use Net::Frame::Layer::TCP qw(:consts); |
|
1
|
|
|
|
|
2882
|
|
|
1
|
|
|
|
|
905
|
|
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__ |