0

Inspired by violent python and some of the scripts in there, I would like to make a http request sniffer to sniff http requests on a network.

In the book violent python there is a tutorial for a section to make a google keg logger (gets what people search on a network)

Any suggested libraries, links to example code etc would be helpful

2
Contributors
2
Replies
22
Views
3 Years
Discussion Span
Last Post by QwertyFish
0

There is a packet sniffer for linux here:

http://www.binarytides.com/python-packet-sniffer-code-linux/

It uses the socket module to grab incoming and outgoing packets. It's pretty low-level stuff. The packet data is raw bytes, so you would have to decode/translate them.

I converted it to Python 3 and put it on my pastebin:

http://welbornprod.com/paste/?id=fgyx

That's about as far as I can go with it right now though. It would be trivial to add some sort of filters to it based on packet type or address. I may do that later if I get bored. Mine uses docopt. It's an excellent argument parser that would make it really easy to add filters like that as command-line arguments.

I would put the code in this comment but it's 216 lines. I will if the mods want me to.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.