mirror of
https://github.com/bol-van/zapret.git
synced 2025-05-24 22:32:58 +03:00
history purge
This commit is contained in:
39
files/huawei/E8372/run-zapret-ip
Executable file
39
files/huawei/E8372/run-zapret-ip
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/system/bin/busybox sh
|
||||
|
||||
# download hostlist from http(s) (need curl, its absent by default),
|
||||
# resolve to ip list, feed to zapret-ip. save flash write cycles
|
||||
|
||||
u="https://your.host.com/censorship/hoslist.txt"
|
||||
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
EXEDIR=$(dirname "$SCRIPT")
|
||||
|
||||
d=/data/censorship
|
||||
[ -d $d ] || mkdir $d
|
||||
f=$d/hostlist.txt
|
||||
t=/hostlist.txt
|
||||
i=/iplist.txt
|
||||
|
||||
curl -k --fail --max-time 10 -o "$t" "$u" && {
|
||||
if [ -s "$t" ]; then
|
||||
m1=$(md5sum "$t" | cut -d ' ' -f 1)
|
||||
m2=$(md5sum "$f" | cut -d ' ' -f 1)
|
||||
echo $m1 $m2
|
||||
if [ -z "$m2" ] || [ "$m1" != "$m2" ]; then
|
||||
echo updating hostlist
|
||||
cp -f "$t" "$f"
|
||||
else
|
||||
echo hostlist was not changed. keeping old copy
|
||||
fi
|
||||
else
|
||||
echo downloaded hostlist is empty. disabling zapret
|
||||
rm "$f"
|
||||
fi
|
||||
}
|
||||
|
||||
rm -f "$t"
|
||||
"$EXEDIR/unzapret-ip"
|
||||
[ -s "$f" ] && {
|
||||
mdig --threads=10 --family=4 <"$f" >"$i"
|
||||
[ -s "$i" ] && exec "$EXEDIR/zapret-ip" "$i"
|
||||
}
|
Reference in New Issue
Block a user