mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Feat: whois detect run against domain status as well [skip ci]
This commit is contained in:
@@ -38,6 +38,24 @@ describe('whoisExists', () => {
|
|||||||
}
|
}
|
||||||
})).toBe('No entries found for the selected source(s).');
|
})).toBe('No entries found for the selected source(s).');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('nosuchpool.cl', async () => {
|
||||||
|
expect(noWhois({
|
||||||
|
'whois.nic.cl': {
|
||||||
|
'Domain Status': [],
|
||||||
|
'Name Server': [],
|
||||||
|
'nosuchpool.cl': 'no entries found.',
|
||||||
|
text: [
|
||||||
|
'%%',
|
||||||
|
'%% This is the NIC Chile Whois server (whois.nic.cl).',
|
||||||
|
'%%',
|
||||||
|
'%% Rights restricted by copyright.',
|
||||||
|
'%% See https://www.nic.cl/normativa/politica-publicacion-de-datos-cl.pdf',
|
||||||
|
'%%'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})).toBe('nosuchpool.cl: no entries found.');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isDomainAlive', function () {
|
describe('isDomainAlive', function () {
|
||||||
@@ -75,8 +93,8 @@ describe('isDomainAlive', function () {
|
|||||||
// expect((await isDomainAlive('.tayfundogdas.me', true))[1]).toEqual(true);
|
// expect((await isDomainAlive('.tayfundogdas.me', true))[1]).toEqual(true);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
it('9s6q.cn', async () => {
|
it('nosuchpool.cl', async () => {
|
||||||
process.env.DEBUG = 'true';
|
process.env.DEBUG = 'true';
|
||||||
expect((await isDomainAlive('.9s6q.cn', true))[1]).toEqual(false);
|
expect((await isDomainAlive('.nosuchpool.cl', true))[1]).toEqual(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -282,6 +282,26 @@ export function noWhois(whois: whoiser.WhoisSearchResult): null | string {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key === 'Domain Status') {
|
||||||
|
if (Array.isArray(whois[key])) {
|
||||||
|
for (const status of whois[key]) {
|
||||||
|
if (whoisNotFoundKeywordTest(status.toLowerCase())) {
|
||||||
|
return key + ': ' + status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof whois[key] === 'string' && whois[key]) {
|
||||||
|
if (whoisNotFoundKeywordTest(whois[key].toLowerCase())) {
|
||||||
|
return key + ': ' + whois[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof whois[key] === 'object' && !Array.isArray(whois[key])) {
|
if (typeof whois[key] === 'object' && !Array.isArray(whois[key])) {
|
||||||
const tmp = noWhois(whois[key]);
|
const tmp = noWhois(whois[key]);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
|
|||||||
Reference in New Issue
Block a user