Last active
August 29, 2015 14:04
-
-
Save morgabra/b86c54f69d23f63810d6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scapy.all import * | |
import time | |
import argparse | |
""" | |
tcpdump -XX -e -i bond0 -v arp | |
""" | |
ETH_HWDST = "ff:ff:ff:ff:ff:ff" | |
ETH_HWSRC = "a0:36:9f:2c:ea:30" | |
ARP_HWDST = "ff:ff:ff:ff:ff:ff" | |
ARP_HWSRC = "a0:36:9f:2c:ea:30" | |
ARP_PSRC = "50.57.63.45" | |
ARP_PDST = "50.57.63.45" | |
OP = "who-has" | |
IFACE="bond0.101" | |
WAIT=1 | |
COUNT=100 | |
def send(eth_hwsrc=None, eth_hwdst=None, arp_hwsrc=None, arp_psrc=None, | |
arp_hwdst=None, arp_pdst=None, op=None, iface=None, wait=None): | |
while True: | |
p = (Ether(dst=eth_hwdst, src=eth_hwsrc)/ARP(psrc=arp_psrc,pdst=arp_pdst,op=op,hwsrc=arp_hwsrc,hwdst=arp_hwdst)) | |
print("SEND", p, iface) | |
sendp(p, iface=iface) | |
time.sleep(wait) | |
def main(): | |
parser = argparse.ArgumentParser( | |
description='Send or receive arp packets.') | |
parser.add_argument('--eth_hwdst', default=ETH_HWDST, help='Ethernet MAC DST') | |
parser.add_argument('--eth_hwsrc', default=ETH_HWSRC, help='Ethernet MAC SRC') | |
parser.add_argument('--arp_hwdst', default=ARP_HWDST, help='ARP MAC DST') | |
parser.add_argument('--arp_hwsrc', default=ARP_HWSRC, help='ARP MAC SRC') | |
parser.add_argument('--arp_pdst', default=ARP_PDST, help='ARP IP DST') | |
parser.add_argument('--arp_psrc', default=ARP_PSRC, help='ARP IP SRC') | |
parser.add_argument('--op', default=OP, help='Operation', choices=['is-at', 'who-has']) | |
parser.add_argument('--iface', default=IFACE, help='Interface Name') | |
parser.add_argument('--wait', default=WAIT, help='Seconds between sends') | |
parsed_args = parser.parse_args() | |
args = vars(parsed_args) | |
send(**args) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment