mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 01:00:34 +08:00
Update Rules
This commit is contained in:
parent
58ce1dafd0
commit
a0168be5fd
@ -2,6 +2,8 @@ const { simpleGet } = require('./util-http-get');
|
||||
const { promises: fsPromises } = require('fs');
|
||||
const { resolve: pathResolve } = require('path');
|
||||
|
||||
const rIPv4 = /((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/;
|
||||
|
||||
let Piscina;
|
||||
try {
|
||||
Piscina = require('piscina');
|
||||
@ -55,7 +57,7 @@ async function processHosts(hostsUrl, includeAllSubDomain = false) {
|
||||
if (line.includes('#')) {
|
||||
return;
|
||||
}
|
||||
if (line.startsWith(' ') || line === '' || line.startsWith('\r') || line.startsWith('\n')) {
|
||||
if (line.startsWith(' ') || line.startsWith('\r') || line.startsWith('\n') || line.trim() === '') {
|
||||
return;
|
||||
}
|
||||
const [, ...domains] = line.split(' ');
|
||||
@ -103,15 +105,16 @@ async function processFilterRules(filterRulesUrl) {
|
||||
const filterRules = (await simpleGet.https(filterRulesUrl.hostname, filterRulesUrl.pathname)).split('\n');
|
||||
filterRules.forEach(line => {
|
||||
if (
|
||||
line.startsWith('#')
|
||||
|| line.startsWith('!')
|
||||
line.includes('#')
|
||||
|| line.includes('!')
|
||||
|| line.startsWith(' ')
|
||||
|| line === ''
|
||||
|| line.startsWith('\r')
|
||||
|| line.startsWith('\n')
|
||||
|| line.includes('*')
|
||||
|| line.includes('/')
|
||||
|| line.includes('$')
|
||||
|| line.trim() === ''
|
||||
|| rIPv4.test(line)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@ -153,9 +156,8 @@ async function processFilterRules(filterRulesUrl) {
|
||||
|
||||
// Parse from remote hosts & domain lists
|
||||
(await Promise.all([
|
||||
processHosts('https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext', true),
|
||||
processHosts('https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt'),
|
||||
processHosts('https://cdn.jsdelivr.net/gh/neoFelhz/neohosts@gh-pages/full/hosts')
|
||||
processHosts('https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext', true),
|
||||
processHosts('https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt')
|
||||
])).forEach(hosts => {
|
||||
hosts.forEach(host => {
|
||||
if (host) {
|
||||
@ -198,7 +200,12 @@ async function processFilterRules(filterRulesUrl) {
|
||||
processFilterRules('https://raw.githubusercontent.com/AdguardTeam/FiltersRegistry/master/filters/filter_11_Mobile/filter.txt'),
|
||||
processFilterRules('https://raw.githubusercontent.com/AdguardTeam/FiltersRegistry/master/filters/filter_3_Spyware/filter.txt'),
|
||||
processFilterRules('https://raw.githubusercontent.com/AdguardTeam/FiltersRegistry/master/filters/filter_2_English/filter.txt'),
|
||||
processFilterRules('https://raw.githubusercontent.com/AdguardTeam/FiltersRegistry/master/filters/filter_224_Chinese/filter.txt')
|
||||
processFilterRules('https://raw.githubusercontent.com/AdguardTeam/FiltersRegistry/master/filters/filter_224_Chinese/filter.txt'),
|
||||
processFilterRules('https://filters.adtidy.org/extension/ublock/filters/224.txt'),
|
||||
processFilterRules('https://easylist.to/easylist/easyprivacy.txt'),
|
||||
processFilterRules('https://raw.githubusercontent.com/DandelionSprout/adfilt/master/GameConsoleAdblockList.txt'),
|
||||
processFilterRules('https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV-AGH.txt'),
|
||||
processFilterRules('https://curben.gitlab.io/malware-filter/urlhaus-filter-agh-online.txt')
|
||||
])).forEach(({ white, black }) => {
|
||||
white.forEach(i => filterRuleWhitelistDomainSets.add(i));
|
||||
black.forEach(i => domainSets.add(i));
|
||||
@ -232,34 +239,31 @@ async function processFilterRules(filterRulesUrl) {
|
||||
filename: pathResolve(__dirname, 'worker/build-reject-domainset-worker.js')
|
||||
});
|
||||
|
||||
const res2 = await Promise.all([
|
||||
(await Promise.all([
|
||||
piscina.run({ keywords: domainKeywordsSet, suffixes: domainSuffixSet, input: domainSets }, { name: 'dedupeKeywords' }),
|
||||
piscina.run({ whiteList: filterRuleWhitelistDomainSets, input: domainSets }, { name: 'whitelisted' }),
|
||||
piscina.run({ whiteList: filterRuleWhitelistDomainSets, input: domainSets }, { name: 'whitelisted' })
|
||||
])).forEach(set => {
|
||||
set.forEach(i => domainSets.delete(i));
|
||||
});
|
||||
|
||||
const fullSet = new Set([...domainSets]);
|
||||
|
||||
(await Promise.all(
|
||||
Array.from(domainSets).reduce((result, element, index) => {
|
||||
const chunk = index % 12;
|
||||
result[chunk] = result[chunk] ?? [];
|
||||
|
||||
result[chunk].push(element);
|
||||
return result;
|
||||
}, []).map(chunk => piscina.run({ input: chunk, fullSet: domainSets }, { name: 'dedupe' }))
|
||||
]);
|
||||
res2.forEach(set => {
|
||||
}, []).map(chunk => piscina.run({ input: chunk, fullSet }, { name: 'dedupe' }))
|
||||
)).forEach(set => {
|
||||
set.forEach(i => domainSets.delete(i));
|
||||
});
|
||||
|
||||
const diffDeduping = beforeDeduping - domainSets.size;
|
||||
console.log(`Deduped ${beforeDeduping - domainSets.size} rules!`);
|
||||
|
||||
console.log(`Deduped ${diffDeduping} rules!`);
|
||||
|
||||
return fsPromises.writeFile(pathResolve(__dirname, '../List/domainset/reject.conf'), `${[...domainSets].join('\n')}\n`);
|
||||
return fsPromises.writeFile(
|
||||
pathResolve(__dirname, '../List/domainset/reject.conf'),
|
||||
`${[...domainSets].join('\n')}\n`,
|
||||
{ encoding: 'utf-8' });
|
||||
})();
|
||||
|
||||
function sliceIntoChunks(arr, chunkSize) {
|
||||
const res = [];
|
||||
for (let i = 0; i < arr.length; i += chunkSize) {
|
||||
const chunk = arr.slice(i, i + chunkSize);
|
||||
res.push(chunk);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -3,8 +3,6 @@
|
||||
# >> General
|
||||
.kuaizip.com
|
||||
.mackeeper.com
|
||||
.2345.com
|
||||
.2345.cn
|
||||
.xiniuz.com
|
||||
.marketo.com
|
||||
.sharethrough.com
|
||||
@ -19,8 +17,9 @@ optimus-ads.amap.com
|
||||
hot.m.shouji.360tpcdn.com
|
||||
.update.360safe.com
|
||||
inst.360safe.com
|
||||
pdown.stat.360safe.com
|
||||
.down.360.cn
|
||||
.se.360.cn
|
||||
.data.360safe.com
|
||||
|
||||
# >> Crypto Coin Hive
|
||||
.coinhive.com
|
||||
@ -28,12 +27,15 @@ pdown.stat.360safe.com
|
||||
.coin-hive.com
|
||||
.authcaptcha.com
|
||||
.browsermine.com
|
||||
.flashx.cc
|
||||
.flashx.pw
|
||||
.nimiq.agency
|
||||
.nimiq.network
|
||||
.nimiq-network.com
|
||||
.nimiq.com
|
||||
.hostcontent.live
|
||||
.cfcdist.loan
|
||||
.cfcnet.top
|
||||
|
||||
# >> Makeding
|
||||
.4009997658.com
|
||||
@ -175,11 +177,18 @@ pdown.stat.360safe.com
|
||||
.zhaozecheng.cn
|
||||
.zhenxinet.com
|
||||
.zzd6.com
|
||||
.dopa.com
|
||||
.dopa.com.cn
|
||||
.ok365.com
|
||||
.114so.cn
|
||||
.dragonparking.com
|
||||
|
||||
# --- AD Block ---
|
||||
|
||||
# >> General
|
||||
|
||||
.airpush.com
|
||||
.adbxb.cn
|
||||
.admedia.com
|
||||
.addthisedge.com
|
||||
.addthis.com
|
||||
@ -217,6 +226,7 @@ stat.loli.net
|
||||
.bidvertiser.com
|
||||
.awempire.com
|
||||
.adtechjp.com
|
||||
.adtech.de
|
||||
.adtilt.com
|
||||
.advertising.com
|
||||
.adview.cn
|
||||
@ -251,6 +261,7 @@ stat.loli.net
|
||||
.coolguang.com
|
||||
.conviva.com
|
||||
.criteo.com
|
||||
.criteo.net
|
||||
.crwdcntrl.net
|
||||
.ctrmi.com
|
||||
.demdex.net
|
||||
@ -396,7 +407,6 @@ adsapi.manhuaren.com
|
||||
adsdk.dmzj.com
|
||||
adshows.21cn.com
|
||||
adui.tg.meitu.com
|
||||
.ad.cmvideo.cn
|
||||
app-ad.variflight.com
|
||||
applog.mobike.com
|
||||
appnext.hs.llnwd.net
|
||||
@ -426,14 +436,26 @@ advertpay-vip-ssl.xunlei.com
|
||||
.advertising.speed.cdn.vip.xunlei.com
|
||||
.advertpay.vip.xunlei.com
|
||||
.youmi.net
|
||||
.logger.baofeng.com
|
||||
.houyi.baofeng.net
|
||||
.moviebox.baofeng.net
|
||||
.stat.kankan.com
|
||||
.cm.kankan.com
|
||||
.videojj.com
|
||||
.jizzads.com
|
||||
.mobisage.com
|
||||
.adsensor.cn
|
||||
.ymapp.com
|
||||
|
||||
.adcolony.com
|
||||
.adpro.cn
|
||||
.pro.cn
|
||||
.adpush.cn
|
||||
.adsage.com
|
||||
.adsage.cn
|
||||
.adsmogo.com
|
||||
.carbonads.net
|
||||
.carbonads.com
|
||||
.openx.net
|
||||
.domob.cn
|
||||
.doumob.com
|
||||
@ -464,6 +486,18 @@ advertpay-vip-ssl.xunlei.com
|
||||
mlog.hiido.com
|
||||
ylog.hiido.com
|
||||
.channeladvisor.com
|
||||
.adcome.cn
|
||||
.aduu.cn
|
||||
.adirects.com
|
||||
.admarket.mobi
|
||||
www.kuguopush.com
|
||||
.keyrun.cn
|
||||
.linkpage.cn
|
||||
.ulink.cc
|
||||
.yoyi.tv
|
||||
.adimg.deviantart.net
|
||||
.adcast.deviantart.com
|
||||
.inside.bitcomet.com
|
||||
|
||||
.youxiaoad.com
|
||||
.iteye.com
|
||||
@ -499,12 +533,9 @@ supersonicads-a.akamaihd.net
|
||||
|
||||
.ad-plus.cn
|
||||
.hot-mob.com
|
||||
.hyperpromote.com
|
||||
.leadboltads.
|
||||
.propellerads.com
|
||||
.quantserve.com
|
||||
.sharethis.com
|
||||
.turn.com
|
||||
.ad-stir.com
|
||||
.adfurikun.jp
|
||||
.ad-cloud.jp
|
||||
@ -515,6 +546,11 @@ adcloud.jp
|
||||
.aaxdetect.com
|
||||
.districtm.io
|
||||
.buysellads.net
|
||||
.servedby-buysellads.com
|
||||
.viglink.com
|
||||
.pixels.asia
|
||||
.snapmobileasia.net
|
||||
.intellitxt.com
|
||||
|
||||
.ad.wx.com
|
||||
.ad.weixin.qq.com
|
||||
@ -525,10 +561,15 @@ adcloud.jp
|
||||
.ad4.udn.com
|
||||
.ad5.udn.com
|
||||
|
||||
events.jianshu.io
|
||||
.mobileadtrading.com
|
||||
|
||||
# >> Tracking
|
||||
tracking.yorg.app
|
||||
.tealiumiq.com
|
||||
stats.wp.com
|
||||
js.monitor.azure.com
|
||||
pixel.wp.com
|
||||
.monitor.azure.com
|
||||
.cloudflareinsights.com
|
||||
.histats.com
|
||||
.appmetrica.yandex.net
|
||||
@ -556,7 +597,8 @@ beacon.wikia-services.com
|
||||
.growingio.com
|
||||
.gtags.net
|
||||
.statcounter.com
|
||||
api.segment.io
|
||||
.segment.io
|
||||
cdn.segment.com
|
||||
snap.licdn.com
|
||||
report.meituan.com
|
||||
.amplitude.com
|
||||
@ -568,6 +610,10 @@ analytics.slashdotmedia.com
|
||||
.ads.pro-market.net
|
||||
.stat.xtom.com
|
||||
.analytics.archive.org
|
||||
.stats.yinyuetai.com
|
||||
.collect.yinyuetai.com
|
||||
.sdklog.uu.cc
|
||||
.tagtic.cn
|
||||
|
||||
.adjust.io
|
||||
.airbrake.io
|
||||
@ -600,6 +646,12 @@ analytics.slashdotmedia.com
|
||||
.union.6.cn
|
||||
api-analytics-cn.huami.com
|
||||
|
||||
.stats.mokeedev.com
|
||||
tongji.tom.com
|
||||
ads.tvb.com
|
||||
ad.juksy.com
|
||||
.actonservice.com
|
||||
|
||||
# >> Alexa
|
||||
data.alexa.com
|
||||
device-metrics-us.amazon.com
|
||||
@ -740,7 +792,6 @@ fav.simba.taobao.com
|
||||
feedback.whalecloud.com
|
||||
ff.win.taobao.com
|
||||
fm.p0y.cn
|
||||
.click.taobao.com
|
||||
g.tbcdn.cn
|
||||
gma.alicdn.com
|
||||
gtms01.alicdn.com
|
||||
@ -842,7 +893,6 @@ click.qianqian.com
|
||||
.cpro.baidu.com
|
||||
.mpro.baidu.com
|
||||
log.music.baidu.com
|
||||
.tuisong.baidu.com
|
||||
.sestat.baidu.com
|
||||
.shadu.baidu.com
|
||||
ae.bdstatic.com
|
||||
@ -893,6 +943,7 @@ videopush.baidu.com
|
||||
.tuijian.baidu.com
|
||||
|
||||
# >> Qihoo 360
|
||||
.stat.360safe.com
|
||||
adapi.shouji.360.cn
|
||||
msg.shouji.360.cn
|
||||
.lianmeng.360.cn
|
||||
@ -900,7 +951,7 @@ dev.tg.wan.360.cn
|
||||
huodong.ios.shouji.360.cn
|
||||
kuaikan.netmon.360safe.com
|
||||
leak.360.cn
|
||||
openbox.mobilem.360.cn
|
||||
.mobilem.360.cn
|
||||
.s.360.cn
|
||||
.jiagu.360.cn
|
||||
pub.se.360.cn
|
||||
@ -999,6 +1050,8 @@ ad.yixin.im
|
||||
iadmat.nosdn.127.net
|
||||
iadmusicmat.music.126.net
|
||||
iadmusicmatvideo.music.126.net
|
||||
.clkservice.youdao.com
|
||||
.union.youdao.com
|
||||
impservice.dictapp.youdao.com
|
||||
impservice.youdao.com
|
||||
log.yex.youdao.com
|
||||
@ -1010,6 +1063,8 @@ yt-adp.nosdn.127.net
|
||||
crash.163.com
|
||||
crashlytics.163.com
|
||||
g.163.com
|
||||
a.youdao.com
|
||||
adpublish.ydstatic.com
|
||||
|
||||
# >> Tencent
|
||||
.beacon.qq.com
|
||||
@ -1260,6 +1315,10 @@ adsence.sogou.com
|
||||
.uranus.sogou.com
|
||||
.wan.sogou.com
|
||||
|
||||
# >> ifeng.com
|
||||
.ax.ifeng.com
|
||||
.deliver.ifeng.com
|
||||
|
||||
# >> LeTV
|
||||
api.game.letvstore.com
|
||||
ark.letv.com
|
||||
@ -1339,7 +1398,6 @@ log.star.ele.me
|
||||
.da.hunantv.com
|
||||
.log.hunantv.com
|
||||
log.v2.hunantv.com
|
||||
v2.log.hunantv.com
|
||||
click.hunantv.com
|
||||
res.hunantv.com
|
||||
|
||||
@ -1438,6 +1496,7 @@ conf.funshion.com
|
||||
vs.funshion.com
|
||||
rt.funshion.net
|
||||
stat.funshion.net
|
||||
pub.funshion.com
|
||||
|
||||
# >> Hupu
|
||||
adx.hupu.com
|
||||
@ -1471,7 +1530,7 @@ ysm.yahoo.com
|
||||
yads.c.yimg.jp
|
||||
yads.yahoo.co.jp
|
||||
.flurry.com
|
||||
flurry.cachefly.net
|
||||
.flurry.cachefly.net
|
||||
|
||||
# >> Disqus
|
||||
links.services.disqus.com
|
||||
@ -1480,6 +1539,8 @@ referrer.disqus.com
|
||||
disqusads.com
|
||||
|
||||
# >> 2345
|
||||
.2345.com
|
||||
.2345.cn
|
||||
.50bang.org
|
||||
|
||||
# >> XiMaLaYa
|
||||
@ -1561,6 +1622,11 @@ prt-stsdk.vivo.com.cn
|
||||
stnetsdk.vivo.com.cn
|
||||
.stsdk.vivo.com.cn
|
||||
|
||||
# >> Gionee
|
||||
0.0.0.0 ads.gionee.com
|
||||
0.0.0.0 pdl.gionee.com
|
||||
0.0.0.0 adres.myaora.net
|
||||
|
||||
# >> 勾正数据
|
||||
.gz-data.com
|
||||
.gzads.com
|
||||
@ -1590,7 +1656,6 @@ test.surepush.cn
|
||||
.ad.gtbrowser.com
|
||||
|
||||
# >> Wasu.tv
|
||||
|
||||
ads.wasu.tv
|
||||
adsystem.wasu.tv
|
||||
adwasu.wasu.tv
|
||||
@ -1598,3 +1663,8 @@ collector.wasu.cn
|
||||
delivery-pc.wasu.cn
|
||||
delivery.wasu.cn
|
||||
delivery.maihehd.com
|
||||
|
||||
# tom.com
|
||||
adserve2.tom.com
|
||||
.pub.tom.com
|
||||
.discovery.tom.com
|
||||
|
||||
@ -10,6 +10,10 @@ DOMAIN-KEYWORD,gettate
|
||||
DOMAIN-KEYWORD,mighbest
|
||||
DOMAIN-KEYWORD,nimiqpool
|
||||
DOMAIN-KEYWORD,.freecontent.
|
||||
DOMAIN-KEYWORD,sunnimiq
|
||||
DOMAIN-KEYWORD,.nimiq.
|
||||
DOMAIN-KEYWORD,anybest.
|
||||
DOMAIN-KEYWORD,dubester.
|
||||
|
||||
# --- End of Blacklist Section
|
||||
|
||||
@ -33,6 +37,8 @@ DOMAIN-KEYWORD,adsyndication
|
||||
DOMAIN-KEYWORD,doubleclick.
|
||||
DOMAIN-KEYWORD,adjust.
|
||||
DOMAIN-KEYWORD,appsflyer
|
||||
DOMAIN-KEYWORD,dnserror
|
||||
DOMAIN-KEYWORD,marketing.net
|
||||
|
||||
# Important: Force add the following domains without whitelisting
|
||||
DOMAIN-SUFFIX,openx.net
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user