-
-
Save samsayen/ae567f03a7c87c0062a2933f0ca4403d to your computer and use it in GitHub Desktop.
redirect to proxy
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/sh | |
# 2016 | |
echo "Loading Firewall ..." | |
#################### | |
# Disable IPv6 # | |
#################### | |
adb shell "echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6" | |
adb shell "echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6" | |
adb shell "echo 1 > /proc/sys/net/ipv6/conf/wlan0/disable_ipv6" | |
#################### | |
# Purge/Flush # | |
#################### | |
# Clear all rules | |
adb shell "iptables -F" | |
adb shell "iptables -t nat -F" | |
adb shell "iptables -t mangle -F" | |
adb shell "ip6tables -F" | |
adb shell "ip6tables -t nat -F" | |
adb shell "ip6tables -t mangle -F" | |
# Clear all chains | |
adb shell "iptables -X" | |
adb shell "iptables -t nat -X" | |
adb shell "iptables -t mangle -X" | |
adb shell "ip6tables -X" | |
adb shell "ip6tables -t nat -X" | |
adb shell "ip6tables -t mangle -X" | |
#################### | |
# Defaults # | |
#################### | |
# IPv4 connections | |
adb shell "iptables -P INPUT ACCEPT" | |
adb shell "iptables -P FORWARD ACCEPT" | |
adb shell "iptables -P OUTPUT ACCEPT" | |
# IPv6 connections | |
adb shell "ip6tables -P INPUT DROP" | |
adb shell "ip6tables -P FORWARD DROP" | |
adb shell "ip6tables -P OUTPUT DROP" | |
##################### | |
# Redirect Traffic # | |
##################### | |
# Redirect HTTP traffic to Burp | |
adb shell "iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination 192.168.1.100:8080" | |
# Redirect HTTPS traffic to Burp | |
adb shell "iptables -t nat -A OUTPUT -p tcp --dport 443 -j DNAT --to-destination 192.168.1.100:8080" | |
# Activate Masquerading | |
adb shell "iptables -t nat -A POSTROUTING -p tcp --dport 80 -j MASQUERADE" | |
adb shell "iptables -t nat -A POSTROUTING -p tcp --dport 443 -j MASQUERADE" | |
# Disable netd / Force DNS over Router | |
adb shell "iptables -t nat -I OUTPUT -p tcp --dport 53 -j DNAT --to-destination 192.168.1.1:53" | |
adb shell "iptables -t nat -I OUTPUT -p udp --dport 53 -j DNAT --to-destination 192.168.1.1:53" | |
echo "Yo!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment