feat: add ip.ts
This commit is contained in:
25
single-scripts/ip.ts
Executable file
25
single-scripts/ip.ts
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user