Skip to content

Commit

Permalink
pcapng enhancements (idb,epb) and some fixes (#4342)
Browse files Browse the repository at this point in the history
* pcapng enhancements (idb,epb) and some fixes
Based on draft-ietf-opsawg-pcapng-latest, 5 March 2024.
   -map packet.sniffed_on to unique IDB id. When writing, if_name option and linktype is populated based on the first packet seen with a unique sniffed_on string.
   -map packet.direction to EPB flags inbound/outbound direction bits. Remaining flag bits not implemented.
   -simplified RawPcapNgReader._read_options() and moved (code,value) treatment to the caller since codes of same type can have different meaning for different type of blocks.
   -Fix RawPcapNgReader._read_block_shb() and _write_block_shb().

---------

Co-authored-by: Guillaume Valadon <guillaume@valadon.net>
  • Loading branch information
jcpvdm and guedou committed Apr 27, 2024
1 parent 98257f3 commit 56b4fa4
Show file tree
Hide file tree
Showing 3 changed files with 233 additions and 62 deletions.
4 changes: 4 additions & 0 deletions scapy/packet.py
Expand Up @@ -430,6 +430,8 @@ def copy(self) -> Self:
clone.payload.add_underlayer(clone)
clone.time = self.time
clone.comment = self.comment
clone.direction = self.direction
clone.sniffed_on = self.sniffed_on
return clone

def _resolve_alias(self, attr):
Expand Down Expand Up @@ -1140,6 +1142,8 @@ def clone_with(self, payload=None, **kargs):
)
pkt.wirelen = self.wirelen
pkt.comment = self.comment
pkt.sniffed_on = self.sniffed_on
pkt.direction = self.direction
if payload is not None:
pkt.add_payload(payload)
return pkt
Expand Down

0 comments on commit 56b4fa4

Please sign in to comment.