Subject: | Invalid magick numbers and timestamp conversion |
Date: | Tue, 5 Dec 2017 06:32:53 +0300 |
To: | bug-File-PCAP [...] rt.cpan.org |
From: | Konstantin Tokar <konstantin [...] tokar.ru> |
A pcap file with a magic number of 0xa1b23c4d or 0x4d3cb2a1 is a pcap file
in which the packet time stamps are in seconds and nanoseconds.
A pcap file with a magic number of 0xa1b2c3d4 or 0xd4c3b2a1 is a "regular"
pcap file in which the packet time stamps are in seconds and microseconds.
0xa1b23c4d == 2712812621
0x4d3cb2a1 == 1295823521
0xa1b2c3d4 == 2712847316
0xd4c3b2a1 == 3569595041
sub _read_pcap_global_header {
my ($self) = @_;
my $fh = $self->{fh};
my ($magic,$vmajor,$vminor,$tzone,$sigfigs,$snaplen,$dlt) =
unpack("LSSlLLL",<$fh>);
if (2712847316 == $magic || 2712812621 == $magic) {
Best regards
Konstantin Tokar