Skip to content

Instantly share code, notes, and snippets.

@adde88
Forked from cryptolok/ARProtect
Created July 23, 2017 09:12
Show Gist options
  • Save adde88/69689d9025e1cd36d6e7a61df9c85189 to your computer and use it in GitHub Desktop.
Save adde88/69689d9025e1cd36d6e7a61df9c85189 to your computer and use it in GitHub Desktop.
ultimate, simple and minimalistic UNIX ARP-MITM protection
#!/bin/bash
# ultimate, simple and minimalistic UNIX ARP-MITM protection by making gateway hardware address static just after DHCP and automatically after interface start
# place in /etc/network/if-up.d/ARProtect
if [[ "$IFACE" != "lo" && "$MODE" = "start" && "$ADDRFAM" = *[N,n]et* ]]
then
IP_GATEWAY=$(ip route | grep default | grep $IFACE | cut -d ' ' -f 3)
MAC=$(ip neigh show $IP_GATEWAY | cut -d ' ' -f 5)
arp -s $IP_GATEWAY $MAC
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment