11602Srgrimes#!/usr/local/bin/python3
21602Srgrimes# send Gratuitous Address Resolution Protocol Reply
31602Srgrimes# expect no answer
41602Srgrimes# RFC 2002  IP Mobility Support
51602Srgrimes# 4.6. ARP, Proxy ARP, and Gratuitous ARP
61602Srgrimes
71602Srgrimesimport os
81602Srgrimesfrom addr import *
91602Srgrimesfrom scapy.all import *
101602Srgrimes
111602Srgrimesarp=ARP(op='is-at', hwsrc=LOCAL_MAC, psrc=REMOTE_ADDR,
121602Srgrimes    hwdst=LOCAL_MAC, pdst=REMOTE_ADDR)
131602Srgrimeseth=Ether(src=LOCAL_MAC, dst="ff:ff:ff:ff:ff:ff")/arp
141602Srgrimes
151602Srgrimese=srp1(eth, iface=LOCAL_IF, timeout=2)
161602Srgrimes
171602Srgrimesif e and e.type == ETH_P_ARP:
181602Srgrimes	a=e.payload
191602Srgrimes	a.show()
201602Srgrimes	print("ARP REPLY")
211602Srgrimes	exit(1)
221602Srgrimes
231602Srgrimesprint("no arp reply")
241602Srgrimesexit(0)
251602Srgrimes