Skip to content

Instantly share code, notes, and snippets.

@cryptolok
Last active October 9, 2017 06:35
Show Gist options
  • Save cryptolok/b9b1ed6e8f91b17d53ef5d3d7d0c17a9 to your computer and use it in GitHub Desktop.
Save cryptolok/b9b1ed6e8f91b17d53ef5d3d7d0c17a9 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