-
Notifications
You must be signed in to change notification settings - Fork 7
/
unblock_keenetic.sh
125 lines (95 loc) · 4.6 KB
/
unblock_keenetic.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/sh
if [ "$1" == "remove" ]
then
opkg remove mc tor tor-geoip bind-dig cron dnsmasq-full ipset iptables dnscrypt-proxy2
rm -rf /opt/etc/ndm/fs.d/100-ipset.sh
rm -rf /opt/etc/tor/torrc
rm -rf /opt/etc/unblock.txt
rm -rf /opt/etc/unblock.dnsmasq
rm -rf /opt/bin/unblock_ipset.sh
rm -rf /opt/bin/unblock_dnsmasq.sh
rm -rf /opt/bin/unblock_update.sh
rm -rf /opt/etc/init.d/S99unblock
rm -rf /opt/etc/ndm/netfilter.d/100-redirect.sh
rm -rf /opt/etc/dnsmasq.conf
rm -rf /opt/etc/crontab
rm -rf /opt/etc/dnscrypt-proxy.toml
ndmq -p 'no opkg dns-override'
ndmq -p 'system configuration save'
ndmq -p 'system reboot'
sleep 5
exit 0
fi
if [ "$1" == "dnscrypt" ]
then
if [ ! -f /opt/etc/init.d/S99unblock ]; then
echo "Ошибка! Основной метод обхода блокировок не реализован в системе. Запустите unblock_keenetic.sh без параметров."
exit 0
fi
opkg update
opkg install dnscrypt-proxy2
rm -rf /opt/etc/dnscrypt-proxy.toml
wget --no-check-certificate -O /opt/etc/dnscrypt-proxy.toml https://raw.githubusercontent.com/Kyrie1965/unblock_keenetic/master/dnscrypt-proxy.toml
/opt/etc/init.d/S09dnscrypt-proxy2 start
rm -rf /opt/bin/unblock_ipset.sh
wget --no-check-certificate -O /opt/bin/unblock_ipset.sh https://raw.githubusercontent.com/Kyrie1965/unblock_keenetic/master/unblock_ipset_dnscrypt.sh
chmod +x /opt/bin/unblock_ipset.sh
rm -rf /opt/bin/unblock_dnsmasq.sh
wget --no-check-certificate -O /opt/bin/unblock_dnsmasq.sh https://raw.githubusercontent.com/Kyrie1965/unblock_keenetic/master/unblock_dnsmasq_dnscrypt.sh
chmod +x /opt/bin/unblock_dnsmasq.sh
unblock_update.sh
exit 0
fi
rm -rf /opt/etc/ndm/fs.d/100-ipset.sh
rm -rf /opt/etc/tor/torrc
rm -rf /opt/etc/unblock.txt
rm -rf /opt/etc/unblock.dnsmasq
rm -rf /opt/bin/unblock_ipset.sh
rm -rf /opt/bin/unblock_dnsmasq.sh
rm -rf /opt/bin/unblock_update.sh
rm -rf /opt/etc/init.d/S99unblock
rm -rf /opt/etc/ndm/netfilter.d/100-redirect.sh
rm -rf /opt/etc/dnsmasq.conf
rm -rf /opt/etc/crontab
rm -rf /opt/etc/dnscrypt-proxy.toml
opkg update
opkg install mc tor tor-geoip bind-dig cron dnsmasq-full ipset iptables
set_type="hash:net"
ipset create testset hash:net -exist > /dev/null 2>&1
retVal=$?
if [ $retVal -ne 0 ]; then
set_type="hash:ip"
fi
lanip=$(ndmq -p 'show interface Bridge0' -P address)
wget --no-check-certificate -O /opt/etc/ndm/fs.d/100-ipset.sh https://raw.githubusercontent.com/Kyrie1965/unblock_keenetic/master/100-ipset.sh
chmod +x /opt/etc/ndm/fs.d/100-ipset.sh
sed -i "s/hash:net/${set_type}/g" /opt/etc/ndm/fs.d/100-ipset.sh
rm -rf /opt/etc/tor/torrc
wget --no-check-certificate -O /opt/etc/tor/torrc https://raw.githubusercontent.com/Kyrie1965/unblock_keenetic/master/torrc
sed -i "s/192.168.1.1/${lanip}/g" /opt/etc/tor/torrc
wget --no-check-certificate -O /opt/etc/unblock.txt https://raw.githubusercontent.com/Kyrie1965/unblock_keenetic/master/unblock.txt
wget --no-check-certificate -O /opt/bin/unblock_ipset.sh https://raw.githubusercontent.com/Kyrie1965/unblock_keenetic/master/unblock_ipset.sh
chmod +x /opt/bin/unblock_ipset.sh
wget --no-check-certificate -O /opt/bin/unblock_dnsmasq.sh https://raw.githubusercontent.com/Kyrie1965/unblock_keenetic/master/unblock_dnsmasq.sh
chmod +x /opt/bin/unblock_dnsmasq.sh
unblock_dnsmasq.sh
wget --no-check-certificate -O /opt/bin/unblock_update.sh https://raw.githubusercontent.com/Kyrie1965/unblock_keenetic/master/unblock_update.sh
chmod +x /opt/bin/unblock_update.sh
wget --no-check-certificate -O /opt/etc/init.d/S99unblock https://raw.githubusercontent.com/Kyrie1965/unblock_keenetic/master/S99unblock
chmod +x /opt/etc/init.d/S99unblock
sed -i "s/hash:net/${set_type}/g" /opt/etc/init.d/S99unblock
sed -i "s/192.168.1.1/${lanip}/g" /opt/etc/init.d/S99unblock
wget --no-check-certificate -O /opt/etc/ndm/netfilter.d/100-redirect.sh https://raw.githubusercontent.com/Kyrie1965/unblock_keenetic/master/100-redirect.sh
chmod +x /opt/etc/ndm/netfilter.d/100-redirect.sh
sed -i "s/hash:net/${set_type}/g" /opt/etc/ndm/netfilter.d/100-redirect.sh
sed -i "s/192.168.1.1/${lanip}/g" /opt/etc/ndm/netfilter.d/100-redirect.sh
rm -rf /opt/etc/dnsmasq.conf
wget --no-check-certificate -O /opt/etc/dnsmasq.conf https://raw.githubusercontent.com/Kyrie1965/unblock_keenetic/master/dnsmasq.conf
sed -i "s/192.168.1.1/${lanip}/g" /opt/etc/dnsmasq.conf
rm -rf /opt/etc/crontab
wget --no-check-certificate -O /opt/etc/crontab https://raw.githubusercontent.com/Kyrie1965/unblock_keenetic/master/crontab
ndmq -p 'opkg dns-override'
ndmq -p 'system configuration save'
ndmq -p 'system reboot'
sleep 5
exit 0