3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

fix(phisherman): fix api response handling issue when checking subdomains

This commit is contained in:
Dragory 2021-11-03 03:29:57 +02:00
parent 4bdce129b3
commit fb44a6558f
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -129,10 +129,11 @@ async function fetchDomainInfo(domain: string): Promise<PhishermanDomainInfo | n
// tslint:disable-next-line:no-console // tslint:disable-next-line:no-console
console.log(`[PHISHERMAN] Requesting domain information: ${domain}`); console.log(`[PHISHERMAN] Requesting domain information: ${domain}`);
const result = await apiCall<Record<string, DomainInfoApiCallResult>>("GET", `/v2/domains/info/${domain}`); const result = await apiCall<Record<string, DomainInfoApiCallResult>>("GET", `/v2/domains/info/${domain}`);
const domainInfo = result[domain]; const firstKey = Object.keys(result)[0];
const domainInfo = firstKey ? result[firstKey] : null;
if (!domainInfo) { if (!domainInfo) {
// tslint:disable-next-line:no-console // tslint:disable-next-line:no-console
console.warn("Unexpected Phisherman API response:", result); console.warn(`Unexpected Phisherman API response for ${domain}:`, result);
return null; return null;
} }
if (domainInfo.classification === "unknown") { if (domainInfo.classification === "unknown") {