22 lines
851 B
Python
22 lines
851 B
Python
import urllib.request
|
|
import ssl
|
|
|
|
ctx = ssl.create_default_context()
|
|
ctx.check_hostname = False
|
|
ctx.verify_mode = ssl.CERT_NONE
|
|
|
|
url = "https://sn-nas.snarfnet.net/webapi/entry.cgi?api=SYNO.Core.Desktop.SessionData&version=1&method=getjs&SynoToken=&v=1779933775"
|
|
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'})
|
|
try:
|
|
with urllib.request.urlopen(req, context=ctx, timeout=8) as resp:
|
|
print("Status:", resp.status)
|
|
print("Headers:", dict(resp.headers))
|
|
content = resp.read().decode('utf-8', errors='ignore')
|
|
print("Script length:", len(content))
|
|
print("Script preview:\n", content[:300])
|
|
except urllib.error.HTTPError as e:
|
|
print(f"HTTP Error {e.code}:", e.read().decode('utf-8', errors='ignore')[:300])
|
|
except Exception as e:
|
|
print("Error:", e)
|
|
|