Skip to content

Commit

Permalink
- (bluefox) Corrected the BigEndian PCAP format
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Sep 20, 2024
1 parent 390a55b commit 435557d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/recording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function analyzePacket(context: Context): boolean {
const ifindex = packetBuffer.readUInt32BE(16);
const protocol = packetBuffer.readUInt16BE(20);
packetBuffer.writeUInt32LE(ifindex, 16);
packetBuffer.writeUInt32LE(protocol, 20);
packetBuffer.writeUInt16LE(protocol, 20);
}
context.packets.push(packetBuffer);
context.totalBytes += headerLength + packageLen;
Expand All @@ -150,7 +150,7 @@ function analyzePacket(context: Context): boolean {
const ifindex = packetBuffer.readUInt32BE(16);
const protocol = packetBuffer.readUInt16BE(20);
packetBuffer.writeUInt32LE(ifindex, 16);
packetBuffer.writeUInt32LE(protocol, 20);
packetBuffer.writeUInt16LE(protocol, 20);
}
// save new length in the packet
packetBuffer.writeUInt32LE(maxBytes, 8);
Expand Down

0 comments on commit 435557d

Please sign in to comment.