47 lines
2.2 KiB
Python
47 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
import json
|
|
import re
|
|
import urllib.error
|
|
import urllib.request
|
|
import paramiko
|
|
|
|
PASS = "Bbt9115xty9176!"
|
|
ACCOUNT = "2599c23bbb1255dbb73e8d34b4115fda"
|
|
TUNNEL = "03079a26-f14c-4622-b463-ba54a24f7472"
|
|
CF = "https://api.cloudflare.com/client/v4"
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("10.10.0.10", username="localadministrator", password=PASS, timeout=30)
|
|
cmds = [
|
|
f"echo '{PASS}' | sudo -S grep -rho 'cfut_[A-Za-z0-9_-]{{20,}}' /etc/infra /etc/cloudflared /root /home/localadministrator 2>/dev/null | sort -u",
|
|
f"echo '{PASS}' | sudo -S grep -rniE 'GLOBAL_API_KEY|X-Auth-Key|CLOUDFLARE_EMAIL' /etc/infra /etc/cloudflared /root /home/localadministrator 2>/dev/null | head -30",
|
|
"sudo cat /etc/cloudflared/config.yml",
|
|
"sudo journalctl -u cloudflared --no-pager -n 3 | grep 'Updated to new configuration' | tail -1 | python3 -c \"import sys,re; t=sys.stdin.read(); print('ingress_count', len(re.findall(r'hostname', t))); print('exposedgays', 'exposedgays' in t); print('thepinkpulse', 'thepinkpulse' in t)\"",
|
|
]
|
|
for cmd in cmds:
|
|
print(f"\n=== {cmd[:100]} ===")
|
|
_, o, e = c.exec_command(cmd, timeout=120)
|
|
o.channel.recv_exit_status()
|
|
print((o.read() + e.read()).decode(errors="replace")[:15000])
|
|
c.close()
|
|
|
|
tokens = set()
|
|
for label, tok in [
|
|
("zlUt", "cfut_zlUt5lAKVsu7qIcRCHJnyhAvpJVF5jx24HlrIEn9a8fcd6a1"),
|
|
("IOm1", "cfut_IOm1DJW4pDkPCuQA6UoOjqO6Tcv2zU10y2PSw82m379f7db3f7"),
|
|
("vF51", "cfut_vF51avCWJV9EnCM4lXS2v60jXo6TPQZ0yxESHuRn5b0f3515"),
|
|
]:
|
|
req = urllib.request.Request(
|
|
f"{CF}/accounts/{ACCOUNT}/cfd_tunnel/{TUNNEL}/configurations",
|
|
headers={"Authorization": f"Bearer {tok}", "Content-Type": "application/json"},
|
|
)
|
|
try:
|
|
with urllib.request.urlopen(req, timeout=30) as r:
|
|
data = json.load(r)
|
|
ingress = data.get("result", {}).get("config", {}).get("ingress", [])
|
|
eg = [i.get("hostname") for i in ingress if i.get("hostname") and "exposedgays" in i.get("hostname", "")]
|
|
print(f"\n[{label}] tunnel GET OK count={len(ingress)} exposedgays={eg}")
|
|
except urllib.error.HTTPError as e:
|
|
err = json.loads(e.read().decode())
|
|
print(f"\n[{label}] tunnel GET {e.code} {err.get('errors')}") |