line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyEvent::Pcap::Utils; |
2
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
107
|
|
3
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
87
|
|
4
|
3
|
|
|
3
|
|
2723
|
use NetPacket::Ethernet; |
|
3
|
|
|
|
|
4392
|
|
|
3
|
|
|
|
|
157
|
|
5
|
3
|
|
|
3
|
|
2452
|
use NetPacket::IP; |
|
3
|
|
|
|
|
8087
|
|
|
3
|
|
|
|
|
134
|
|
6
|
3
|
|
|
3
|
|
2578
|
use NetPacket::TCP; |
|
3
|
|
|
|
|
4749
|
|
|
3
|
|
|
|
|
788
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
10
|
0
|
|
|
|
|
|
my $self = bless {@_}, $class; |
11
|
0
|
|
|
|
|
|
return $self; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub extract_ip_packet { |
15
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
16
|
0
|
|
|
|
|
|
my $raw_packet = shift; |
17
|
0
|
|
|
|
|
|
my $raw_ip = NetPacket::Ethernet->decode($raw_packet)->{data}; |
18
|
0
|
|
|
|
|
|
my $ip = NetPacket::IP->decode($raw_ip); |
19
|
0
|
|
|
|
|
|
return $ip; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub extract_tcp_packet { |
23
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
24
|
0
|
|
|
|
|
|
my $raw_packet = shift; |
25
|
0
|
|
|
|
|
|
my $raw_ip = NetPacket::Ethernet->decode($raw_packet)->{data}; |
26
|
0
|
|
|
|
|
|
my $ip = NetPacket::IP->decode($raw_ip); |
27
|
0
|
|
|
|
|
|
my $raw_tcp = substr( $ip->{data}, 0, $ip->{len} - ( $ip->{hlen} * 4 ) ); |
28
|
0
|
|
|
|
|
|
my $tcp = NetPacket::TCP->decode($raw_tcp); |
29
|
0
|
|
|
|
|
|
return $tcp; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
__END__ |