How to send an IP packet in Python?

Nobody nobody at nowhere.com
Thu Dec 2 18:32:04 EST 2010


On Thu, 02 Dec 2010 03:12:42 -0800, yegorov-p wrote:

> I have sniffed some packet and now I would like to send it with the
> help of python.

> But for some reason python send that:

> As you can see, python ignores my headers and creates its own.

It isn't Python doing that, but the OS. At least on Unix, you need
setsockopt(IP_HDRINCL) to tell the OS that the packet includes a header.
It appears that Windows supports the same option:

http://msdn.microsoft.com/en-us/library/ms738586%28v=VS.85%29.aspx





More information about the Python-list mailing list