Advertisement
Guest User

ARP spoof detector

a guest
Aug 19th, 2010
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.69 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. # Written by kenkeiras
  3.  
  4. mip=""
  5. t=0
  6. for a in $(arp -a|sed -e "s/ /_/g" ); do
  7.         ip=`echo $a|cut "-d_" -f2|cut -d\( -f2|cut -d\) -f1`
  8.         mac=`echo $a|cut "-d_"  -f4`
  9.         if [ ${mac,0,1}"" != "<" ]
  10.             then
  11.                 # echo "IP: $ip MAC: $mac"
  12.                 t=$(($t + 1))
  13.                 i=0
  14.                 lip=""
  15.                 for tmp in $mip ; do
  16.                     if [ `echo $tmp|cut -d_ -f2` == "$mac" ]
  17.                         then
  18.                             echo "MAC duplicada $ip - "`echo $tmp|cut -d_ -f1`" [$mac]"
  19.                         fi
  20.                 done
  21.                 mip="$mip $ip"_"$mac"
  22.             fi
  23.     done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement