module for pcap stream in python
i am trying to filter some headers off my pcap stream using python. is there a particular module to do this. help with开发者_JAVA技巧 any or suggestion would be well appreciated
I have been using python-libpcap http://sourceforge.net/projects/pylibpcap/
If I am not mistaken, it is just a wrapper to the C libpcap. It doesn't feel very Pythonic, but it gets the job done.
Edit: However, this will just let you separate the packets. There isn't much parsing of the headers. I failed to find any sort of good module that did this for me, so I wrote my own script to parse them. Message me if you would like for me to send it to you.
You can try this http://code.google.com/p/dpkt/ it is a pure python library and it supports pcap parsing. As in this example http://mishou.org/2010/04/13/passive-dns-mining-from-pcap-with-dpkt-python/
精彩评论