Using a sniffed packet with scapy python

1.7k views Asked by At

Im not so new to network programming but new to working with scapy (I mainly work on c++).

So, im sniffing packets (traffic) that are coming into my computer and what I want to do is just to save one of the packets into a variable and use it later in my program. It doesnt need to be any specific packet it can be a random packet. The only thing I want is just to insert it into a variable and use it later on.

Could someone please help me with this?

1

There are 1 answers

0
Manoj Pandey On

The sniff() function returns the sniffed packet. You can pass various arguments to this function. You can take the output and save it in a variable. Please see these two links: (a) www.secdev.org/projects/scapy/files/scapydoc.pdf and (b) and Scapy filtering with sniff() function