0

i m writing a code for port scanner so i need to send a raw packet. i searched and found out that using dpkt library would be better but i didnt find any documentation that would help. So please anyone could help may explaining how to create a packet with customized TCP header i.e set the flags of tcp header as required.

Thank You

AJINKYA
  • 741
  • 2
  • 9
  • 20
  • you mean raw socket ??, check this answer: http://stackoverflow.com/questions/1117958/how-do-i-use-raw-socket-in-python – mouad Oct 27 '10 at 13:56

1 Answers1

1

Well, this is a bit old but I'll answer anyway since I've been looking to do the same. The dpkt documentation is basically non-existant. The only thing they give you is some samples and Jon Oberheide, the co-developer, wrote some tutorials for it. So if you want to use dpkt it isn't difficult you can figure it out from one of these tutorials:

If you want an easier API, I've used both of these:

  1. The same guy that wrote dpkt wrote libdnet, which is used by the beastly security scanner Nmap and has python wrappings: http://libdnet.sourceforge.net/. It's got some pretty basic TCP and IP creation functions but the documentation is much better.

  2. Or use this python wrapper for libnet, http://pylibnet.sourceforge.net/. This is very robust and the documentation is great but I couldn't get injection working on OS X. Also every release so far is still beta.

Caleb Hearon
  • 256
  • 4
  • 14