scapy icon indicating copy to clipboard operation
scapy copied to clipboard

Adds capability to store `pkt_list` for each session packet

Open piersoh opened this issue 5 years ago • 3 comments

This PR adds a capability to store pkt_list for each session packet which controlled via the store parameter to sniff(). When Scapy is run in session mode it parses the provided pcap/packetlist into "session" packets which have len=None. This PR allows for the storage of the original packets that make up the "session" packets in an attached PacketList as a class variable pkt_list. It is something I have found useful when parsing TCP/HTTP flows.

It was done fairly quickly so happy to be advised on how best to update/modify for better compliance. e.g. I wasn't sure if one should add a field to the Packet type for this or somewhere else?

piersoh avatar Jan 15 '21 16:01 piersoh

Could you explain what's the use case for this, and add a test that uses it? I also don't see how some parts work.

gpotter2 avatar Jan 16 '21 14:01 gpotter2

Codecov Report

Merging #3058 (a8cc88b) into master (2da3800) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #3058   +/-   ##
=======================================
  Coverage   52.38%   52.38%           
=======================================
  Files           9        9           
  Lines        1365     1365           
=======================================
  Hits          715      715           
  Misses        650      650           

codecov[bot] avatar Jun 16 '21 16:06 codecov[bot]

I've updated the code to be PEP8 compliant. The self.store is just using the existing store variable/property to activate the pkt_list functionality. As I mentioned I can document this feature if the implementation is agreeable - if not maybe you could suggest a better place/way to store the packet list.

piersoh avatar Jun 16 '21 17:06 piersoh

Sessions have been changed a lot so this PR is obsolete. Closing.

gpotter2 avatar Feb 04 '24 22:02 gpotter2