From 8270e0c28d183cd00e0ad5a53b0439405be64edd Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Tue, 26 Apr 2022 21:57:07 +0200 Subject: [PATCH] More ISP data --- get-isp.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/get-isp.js b/get-isp.js index df52383..a11d512 100644 --- a/get-isp.js +++ b/get-isp.js @@ -2,16 +2,26 @@ const { spawn } = require("child_process"); module.exports = async function getISP(ip_address) { return new Promise((resolve, reject) => { + if (ip_address.startsWith("::ffff:")) { + ip_address = ip_address.replace("::ffff:", ""); + } const task = spawn("whois", [ip_address]); let data = ""; task.stdout.on("data", (d) => { data += d.toString(); }); task.on("close", () => { + console.log(data); resolve( data .split("\n") - .filter((l) => l.includes("role:")) + .filter( + (l) => + l.includes("role:") || + l.includes("org-name:") || + l.includes("country") + ) + .map((l) => l.replace("role:", "")) .join("|") ); });