feat: add various infrastructure check and automation scripts

This commit is contained in:
2026-11-15 17:17:41 -05:00
parent 336b7759d0
commit b301aa3ece
232 changed files with 8274 additions and 298 deletions

View File

@@ -1,11 +1,29 @@
import paramiko
import sys
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('140.44.4.71', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
sys.stdout.reconfigure(encoding='utf-8')
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect('140.44.4.71', username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
stdin, stdout, stderr = ssh.exec_command("python3 -c \"import sqlite3; con = sqlite3.connect('/var/lib/docker/volumes/nginx-proxy-manager_nginx-data/_data/database.sqlite'); print(list(con.execute('SELECT id, incoming_port, forwarding_host, forwarding_port, is_deleted FROM stream')))\"")
print("STREAMS:", stdout.read().decode())
print("ERR:", stderr.read().decode())
def run(cmd):
stdin, stdout, stderr = c.exec_command(cmd)
return stdout.read().decode().strip(), stderr.read().decode().strip()
ssh.close()
check_streams = """
import sqlite3
conn = sqlite3.connect('/var/lib/docker/volumes/nginx-proxy-manager_nginx-data/_data/database.sqlite')
print("NPM STREAMS:")
for row in conn.execute("SELECT * FROM stream"):
print(row)
print("ALL TABLES:")
for row in conn.execute("SELECT name FROM sqlite_master WHERE type='table'"):
print(row)
conn.close()
"""
run(f"cat << 'EOF' > /tmp/check_streams.py\n{check_streams}\nEOF")
out, err = run("echo 'Katzir476!' | sudo -S python3 /tmp/check_streams.py")
print(out)
if err: print(err)
c.close()