3

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!

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.