Created
May 3, 2022 17:17
-
-
Save DenBond7/80f5d9ec75ba258038ade0cd81400fce to your computer and use it in GitHub Desktop.
redirect_trafic_for_emulators.sh
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
#!/usr/bin/env bash | |
for device in `adb devices | awk '{print $1}'`; do | |
if [ ! "$device" = "" ] && [ ! "$device" = "List" ] | |
then | |
echo " " | |
echo "adb -s $device" | |
echo "------------------------------------------------------" | |
adb -s $device root | |
echo "adb -s $device root" | |
adb -s $device shell "echo 1 > /proc/sys/net/ipv4/ip_forward" | |
echo "adb -s $device shell 'echo 1 > /proc/sys/net/ipv4/ip_forward'" | |
adb -s $device shell "iptables -t nat -A PREROUTING -s 127.0.0.1 -p tcp --dport 443 -j REDIRECT --to 1212" | |
echo "adb -s $device shell 'iptables -t nat -A PREROUTING -s 127.0.0.1 -p tcp --dport 443 -j REDIRECT --to 1212'" | |
adb -s $device shell "iptables -t nat -A OUTPUT -s 127.0.0.1 -p tcp --dport 443 -j REDIRECT --to 1212" | |
echo "adb -s $device shell 'iptables -t nat -A OUTPUT -s 127.0.0.1 -p tcp --dport 443 -j REDIRECT --to 1212'" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment