Raw sockets and sendto in python

后端 未结 6 2109
余生分开走
余生分开走 2021-02-05 16:51

I am working on integrating scapy with twisted, but I ran into this very weird bug on OSX that I can\'t seem to figure out.

Basically I am unable to send a valid TCP pac

6条回答
  •  别跟我提以往
    2021-02-05 17:44

    I have no hard evidence, but I think this might be related to the ethernet minimum payload size.

    From wikipedia:

    The minimum payload is 42 octets when 802.1Q tag is present and 46 octets when absent.

    Your first example packet was only 40 bytes, so it'd be below the limit in either case. You could experiment with changing the padding from 20 bytes to those values to verify that it stops working at one of the limits.

    If so, the behavior makes perfect sense; the OS is rejecting the packet because you aren't giving it enough data to construct a valid packet.

提交回复
热议问题