Files
ts-scripts/single-scripts/ip.ts
2025-04-19 12:26:00 +08:00

26 lines
646 B
TypeScript
Executable File

#!/usr/bin/env runts -- --allow-import --allow-net
import {
log,
} from "https://hatter.ink/script/get/@1/deno-commons-mod.ts";
const args = Deno.args;
if (args.length === 0) {
log.info(`ip.ts <IP Address>`);
Deno.exit(1);
}
const response = await fetch('https://ip2asn.hatter.ink/v1/as/ip/' + args[0], {
headers: {
"Accept": "application/json",
},
});
const response_json = await response.json();
console.log(JSON.stringify(response_json, null, 2));
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20250419T122502+08:00.MEYCIQDWT10PIhmdVF/CZmvn
// KZcE5ylE47Bpi3om0XenYeD7JQIhAOm7m+W6q7rr/hkSD16UpST5q7Qe6tKwpZqNvn6rYITQ