feat: add cluster auditing, management, and upgrade scripts
This commit is contained in:
23
scripts/inspect_gotify_db.py
Normal file
23
scripts/inspect_gotify_db.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import paramiko
|
||||
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect('140.44.4.71', username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
py_script = """sudo python3 -c '
|
||||
import sqlite3
|
||||
conn = sqlite3.connect("/mnt/swarm_shared/legacy_volumes/gotify/gotify.db")
|
||||
cur = conn.cursor()
|
||||
print("Applications:", cur.execute("SELECT id, name, description FROM applications").fetchall())
|
||||
print("Clients:", cur.execute("SELECT id, name FROM clients").fetchall())
|
||||
print("Messages count:", cur.execute("SELECT count(*) FROM messages").fetchone()[0])
|
||||
print("Recent messages:", cur.execute("SELECT id, title, message, date FROM messages ORDER BY id DESC LIMIT 5").fetchall())
|
||||
print("Users:", cur.execute("SELECT id, name, admin FROM users").fetchall())
|
||||
'"""
|
||||
|
||||
_, out, err = ssh.exec_command(py_script)
|
||||
print(out.read().decode())
|
||||
print("ERR:", err.read().decode())
|
||||
|
||||
ssh.close()
|
||||
|
||||
Reference in New Issue
Block a user