Skip to content

Instantly share code, notes, and snippets.

@daktak
Last active March 12, 2016 21:02
Show Gist options
  • Save daktak/fcd43cf0e8806bab7581 to your computer and use it in GitHub Desktop.
Save daktak/fcd43cf0e8806bab7581 to your computer and use it in GitHub Desktop.
Transparent Proxy mangle for NetGear router
#!/usr/bin/expect
set timeout 20
set hostName [lindex $argv 0]
set userName [lindex $argv 1]
set password [lindex $argv 2]
spawn telnet $hostName
expect "DGN2200v3 login: "
send "$userName\r"
expect "Password:"
send "$password\r";
expect "#"
send "iptables -t mangle -A PREROUTING -p tcp --dport 80 -s 192.168.1.10 -j ACCEPT\r";
expect "#"
send "iptables -t mangle -A PREROUTING -p tcp --dport 80 -j MARK --set-mark 3\r";
expect "#"
send "ip rule add fwmark 3 table 2\r";
expect "#";
send "ip route add default via 192.168.1.10 dev group1 table 2\r";
expect "#";
send "exit";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment