36 lines
1.3 KiB
Python
36 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
import paramiko
|
|
|
|
PASS = "Bbt9115xty9176!"
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("10.10.0.10", username="localadministrator", password=PASS, timeout=30)
|
|
|
|
cmds = [
|
|
"docker ps --format '{{.Names}}' | grep -i onset | head -10",
|
|
"docker ps --format '{{.Names}}' | grep -i exposed | head -5",
|
|
f"echo '{PASS}' | sudo -S cat /etc/infra/secrets.env 2>/dev/null | grep -i cloudflare",
|
|
"grep -h CLOUDFLARE /home/localadministrator/coder/onsethost/.env.local /home/localadministrator/coder/onsethost/.env 2>/dev/null",
|
|
]
|
|
for cmd in cmds:
|
|
print("===", cmd, "===")
|
|
_, o, e = c.exec_command(cmd, timeout=60)
|
|
o.channel.recv_exit_status()
|
|
print((o.read() + e.read()).decode(errors="replace")[:5000])
|
|
print()
|
|
|
|
# Get onsethost container env
|
|
_, o, e = c.exec_command(
|
|
"docker ps --format '{{.Names}}' | grep -E 'onsethost|woeslw' | head -3", timeout=30
|
|
)
|
|
o.channel.recv_exit_status()
|
|
names = (o.read() + e.read()).decode().strip().splitlines()
|
|
for name in names:
|
|
if not name.strip():
|
|
continue
|
|
print(f"=== env {name} CLOUDFLARE ===")
|
|
_, o2, e2 = c.exec_command(f"docker exec {name.strip()} env 2>/dev/null | grep -i CLOUDFLARE", timeout=30)
|
|
o2.channel.recv_exit_status()
|
|
print((o2.read() + e2.read()).decode(errors="replace"))
|
|
|
|
c.close() |