smartwhois/ts/index.ts

25 lines
817 B
TypeScript
Raw Normal View History

2023-04-03 14:48:14 +00:00
import * as plugins from './smartwhois.plugins.js';
export class SmartWhois {
public async getWhoisForDomain(domainArg: string) {
const whoisInfo = await plugins.whoiser.domain(domainArg);
const whoisServers = Object.keys(whoisInfo);
const selectedWhoisInfo: any = whoisInfo[whoisServers[0]];
const registrar = selectedWhoisInfo.Registrar;
const registrarUrl = selectedWhoisInfo['Registrar URL'];
const createdDate = selectedWhoisInfo['Created Date'];
const updatedDate = selectedWhoisInfo['Updated Date'];
const expiryDate = selectedWhoisInfo['Expiry Date'];
return {
originalWhoisInfo: whoisInfo,
whoisServers,
registrar,
registrarUrl,
createdDate,
updatedDate,
expiryDate,
};
}
public async getWhoisForIp(ipArg: string) {}
}