24 lines
654 B
Python
Executable File
24 lines
654 B
Python
Executable File
#!/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="arp"
|
|
|
|
sniff(filter=filterstr,prn=pack_callback, iface='eth0', count=0)
|