0

Say I want scapy to be a server to receive packet, like:

>> p=r("host:port") // waiting for a package

Is it possible?

1 Answer 1

1

If you really want to bind a socket, you'll have to use the socket module from Python. You can do so from Scapy and use it to dissect the captured packet.

By doing so however, you'll behave as a regular application and hence will only get the "application" layer (and not the network layers IP and TCP or UDP.

Now if you want to capture one packet from the network on a specific port, you can do so in "pure" Scapy, with the sniff() function and a simple BPF filter:

p = sniff(filter="port 53", count=1)[0]

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.