mirror of
https://github.com/Johnshall/Shadowrocket-ADBlock-Rules-Forever.git
synced 2025-12-18 15:54:50 +08:00
Add ability to process IPV6 CIDR (#132)
* Support IPV6 CIDR * Remove duplicate domain from GFWList and update Telegram CIDR * Support DOMAIN-SUFFIX rules
This commit is contained in:
@@ -96,7 +96,10 @@ for row in rule:
|
|||||||
row = row.lstrip('.*')
|
row = row.lstrip('.*')
|
||||||
|
|
||||||
# 清除后缀
|
# 清除后缀
|
||||||
row = row.rstrip('/^*')
|
row = row.rstrip('/*')
|
||||||
|
if row[-1] == '^':
|
||||||
|
row = '.'+row
|
||||||
|
row = row.rstrip('^')
|
||||||
row = re.sub(r':\d{2,5}$', '', row) # 清除端口
|
row = re.sub(r':\d{2,5}$', '', row) # 清除端口
|
||||||
|
|
||||||
# 不能含有的字符
|
# 不能含有的字符
|
||||||
@@ -109,7 +112,7 @@ for row in rule:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# 只匹配域名或 IP
|
# 只匹配域名或 IP
|
||||||
if re.match(r'^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,9}$', row) or re.match(r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$', row):
|
if re.match(r'^\.?[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})*\.[a-zA-Z0-9][-a-zA-Z0-9]{1,}$', row) or re.match(r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$', row):
|
||||||
domains.append(row)
|
domains.append(row)
|
||||||
|
|
||||||
print('done.')
|
print('done.')
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ def getRulesStringFromFile(path, kind):
|
|||||||
prefix = 'IP-CIDR'
|
prefix = 'IP-CIDR'
|
||||||
if '/' not in content:
|
if '/' not in content:
|
||||||
content += '/32'
|
content += '/32'
|
||||||
|
elif re.match(r'((([0-9A-Fa-f]{1,4}:){7}([0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|
||||||
|
content += '/128'
|
||||||
elif '.' not in content and len(content) > 1:
|
elif '.' not in content and len(content) > 1:
|
||||||
prefix = 'DOMAIN-KEYWORD'
|
prefix = 'DOMAIN-KEYWORD'
|
||||||
|
|
||||||
|
|||||||
@@ -1,71 +1,48 @@
|
|||||||
# 手工定义的 Proxy 列表
|
# 手工定义的 Proxy 列表
|
||||||
|
|
||||||
theinitium.com
|
#TED
|
||||||
|
|
||||||
youtu.be
|
|
||||||
|
|
||||||
netflix.com
|
|
||||||
|
|
||||||
tedcdn.com
|
tedcdn.com
|
||||||
|
|
||||||
#161 可能以后会和GFWList重复
|
|
||||||
9gag.com
|
|
||||||
|
|
||||||
#Telegram
|
#Telegram
|
||||||
67.198.55.0/24
|
t.me
|
||||||
|
tdesktop.com
|
||||||
|
telegra.ph
|
||||||
|
telegram.me
|
||||||
|
telegram.org
|
||||||
|
telesco.pe
|
||||||
|
91.108.56.0/22
|
||||||
91.108.4.0/22
|
91.108.4.0/22
|
||||||
91.108.8.0/22
|
91.108.8.0/22
|
||||||
91.108.12.0/22
|
|
||||||
91.108.16.0/22
|
91.108.16.0/22
|
||||||
91.108.56.0/22
|
91.108.12.0/22
|
||||||
109.239.140.0/24
|
|
||||||
149.154.160.0/20
|
149.154.160.0/20
|
||||||
149.154.164.0/22
|
91.105.192.0/23
|
||||||
149.154.168.0/22
|
91.108.20.0/22
|
||||||
149.154.172.0/22
|
185.76.151.0/24
|
||||||
|
2001:b28:f23d::/48
|
||||||
|
2001:b28:f23f::/48
|
||||||
|
2001:67c:4e8::/48
|
||||||
|
2001:b28:f23c::/48
|
||||||
|
2a0a:f280::/32
|
||||||
|
|
||||||
#instagram
|
|
||||||
cdninstagram.com
|
|
||||||
|
|
||||||
#disqus
|
#disqus
|
||||||
disquscdn.com
|
disquscdn.com
|
||||||
|
|
||||||
gist.github.com
|
|
||||||
|
|
||||||
# 首页直连,但子域名需翻墙
|
|
||||||
onedrive.live.com
|
|
||||||
|
|
||||||
#20 开车
|
|
||||||
t66y.com
|
|
||||||
91porn.com
|
|
||||||
|
|
||||||
#132
|
|
||||||
feedly.com
|
|
||||||
|
|
||||||
#50 whatsapp
|
#50 whatsapp
|
||||||
whatsapp.com
|
|
||||||
whatsapp.net
|
|
||||||
18.194.0.0/15
|
18.194.0.0/15
|
||||||
34.224.0.0/12
|
34.224.0.0/12
|
||||||
|
|
||||||
#54 台湾香港澳门 常用网站
|
#54 台湾香港澳门 常用网站
|
||||||
ptt.cc
|
|
||||||
mingpaocanada.com
|
|
||||||
mingpao.com
|
|
||||||
appledaily.com
|
|
||||||
appledaily.tw
|
appledaily.tw
|
||||||
nextmag.com.tw
|
|
||||||
thestandnews.com
|
|
||||||
|
|
||||||
#60 GMail
|
|
||||||
# 手机 smtp 和 imap 需要用到
|
|
||||||
gmail.com
|
|
||||||
|
|
||||||
#72 #112 Google Voice
|
#72 #112 Google Voice
|
||||||
74.125.0.0/16
|
74.125.0.0/16
|
||||||
|
|
||||||
#85(可能冗余)
|
#85(可能冗余)
|
||||||
yt3.ggpht.com
|
|
||||||
www-google-analytics.l.google.com
|
www-google-analytics.l.google.com
|
||||||
ssl-google-analytics.l.google.com
|
ssl-google-analytics.l.google.com
|
||||||
partnerad.l.google.com
|
partnerad.l.google.com
|
||||||
@@ -79,9 +56,6 @@ afd.l.google.com
|
|||||||
#175 华尔街邮报
|
#175 华尔街邮报
|
||||||
dowjones.com
|
dowjones.com
|
||||||
|
|
||||||
#159
|
|
||||||
thetvdb.com
|
|
||||||
|
|
||||||
#180 OneDrive(可能冗余)
|
#180 OneDrive(可能冗余)
|
||||||
bcbits.com
|
bcbits.com
|
||||||
ogma.iad.appboy.com
|
ogma.iad.appboy.com
|
||||||
@@ -91,16 +65,12 @@ centralus1.mediap.svc.ms
|
|||||||
dm.files.1drv.com
|
dm.files.1drv.com
|
||||||
mobile.pipe.aria.microsoft.com
|
mobile.pipe.aria.microsoft.com
|
||||||
gate.hockeyapp.net
|
gate.hockeyapp.net
|
||||||
skyapi.live.net
|
|
||||||
api.onedrive.com
|
api.onedrive.com
|
||||||
vortex.data.microsoft.com
|
vortex.data.microsoft.com
|
||||||
|
|
||||||
#183
|
#183
|
||||||
mendeley.com
|
mendeley.com
|
||||||
|
|
||||||
#192 播客收听应用程序 overcast
|
|
||||||
overcast.fm
|
|
||||||
|
|
||||||
#205 APPLE NEWS
|
#205 APPLE NEWS
|
||||||
news-events.apple.com
|
news-events.apple.com
|
||||||
news-edge.apple.com
|
news-edge.apple.com
|
||||||
@@ -118,8 +88,6 @@ apple.news
|
|||||||
news.iadsdk.apple.com
|
news.iadsdk.apple.com
|
||||||
|
|
||||||
#github
|
#github
|
||||||
github.com
|
|
||||||
github.io
|
|
||||||
raw.githubusercontent.com
|
raw.githubusercontent.com
|
||||||
|
|
||||||
# news
|
# news
|
||||||
@@ -148,7 +116,6 @@ init-s01st-lb.push-apple.com.akadns.net
|
|||||||
gsp85-cn-ssl.ls.apple.com
|
gsp85-cn-ssl.ls.apple.com
|
||||||
itunes-apple.com.akadns.net
|
itunes-apple.com.akadns.net
|
||||||
gspe21.ls.apple.com
|
gspe21.ls.apple.com
|
||||||
gs-loc.apple.com
|
|
||||||
mesu-china.apple.com.akadns.net
|
mesu-china.apple.com.akadns.net
|
||||||
mesu-cdn.apple.com.akadns.net
|
mesu-cdn.apple.com.akadns.net
|
||||||
ocsp-lb.apple.com.akadns.net
|
ocsp-lb.apple.com.akadns.net
|
||||||
@@ -164,9 +131,6 @@ swscan-cdn.apple.com.akadns.net
|
|||||||
valid.origin-apple.com.akadns.net
|
valid.origin-apple.com.akadns.net
|
||||||
phobos.apple.com
|
phobos.apple.com
|
||||||
|
|
||||||
# linkedin
|
|
||||||
linkedin.com
|
|
||||||
|
|
||||||
# DisneyPlus
|
# DisneyPlus
|
||||||
disney.asia
|
disney.asia
|
||||||
disney.be
|
disney.be
|
||||||
@@ -438,11 +402,17 @@ wholekidsfoundation.org
|
|||||||
wholeplanetfoundation.org
|
wholeplanetfoundation.org
|
||||||
yamaxun.com
|
yamaxun.com
|
||||||
|
|
||||||
# OpenAI
|
|
||||||
openai.com
|
|
||||||
|
|
||||||
# Paramount
|
# Paramount
|
||||||
paramountplus.com
|
paramountplus.com
|
||||||
|
|
||||||
# New Bing
|
# New Bing
|
||||||
bing.com
|
bing.com
|
||||||
|
|
||||||
|
# DNS Leak
|
||||||
|
dnsleaktest.com
|
||||||
|
ipleak.net
|
||||||
|
browserleaks.com
|
||||||
|
browserleaks.org
|
||||||
|
vpnunlimited.com
|
||||||
|
whrq.net
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user