开发者

How do I reassemble HTTP packets from Net::Pcap?

I am using the Net::Pcap module to capture packets with this filter:

dst $my_host and dst port 80

Inside the Net::Pcap event loop I use a callback function:

Net::Pcap::pcap_loop($pcap_t, -1, \my_callback, '')

where my_callback look like this:

开发者_Python百科
my_callback {
    my ($user_data, $header, $packet) = @_;
    #   Strip ethernet IP and TCP
    my $ether_data = NetPacket::Ethernet::strip($packet);
    my $ip         = NetPacket::IP->decode($ether_data);
    my $tcp        = NetPacket::TCP->decode($ip->{'data'});
}

How can I assemble the HTTP packets into one packet and extract its header?


try to use Sniffer::HTTP from CPAN

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜