Skip to content

Instantly share code, notes, and snippets.

@KCCat
Last active March 3, 2019 11:36
Show Gist options
  • Save KCCat/543043f9b1d82d4ae5dc00c849c8ff71 to your computer and use it in GitHub Desktop.
Save KCCat/543043f9b1d82d4ae5dc00c849c8ff71 to your computer and use it in GitHub Desktop.
iptables -t mangle -A POSTROUTING -o ppp+ -p tcp -m string --algo bm --from 40 --to 69 --hex-string 'GET ' -j CONNMARK --set-mark 1/1
iptables -t mangle -A POSTROUTING -o ppp+ -p tcp -m string --algo bm --from 40 --to 69 --hex-string 'POST ' -j CONNMARK --set-mark 1/1
iptables -t filter -A INPUT -i ppp+ -p tcp -m connmark --mark 1/1 -m string --algo bm --from 40 --to 69 --hex-string 'HTTP/1.1 302 ' -j DPI
iptables -t filter -A FORWARD -i ppp+ -p tcp -m connmark --mark 1/1 -m string --algo bm --from 40 --to 69 --hex-string 'HTTP/1.1 302 ' -j DPI
iptables -t filter -N DPI
iptables -t filter -A DPI -j LOG --log-level info --log-prefix 'DPI 302: ' --log-tcp-options --log-ip-options
iptables -t filter -A DPI -j CONNMARK --set-mark 0/1
iptables -t filter -A DPI -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment