Bulk WHOIS lookup requires server-side access to the WHOIS protocol (port 43) or RDAP API. Reference snippets below.
Use the existing scanner
OnlineCorners already runs RDAP lookups via the Domain Age tool. For bulk lookup, use the API at /api/v1/scan with the whois-domain-age slug.
import { safeFetch } from "@/lib/scanner/proxy";
export async function bulkRdap(domains: string[]) {
const results = await Promise.allSettled(domains.map(async (d) => {
const res = await safeFetch(`https://rdap.org/domain/${d}`, {
headers: { Accept: "application/rdap+json" },
signal: AbortSignal.timeout(8000),
});
return { domain: d, data: await res.json() };
}));
return results;
}import net from "net";
async function whois(domain: string): Promise<string> {
return new Promise((resolve, reject) => {
const client = net.createConnection(43, "whois.iana.org");
let buf = "";
client.on("data", (d) => buf += d.toString());
client.on("end", () => resolve(buf));
client.on("error", reject);
client.write(domain + "\r\n");
});
}