arp_gratuitous.py revision 1.1.1.1
1#!/usr/local/bin/python2.7
2# send Gratuitous Address Resolution Protocol Reply
3# expect no answer
4# RFC 2002  IP Mobility Support
5# 4.6. ARP, Proxy ARP, and Gratuitous ARP
6
7import os
8from addr import *
9from scapy.all import *
10
11arp=ARP(op='is-at', hwsrc=LOCAL_MAC, psrc=REMOTE_ADDR,
12    hwdst=LOCAL_MAC, pdst=REMOTE_ADDR)
13eth=Ether(src=LOCAL_MAC, dst="ff:ff:ff:ff:ff:ff")/arp
14
15e=srp1(eth, iface=LOCAL_IF, timeout=2)
16
17if e and e.type == ETH_P_ARP:
18	a=e.payload
19	a.show()
20	print "ARP REPLY"
21	exit(1)
22
23print "no arp reply"
24exit(0)
25