Added some code to avoid the generation of pcap files starting directly with a
payload
This commit is contained in:
parent
0becce7f00
commit
14e06a0f42
|
@ -47,6 +47,7 @@ my $network = 230; # 802.15.4 no FCS
|
|||
|
||||
my $newpacket = 0;
|
||||
my $len = 0;
|
||||
my $file_empty = 1;
|
||||
|
||||
print pack('LSSLLLL',($magic,$major,$minor,$zone,$sig,$snaplen,$network));
|
||||
|
||||
|
@ -75,9 +76,13 @@ while(1) {
|
|||
$newpacket = 0;
|
||||
print pack('LLLL',($sec,$usec,$len,$len));
|
||||
print STDERR "new packet: $sec $usec $len " . ($len) . "\n\r";
|
||||
# This header starts the file
|
||||
if ($file_empty == 1) {
|
||||
$file_empty = 0;
|
||||
}
|
||||
|
||||
# packet payload
|
||||
}
|
||||
# packet payload (don't start the file with a payload)
|
||||
if ($file_empty == 0) {
|
||||
print STDERR "dataline: ";
|
||||
print STDERR $str . "\n\r";
|
||||
|
||||
|
@ -85,6 +90,8 @@ while(1) {
|
|||
print pack ('C',hex($data));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$str = '';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue