Created
July 15, 2014 01:15
-
-
Save kjseefried/9a3d0d0dd7428777f9e3 to your computer and use it in GitHub Desktop.
Example of using scapy+gobject to sniff packets.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gobject | |
from scapy.all import * | |
loop = gobject.MainLoop() | |
ethernet1 = conf.L2listen(type=ETH_P_ALL, iface='eth0') | |
def ethernet1_handler(packet): | |
return packet.summary() | |
def doTheSniff(source, condition): | |
print "Worked" | |
return sniff(prn=ethernet1_handler, store=0, count=1) | |
gobject.io_add_watch(ethernet1, gobject.IO_IN, doTheSniff or True) | |
loop.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment