From e3d995dfc3e27338f2fb27b601bad8af9c4182ab Mon Sep 17 00:00:00 2001 From: CHIZI-0618 Date: Thu, 9 Feb 2023 12:26:28 +0800 Subject: [PATCH] Patch: Add anti-AD easyprivacy to geosite:category-ads-all Remove greatfire list Generate hosts based on reject-list.txt Add geo*.db files for sing-box --- .github/workflows/run.yml | 56 ++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/.github/workflows/run.yml b/.github/workflows/run.yml index 9383a3c04f..5eb1153125 100644 --- a/.github/workflows/run.yml +++ b/.github/workflows/run.yml @@ -24,11 +24,12 @@ jobs: echo "CHINA_DOMAINS_URL=https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf" >> $GITHUB_ENV echo "GOOGLE_DOMAINS_URL=https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf" >> $GITHUB_ENV echo "APPLE_DOMAINS_URL=https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf" >> $GITHUB_ENV - echo "GREATFIRE_DOMAINS_URL=https://raw.githubusercontent.com/Loyalsoldier/cn-blocked-domain/release/domains.txt" >> $GITHUB_ENV echo "EASYLISTCHINA_EASYLIST_REJECT_URL=https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt" >> $GITHUB_ENV + echo "EASYPRIVACY_REJECT_URL=https://easylist-downloads.adblockplus.org/easyprivacy.txt" >> $GITHUB_ENV echo "PETERLOWE_REJECT_URL=https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext" >> $GITHUB_ENV echo "ADGUARD_DNS_REJECT_URL=https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" >> $GITHUB_ENV echo "DANPOLLOCK_REJECT_URL=https://someonewhocares.org/hosts/hosts" >> $GITHUB_ENV + echo "ANTIAD_DOMAINS_URL=https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-domains.txt" >> $GITHUB_ENV echo "CUSTOM_DIRECT=https://raw.githubusercontent.com/Loyalsoldier/domain-list-custom/release/cn.txt" >> $GITHUB_ENV echo "CUSTOM_PROXY=https://raw.githubusercontent.com/Loyalsoldier/domain-list-custom/release/geolocation-!cn.txt" >> $GITHUB_ENV echo "WIN_SPY=https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt" >> $GITHUB_ENV @@ -78,7 +79,6 @@ jobs: - name: Get and add proxy domains into temp-proxy.txt file run: | cat ./gfwlist2dnsmasq/temp-gfwlist.txt | perl -ne '/^((?=^.{3,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})+)/ && print "$1\n"' > temp-proxy.txt - curl -sSL $GREATFIRE_DOMAINS_URL | perl -ne '/^((?=^.{3,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})+)/ && print "$1\n"' >> temp-proxy.txt curl -sSL $GOOGLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' >> temp-proxy.txt curl -sSL $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' >> temp-proxy.txt curl -sSL ${CUSTOM_PROXY} | grep -Ev ":@cn" | perl -ne '/^(domain):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-proxy.txt @@ -86,7 +86,9 @@ jobs: - name: Get and add reject domains into temp-reject.txt file run: | curl -sSL $EASYLISTCHINA_EASYLIST_REJECT_URL | perl -ne '/^\|\|([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})\^$/ && print "$1\n"' | perl -ne 'print if not /^[0-9]{1,3}(\.[0-9]{1,3}){3}$/' > temp-reject.txt + curl -sSL $EASYPRIVACY_REJECT_URL | perl -ne '/^\|\|([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})\^$/ && print "$1\n"' | perl -ne 'print if not /^[0-9]{1,3}(\.[0-9]{1,3}){3}$/' >> temp-reject.txt curl -sSL $ADGUARD_DNS_REJECT_URL | perl -ne '/^\|\|([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})\^$/ && print "$1\n"' | perl -ne 'print if not /^[0-9]{1,3}(\.[0-9]{1,3}){3}$/' >> temp-reject.txt + curl -sSL $ANTIAD_DOMAINS_URL | perl -ne '/^((?=^.{3,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})+)/ && print "$1\n"' >> temp-reject.txt curl -sSL $PETERLOWE_REJECT_URL | perl -ne '/^127\.0\.0\.1\s([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})$/ && print "$1\n"' >> temp-reject.txt curl -sSL $DANPOLLOCK_REJECT_URL | perl -ne '/^127\.0\.0\.1\s([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})/ && print "$1\n"' | sed '1d' >> temp-reject.txt @@ -146,8 +148,9 @@ jobs: cp ./community/data/cn direct-list.txt cp ./community/data/geolocation-\!cn proxy-list.txt cp ./community/data/category-ads-all reject-list.txt + awk '{print "0.0.0.0 " $0}' reject-list.txt > hosts - - name: Create `google-cn`、`apple-cn`、`gfw`、`greatfire` lists + - name: Create `google-cn`、`apple-cn`、`gfw` lists run: | curl -sSL $GOOGLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > ./community/data/google-cn curl -sSL $GOOGLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > google-cn.txt @@ -155,8 +158,6 @@ jobs: curl -sSL $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > apple-cn.txt cat ./gfwlist2dnsmasq/temp-gfwlist.txt | perl -ne '/^((?=^.{3,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})+)/ && print "$1\n"' >> ./community/data/gfw cat ./community/data/gfw | sort --ignore-case -u > gfw.txt - curl -sSL $GREATFIRE_DOMAINS_URL | perl -ne '/^((?=^.{3,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})+)/ && print "$1\n"' >> ./community/data/greatfire - cat ./community/data/greatfire | sort --ignore-case -u > greatfire.txt curl -sSL $WIN_SPY | grep "0.0.0.0" | awk '{print $2}' > ./community/data/win-spy curl -sSL $WIN_SPY | grep "0.0.0.0" | awk '{print $2}' > win-spy.txt curl -sSL $WIN_UPDATE | grep "0.0.0.0" | awk '{print $2}' > ./community/data/win-update @@ -169,17 +170,52 @@ jobs: cd custom || exit 1 go run ./ --datapath=../community/data + - name: Checkout CHIZI-0618/sing-geosite + uses: actions/checkout@v3 + with: + repository: CHIZI-0618/sing-geosite + path: sing-geosite + + - name: Build geosite.db file + env: + NO_SKIP: true + run: | + cd sing-geosite || exit 1 + cp ../custom/publish/geosite.dat ./ + go run -v . geosite.dat geosite.db + + - name: Checkout SagerNet/sing-geoip + uses: actions/checkout@v3 + with: + repository: SagerNet/sing-geoip + path: sing-geoip + + - name: Build geoip.db file + env: + NO_SKIP: true + run: | + cd sing-geoip || exit 1 + sed -i 's/Dreamacro\/maxmind-geoip/Loyalsoldier\/geoip/g' main.go + go run -v . + - name: Move and zip files and generate sha256 hash run: | - install -Dp ./geoip.dat ./publish/geoip.dat - install -Dp ./geoip.dat.sha256sum ./publish/geoip.dat.sha256sum - install -Dp ./custom/publish/geosite.dat ./publish/geosite.dat + mkdir -p ./publish/ + install -Dp ./geoip.dat ./publish/ + install -Dp ./geoip.dat.sha256sum ./publish/ + install -Dp ./custom/publish/geosite.dat ./publish/ + install -Dp ./sing-geosite/geosite.db ./publish/ + install -Dp ./sing-geosite/geosite-v2fly.db ./publish/ + install -Dp ./sing-geoip/geoip.db ./publish/ install -p {proxy,direct,reject}-tld-list.txt ./publish/ install -p {proxy,direct,reject}-list.txt ./publish/ - install -p {apple-cn,google-cn,gfw,greatfire,win-spy,win-update,win-extra}.txt ./publish/ + install -p hosts ./publish/ + install -p {apple-cn,google-cn,gfw,win-spy,win-update,win-extra}.txt ./publish/ cd ./publish || exit 1 - zip rules.zip {proxy,direct,reject}-list.txt geoip.dat geosite.dat + zip rules.zip {proxy,direct,reject}-list.txt geoip.dat geosite.dat geosite.db geosite-v2fly.db geoip.db sha256sum geosite.dat > geosite.dat.sha256sum + sha256sum geosite.db > geosite.db.sha256sum + sha256sum geoip.db > geoip.db.sha256sum sha256sum rules.zip > rules.zip.sha256sum - name: Release and upload assets