Last active
March 12, 2016 21:02
-
-
Save daktak/fcd43cf0e8806bab7581 to your computer and use it in GitHub Desktop.
Transparent Proxy mangle for NetGear router
This file contains hidden or 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/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