Created
April 21, 2018 04:11
-
-
Save f0r34chb3t4/11728b7a632edd4c5cb227191f3538b5 to your computer and use it in GitHub Desktop.
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 | |
# Create new chain | |
iptables -t nat -N REDSOCKS | |
# Ignore LANs and some other reserved addresses. | |
iptables -t nat -A REDSOCKS -d 0.0.0.0/8 -j RETURN | |
iptables -t nat -A REDSOCKS -d 10.0.0.0/8 -j RETURN | |
iptables -t nat -A REDSOCKS -d 127.0.0.0/8 -j RETURN | |
iptables -t nat -A REDSOCKS -d 169.254.0.0/16 -j RETURN | |
iptables -t nat -A REDSOCKS -d 172.16.0.0/12 -j RETURN | |
iptables -t nat -A REDSOCKS -d 192.168.0.0/16 -j RETURN | |
iptables -t nat -A REDSOCKS -d 224.0.0.0/4 -j RETURN | |
iptables -t nat -A REDSOCKS -d 240.0.0.0/4 -j RETURN | |
# Anything else should be redirected to port 12345 | |
iptables -t nat -A REDSOCKS -p tcp -j REDIRECT --to-ports 12345 | |
# Any tcp connection made by `mariozanx' should be redirected, put your username here. | |
iptables -t nat -A OUTPUT -p tcp -m owner --uid-owner mariozanx -j REDSOCKS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment