mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Stricter Phishing Filtering
This commit is contained in:
@@ -1,41 +1,41 @@
|
|||||||
const tldts = require('tldts');
|
const tldts = require('tldts');
|
||||||
const { processFilterRules } = require('./lib/parse-filter.js');
|
const { processFilterRules } = require('./lib/parse-filter.js');
|
||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { withBannerArray } = require('./lib/with-banner.js');
|
const { withBannerArray } = require('./lib/with-banner.js');
|
||||||
const { stringArrayCompare, compareAndWriteFile } = require('./lib/string-array-compare');
|
const { compareAndWriteFile } = require('./lib/string-array-compare');
|
||||||
|
|
||||||
const WHITELIST_DOMAIN = new Set([
|
const WHITELIST_DOMAIN = new Set([
|
||||||
'w3s.link',
|
'w3s.link',
|
||||||
'dweb.link',
|
'dweb.link',
|
||||||
'nftstorage.link',
|
'nftstorage.link',
|
||||||
'square.site'
|
'square.site',
|
||||||
|
'business.site'
|
||||||
]);
|
]);
|
||||||
const BLACK_TLD = Array.from(new Set([
|
const BLACK_TLD = Array.from(new Set([
|
||||||
'.xyz',
|
'xyz',
|
||||||
'.top',
|
'top',
|
||||||
'.win',
|
'win',
|
||||||
'.vip',
|
'vip',
|
||||||
'.site',
|
'site',
|
||||||
'.space',
|
'space',
|
||||||
'.online',
|
'online',
|
||||||
'.icu',
|
'icu',
|
||||||
'.fun',
|
'fun',
|
||||||
'.shop',
|
'shop',
|
||||||
'.cool',
|
'cool',
|
||||||
'.cyou',
|
'cyou',
|
||||||
'.id',
|
'id',
|
||||||
'.pro',
|
'pro',
|
||||||
'.za.com',
|
'za.com',
|
||||||
'.sa.com',
|
'sa.com',
|
||||||
'.ltd',
|
'ltd',
|
||||||
'.group',
|
'group',
|
||||||
'.rest',
|
'rest',
|
||||||
'.tech',
|
'tech',
|
||||||
'.link',
|
'link',
|
||||||
'.ink',
|
'ink',
|
||||||
'.bar',
|
'bar',
|
||||||
'.tokyo'
|
'tokyo'
|
||||||
]));
|
]));
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
@@ -74,25 +74,27 @@ const BLACK_TLD = Array.from(new Set([
|
|||||||
|
|
||||||
// Add more weight if the domain is long enough
|
// Add more weight if the domain is long enough
|
||||||
if (domain.length > 45) {
|
if (domain.length > 45) {
|
||||||
domainCountMap[apexDomain] += 4;
|
domainCountMap[apexDomain] += 3.5;
|
||||||
} else if (domain.length > 35) {
|
} else if (domain.length > 35) {
|
||||||
domainCountMap[apexDomain] += 3;
|
domainCountMap[apexDomain] += 2.5;
|
||||||
} else if (domain.length > 30) {
|
} else if (domain.length > 30) {
|
||||||
domainCountMap[apexDomain] += 2;
|
domainCountMap[apexDomain] += 1.5;
|
||||||
} else if (domain.length > 25) {
|
} else if (domain.length > 25) {
|
||||||
domainCountMap[apexDomain] += 1;
|
domainCountMap[apexDomain] += 0.75;
|
||||||
|
} else if (domain.length > 21) {
|
||||||
|
domainCountMap[apexDomain] += 0.25;
|
||||||
}
|
}
|
||||||
|
|
||||||
const subdomain = tldts.getSubdomain(domain, { allowPrivateDomains: true });
|
if (domainCountMap[apexDomain] < 5) {
|
||||||
if (subdomain && subdomain.includes('.')) {
|
const subdomain = tldts.getSubdomain(domain, { allowPrivateDomains: true });
|
||||||
domainCountMap[apexDomain] += 0.5;
|
if (subdomain && subdomain.includes('.')) {
|
||||||
|
domainCountMap[apexDomain] += 1.5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(domainCountMap);
|
|
||||||
|
|
||||||
const results = [];
|
const results = [];
|
||||||
Object.entries(domainCountMap).forEach(([domain, count]) => {
|
Object.entries(domainCountMap).forEach(([domain, count]) => {
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user