|
@@ -1,6 +1,6 @@
|
|
|
import { SOURCE_DIR } from './constants/dir';
|
|
import { SOURCE_DIR } from './constants/dir';
|
|
|
import path from 'node:path';
|
|
import path from 'node:path';
|
|
|
-import { isDomainAlive, isRegisterableDomainAlive } from './lib/is-domain-alive';
|
|
|
|
|
|
|
+import { getMethods } from './lib/is-domain-alive';
|
|
|
import { fdir as Fdir } from 'fdir';
|
|
import { fdir as Fdir } from 'fdir';
|
|
|
import runAgainstSourceFile from './lib/run-against-source-file';
|
|
import runAgainstSourceFile from './lib/run-against-source-file';
|
|
|
|
|
|
|
@@ -12,24 +12,31 @@ const queue = newQueue(32);
|
|
|
const deadDomains: string[] = [];
|
|
const deadDomains: string[] = [];
|
|
|
|
|
|
|
|
(async () => {
|
|
(async () => {
|
|
|
- const domainSets = await new Fdir()
|
|
|
|
|
- .withFullPaths()
|
|
|
|
|
- .filter((filePath, isDirectory) => {
|
|
|
|
|
- if (isDirectory) return false;
|
|
|
|
|
- const extname = path.extname(filePath);
|
|
|
|
|
- return extname === '.txt' || extname === '.conf';
|
|
|
|
|
- })
|
|
|
|
|
- .crawl(SOURCE_DIR + path.sep + 'domainset')
|
|
|
|
|
- .withPromise();
|
|
|
|
|
- const domainRules = await new Fdir()
|
|
|
|
|
- .withFullPaths()
|
|
|
|
|
- .filter((filePath, isDirectory) => {
|
|
|
|
|
- if (isDirectory) return false;
|
|
|
|
|
- const extname = path.extname(filePath);
|
|
|
|
|
- return extname === '.txt' || extname === '.conf';
|
|
|
|
|
- })
|
|
|
|
|
- .crawl(SOURCE_DIR + path.sep + 'non_ip')
|
|
|
|
|
- .withPromise();
|
|
|
|
|
|
|
+ const [
|
|
|
|
|
+ { isDomainAlive, isRegisterableDomainAlive },
|
|
|
|
|
+ domainSets,
|
|
|
|
|
+ domainRules
|
|
|
|
|
+ ] = await Promise.all([
|
|
|
|
|
+ getMethods(),
|
|
|
|
|
+ new Fdir()
|
|
|
|
|
+ .withFullPaths()
|
|
|
|
|
+ .filter((filePath, isDirectory) => {
|
|
|
|
|
+ if (isDirectory) return false;
|
|
|
|
|
+ const extname = path.extname(filePath);
|
|
|
|
|
+ return extname === '.txt' || extname === '.conf';
|
|
|
|
|
+ })
|
|
|
|
|
+ .crawl(SOURCE_DIR + path.sep + 'domainset')
|
|
|
|
|
+ .withPromise(),
|
|
|
|
|
+ new Fdir()
|
|
|
|
|
+ .withFullPaths()
|
|
|
|
|
+ .filter((filePath, isDirectory) => {
|
|
|
|
|
+ if (isDirectory) return false;
|
|
|
|
|
+ const extname = path.extname(filePath);
|
|
|
|
|
+ return extname === '.txt' || extname === '.conf';
|
|
|
|
|
+ })
|
|
|
|
|
+ .crawl(SOURCE_DIR + path.sep + 'non_ip')
|
|
|
|
|
+ .withPromise()
|
|
|
|
|
+ ]);
|
|
|
|
|
|
|
|
const bar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);
|
|
const bar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);
|
|
|
bar.start(0, 0);
|
|
bar.start(0, 0);
|
|
@@ -56,7 +63,9 @@ const deadDomains: string[] = [];
|
|
|
bar.increment();
|
|
bar.increment();
|
|
|
|
|
|
|
|
if (!registerableDomainAlive) {
|
|
if (!registerableDomainAlive) {
|
|
|
- deadDomains.push('.' + registerableDomain);
|
|
|
|
|
|
|
+ if (registerableDomain) {
|
|
|
|
|
+ deadDomains.push('.' + registerableDomain);
|
|
|
|
|
+ }
|
|
|
} else if (!includeAllSubdomain && alive != null && !alive) {
|
|
} else if (!includeAllSubdomain && alive != null && !alive) {
|
|
|
deadDomains.push(domain);
|
|
deadDomains.push(domain);
|
|
|
}
|
|
}
|