ddwrtping

ddwrtping Commit Details


Date:2014-05-29 21:11:28 (10 years 6 months ago)
Author:Natalie Adams
Branch:master
Commit:cab96801c1ec9b7dc7b851b32be1ea7861ac6572
Message:adding scripts

Changes:

File differences

disableping.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/python
import pexpect
import sys
pobj = pexpect.spawn("ssh root@192.168.128.1")
pobj.expect(".*password:.*")
pobj.sendline(strpass)
pobj.expect(".*#.*")
pobj.sendline('nvram set rc_firewall="insmod ipt_mark')
pobj.sendline('insmod xt_mark')
pobj.sendline('iptables -t mangle -A PREROUTING -i ! `get_wanface` -d `nvram get wan_ipaddr` -j MARK --set-mark 0xd001')
pobj.sendline('iptables -t nat -A POSTROUTING -m mark --mark 0xd001 -j MASQUERADE')
pobj.sendline('iptables -A INPUT -p icmp --icmp-type 8 -j DROP"')
pobj.expect(".*#.*")
pobj.sendline("nvram commit")
pobj.expect(".*#.*")
pobj.sendline("startservice firewall")
pobj.expect(".*#.*")
pobj.close()
enableping.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/python
import pexpect
import sys
pobj = pexpect.spawn("ssh root@192.168.128.1")
#pobj.logfile = open("enlog.txt", "a+")
pobj.expect(".*password:.*")
pobj.sendline(strpass)
pobj.expect(".*#.*")
pobj.sendline('nvram set rc_firewall="insmod ipt_mark')
pobj.sendline('insmod xt_mark')
pobj.sendline('iptables -t mangle -A PREROUTING -i ! `get_wanface` -d `nvram get wan_ipaddr` -j MARK --set-mark 0xd001')
pobj.sendline('iptables -t nat -A POSTROUTING -m mark --mark 0xd001 -j MASQUERADE"')
pobj.expect(".*#.*")
pobj.sendline("nvram commit")
pobj.expect(".*#.*")
pobj.sendline("startservice firewall")
pobj.expect(".*#.*")
pobj.close()

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.05371s using 14 queries.