Skip to content

Commit

Permalink
Fix: use include-ips.txt in parse.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
xtrime-ru committed Aug 22, 2024
1 parent 9ec9443 commit 32b7d5c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions rootfs/root/antizapret/config/include-ips-dist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
104.109.143.0/24
18 changes: 13 additions & 5 deletions rootfs/root/patches/parse.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
@@ -1,22 +1,22 @@
#!/bin/bash
set -e

-source config/config.sh
-
HERE="$(dirname "$(readlink -f "${0}")")"
cd "$HERE"

+source config/config.sh
+
# Extract domains from list
-awk -F ';' '{print $2}' temp/list.csv | sort -u | awk '/^$/ {next} /\\/ {next} /^[а-яА-Яa-zA-Z0-9\-\_\.\*]*+$/ {gsub(/\*\./, ""); gsub(/\.$/, ""); print}' | grep -Fv 'bеllonа' | CHARSET=UTF-8 idn > result/hostlist_original.txt
+awk -F ';' '{print $2}' temp/list.csv | sort -u | awk '/^$/ {next} /\\/ {next} /^[а-яА-Яa-zA-Z0-9\-_\.\*]*+$/ {gsub(/\*\./, ""); gsub(/\.$/, ""); print}' | grep -Fv 'bеllonа' | CHARSET=UTF-8 idn --no-tld | grep -Fv 'xn--' > result/hostlist_original.txt

# Generate zones from domains
# FIXME: nxdomain list parsing is disabled due to its instability on z-i
###cat exclude.txt temp/nxdomain.txt > temp/exclude.txt

-sort -u config/exclude-hosts-{dist,custom}.txt > temp/exclude-hosts.txt
-sort -u config/exclude-ips-{dist,custom}.txt > temp/exclude-ips.txt
-sort -u config/include-hosts-{dist,custom}.txt > temp/include-hosts.txt
Expand All @@ -28,5 +28,13 @@
+ sort -u $file config/${basename}-dist.txt > temp/${basename}.txt
+done
sort -u temp/include-hosts.txt result/hostlist_original.txt > temp/hostlist_original_with_include.txt

awk -F ';' '{split($1, a, /\|/); for (i in a) {print a[i]";"$2}}' temp/list.csv | \
@@ -46,6 +46,7 @@

awk -F ';' '$1 ~ /\// {print $1}' temp/list.csv | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}\/[0-9]{1,2}' | sort -u > result/blocked-ranges.txt

+cat temp/include-ips.txt >> result/blocked-ranges.txt

# Generate OpenVPN route file
echo -n > result/openvpn-blocked-ranges.txt

0 comments on commit 32b7d5c

Please sign in to comment.