cors / ip.js
Rifd's picture
changed
6bc1af4
raw
history blame
756 Bytes
const fs = require("fs")
let accounts = fs.readFileSync('./account', 'utf8').split("\n");
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}`);
}
}
})()