尝试使用ARP检测我的局域网中的嗅探器

时间:2018-03-16 21:53:29

标签: python wireshark scapy arp sniffing

我尝试检测局域网中的嗅探。当我发送一个arp数据包到FF:FF:FF:FF:FF:FE与嗅探PC的IP,电脑没有收回数据包(thr数据包不会在嗅探电脑的wireshark中,但在wireshark中的apper在发送电脑上。如何使用ARP

检测我的局域网中的嗅探
import sys
i, o, e = sys.stdin, sys.stdout, sys.stderr
from scapy.all import *
sys.stdin, sys.stdout, sys.stderr = i, o, e

def main():

   #create an ARP packet for 192.168.1.25 the sniffing PC
   packet = Ether(dst = 'FF:FF:FF:FF:FF:FE')/ARP(pdst='192.168.1.25',hwdst = 
   'FF:FF:FF:FF:FF:FE')
   while True:
   #sending the packet until we get an answer
     pa = srp1(packet,timeout=1)
     if pa is not None:
     #if there is an answer print the packet and break
        print pa.show()
        break


if __name__ == '__main__':
  main()

1 个答案:

答案 0 :(得分:1)

您不需要在arp数据包中设置hwdst! 此外,scapy还有一个内置方法,promiscping(ip or CIDR block)就是这样做的。