Skip to content

Instantly share code, notes, and snippets.

@feiskyer
Created February 22, 2022 05:51
Show Gist options
  • Save feiskyer/d444e41602a52501acbf0843c3609f0b to your computer and use it in GitHub Desktop.
Save feiskyer/d444e41602a52501acbf0843c3609f0b to your computer and use it in GitHub Desktop.
ARP Responder (with python)
# sudo apt install -y python3-scapy
from __future__ import print_function
from scapy.all import *
iface = "vxlan42"
vxlan_mac = get_if_hwaddr(iface)
def handle_packet(packet):
if packet[ARP].op == ARP.who_has:
print(packet.summary())
reply = ARP(op=ARP.is_at, hwsrc=vxlan_mac, hwdst=packet.src, psrc=packet.pdst, pdst=packet.psrc)
go = Ether(dst=packet.src, src=vxlan_mac) / reply
sendp(go, iface=iface)
return
sniff(iface=iface, filter="arp",prn=handle_packet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment