Skip to content

Instantly share code, notes, and snippets.

@albertoalcolea
Created July 29, 2013 20:24
Show Gist options
  • Save albertoalcolea/6107478 to your computer and use it in GitHub Desktop.
Save albertoalcolea/6107478 to your computer and use it in GitHub Desktop.
ARP Spoofing Detector
#!/bin/bash
#
# Version: 1.0
# Date: 24-07-2013
# Author: Alberto Alcolea (contact@albertoalcolea.com)
#
PRIORITY="local0.alert"
icon="/home/alberto/.icons/elementary/actions/48/process-stop.svg"
prev=''
arp | while read ip hwtype mac flag iface
do
if [ ! $mac == 'HWaddress' ]
then
for a in $prev
do
if [ $(echo $a | cut -d'_' -f2) == $mac ]
then
ip2=$(echo $a | cut -d'_' -f1)
# echo "MAC duplicada: $ip - $ip2 [$mac]"
logger -p $PRIORITY "MAC duplicada: $ip - $ip2 [$mac]" > /dev/null 2> /dev/null
service network-manager stop
notify-send 'Detectado envenenamiento de tablas ARP' "$ip - $ip2\n[$mac]" -i $icon -u critical
fi
done
prev="$prev $ip"_"$mac"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment