Skip Menu |
 

This queue is for tickets about the File-PCAP CPAN distribution.

Report information
The Basics
Id: 123819
Status: open
Priority: 0/
Queue: File-PCAP

People
Owner: mamawe [...] cpan.org
Requestors: Konstantin [...] Tokar.RU
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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>
Download (untitled) / with headers
text/plain 648b
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
Download (untitled) / with headers
text/plain 1013b
Hi Konstantin, I don't see what's your point here. On Mon Dec 04 22:33:28 2017, Konstantin@Tokar.RU wrote: Show quoted text
> 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.
I chose to allow only the two magic numbers with identical byte ordering since I don't have access to a file with swapped byte ordering and didn't want to add code that I could not test. Show quoted text
> > 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
Kind regards, Mathias


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.