ultimate, simple and minimalistic UNIX ARP-MITM protection by making gateway hardware address static just after DHCP and automatically after interface start

July 18, 2017 · View on GitHub

#!/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∗]]thenIPGATEWAY=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