26 lines
671 B
Python
26 lines
671 B
Python
|
#!/usr/bin/env python3
|
||
|
# -*- coding: UTF-8 -*-
|
||
|
from scapy.all import *
|
||
|
|
||
|
def pack_callback(packet):
|
||
|
print ("---------------- packet -----------------")
|
||
|
print ( packet.show() )
|
||
|
print ("-----------------------------------------")
|
||
|
'''
|
||
|
if packet['Ether'].payload:
|
||
|
print (packet['Ether'].src)
|
||
|
print (packet['Ether'].dst)
|
||
|
print (packet['Ether'].type)
|
||
|
|
||
|
if packet['ARP'].payload:
|
||
|
print (packet['ARP'].psrc)
|
||
|
print (packet['ARP'].pdst)
|
||
|
print (packet['ARP'].hwsrc)
|
||
|
print (packet['ARP'].hwdst)
|
||
|
'''
|
||
|
time.sleep(2)
|
||
|
|
||
|
filterstr="vlan"
|
||
|
|
||
|
sniff(filter=filterstr,prn=pack_callback, iface='eth0', count=0)
|