Files
exposedgays/deploy/try-cloudflared-cli.py

20 lines
899 B
Python

#!/usr/bin/env python3
import paramiko
PASS = "Bbt9115xty9176!"
TUNNEL = "03079a26-f14c-4622-b463-ba54a24f7472"
CREDS = f"/etc/cloudflared/{TUNNEL}.json"
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("10.10.0.10", username="localadministrator", password=PASS, timeout=30)
cmds = [
"cloudflared tunnel ingress --help 2>&1 | head -30",
f"echo '{PASS}' | sudo -S cloudflared tunnel --cred-file {CREDS} ingress validate /etc/cloudflared/config.yml 2>&1",
f"echo '{PASS}' | sudo -S cloudflared tunnel --cred-file {CREDS} ingress rule list 2>&1 | head -20",
"cloudflared tunnel --help 2>&1 | grep -i 'local\\|remote\\|config' | head -15",
]
for cmd in cmds:
print(f"\n=== {cmd[:85]} ===")
_, o, e = c.exec_command(cmd, timeout=60)
o.channel.recv_exit_status()
print((o.read()+e.read()).decode(errors="replace")[:3000])
c.close()