ylliX - Online Advertising Network
Vertex AI - Antrophic and Mistral models: Why does it require Imegen access?

Scapy: How to get an Ether frame in bytes


I am capturing a single package using scapy:

from scapy.all import *

while True:
    data = sniff(iface="lo", count = 1)

Then I try to convert the resulting object into bytes:

print(raw(data))

And I’m getting an error:
TypeError: ‘Ether’ object cannot be interpreted as an integer

I need to capture a packet and store it in a variable as bytes.

I tried it this way:

from scapy.all import *

while True:
    data = sniff(iface="lo", count = 1)
    print(raw(data))

and this:

from scapy.all import *

while True:
    data = sniff(iface="lo", count = 1,  prn = lambda x: raw(x))
    print(data)



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *