This commit is contained in:
2026-07-10 22:09:16 -05:00
parent cd93846314
commit 6fc12b104c
4 changed files with 149 additions and 18 deletions
+16
View File
@@ -0,0 +1,16 @@
import os, json, subprocess
from warehouse import http_get, Vpn_cache
if "wg" in subprocess.run(["ip","link"], capture_output=True, text=True).stdout:
if not os.path.exists(Vpn_cache) or os.path.getsize(Vpn_cache) == 0:
try:
ip = http_get("https://icanhazip.com").strip()
res = json.loads(http_get(f"https://iplookup.stab.ing/api/v1/lookup?ip={ip}"))["country"]
except:
res = "NAY!"
open(Vpn_cache, "w").write(res)
print(f"VPN: {open(Vpn_cache).read()} / ", end="")
else:
try: os.remove(Vpn_cache)
except: pass
print("", end="")