Spaces:
Running
Running
const fs = require("fs"); | |
let accounts = fs | |
.readFileSync("./account", "utf8") | |
.split("\n") | |
.filter((a) => !a.includes("!")); | |
let custom = process.argv.slice(2); | |
let _accounts = custom?.length > 0 ? custom : accounts; | |
console.log(_accounts); | |
(async () => { | |
for (let i of _accounts) { | |
try { | |
const url = `https://${i}-cors.hf.space/proxy?url=${encodeURIComponent( | |
"https://ipwho.is" | |
)}`; | |
const res = await fetch(url); | |
if (!res.ok) throw new Error(`Status ${res.status}`); | |
const json = await res.json(); | |
if (!json.success) throw new Error(json.message || "Unknown error"); | |
console.log( | |
`[${i}] IP: ${json.ip} | Lokasi: ${json.city}, ${json.region}, ${json.country}` | |
); | |
} catch (err) { | |
console.error(`[${i}] Gagal: ${err.message}`); | |
} | |
} | |
})(); | |