feat: add ip.ts
This commit is contained in:
@@ -33,6 +33,15 @@
|
|||||||
"publish_time": 1737375737613,
|
"publish_time": 1737375737613,
|
||||||
"update_time": 1737650670433
|
"update_time": 1737650670433
|
||||||
},
|
},
|
||||||
|
"ip.ts": {
|
||||||
|
"script_name": "ip.ts",
|
||||||
|
"script_length": 646,
|
||||||
|
"script_sha256": "655bb8e80a7e81bd849591bb4fcf1a19f4293466f456b382603e4c9f1448b9d9",
|
||||||
|
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/ip.ts",
|
||||||
|
"single_script_file": true,
|
||||||
|
"publish_time": 1745036734128,
|
||||||
|
"update_time": 1745036734128
|
||||||
|
},
|
||||||
"kpxcenv.ts": {
|
"kpxcenv.ts": {
|
||||||
"script_name": "kpxcenv.ts",
|
"script_name": "kpxcenv.ts",
|
||||||
"script_length": 3709,
|
"script_length": 3709,
|
||||||
|
|||||||
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