Package matching behavior in scapy

Background:

I use scapy for testing network device that can selectively bypass the feedback packets, replacing the MAC-address of the source / annihilation, IP-address and the level number 4. swap ports can be selected for layer_2_only, layers_2_and_3, layers_2_3_and_4. I run scapy on the server, transferring packets to the device and checking that the packets sent back have the corresponding source / dest fields, replaced depending on the configuration.

Problem:

The scapy method srploop(), which sends packets and accepts matches, is well suited for message types such as PING and ARP. I find that if I transmit a UDP packet and the source / dest ports are not canceled by the feedback device, then scapy will not treat the feedback packet as a match. When port numbers are inverted by the reverse device, packets are detected as matches.

Questions:

  • Is there a way to override or otherwise affect the scapy packet matching logic? For example, it would be useful to disable the mapping at level 4. I looked at the documentation and did not come across anything that suggests that this is possible.

  • Is there any other way to achieve this in scapy. I experimented with using send()and then sniff(), but I was not able to capture the answers using this method.

+5
1

, Scapy .

, , , send(). , ( ).

, - , . , .

UPDATE. (. , ).

, !

+1

All Articles