简体   繁体   中英

Receiving Custom Protocol Packets With Scapy and NetFilter Queue

I am doing a project that involves shimming a packet with a custom layer containing some specific fields. I managed to do this using the guide here:

http://www.secdev.org/projects/scapy/doc/build_dissect.html

The guide is great on how to build and send packets with custom layers, but not so much on how to receive them.

I have a packet with the form:

IP()/CustomLayer()/ICMP()

And I am sending this packet to another host that will receive the packet using python's netfilter queue and scapy libraries.

My question is, how do I receive an incoming packet with custom layers in it and still have access to the fields? Trying to parse the packet with

IP(packet)

seems to not be working.. Any help is greatly appreciated!

Have you tried to declare an empty packet first?

pkt = IP()/CustomLayer()/ICMP()

and then

pkt = IP(packet)

Look here and you may find the solution to your problem: Extract Scapy Custom layer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM