Files
SnarfCode/scripts/check_real_gotify.py

25 lines
790 B
Python

import paramiko
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect('140.44.4.71', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
py_script = """import sqlite3
conn = sqlite3.connect('/mnt/swarm_shared/legacy_volumes/gotify/_data/gotify.db')
cur = conn.cursor()
print('=== REAL GOTIFY DB APPLICATIONS ===')
cols = [c[1] for c in cur.execute('PRAGMA table_info(applications)').fetchall()]
print('Cols:', cols)
for r in cur.execute('SELECT * FROM applications').fetchall():
print(r)
"""
stdin, stdout, stderr = c.exec_command("cat > /tmp/check_real_gotify.py && python3 /tmp/check_real_gotify.py")
stdin.write(py_script)
stdin.close()
print(stdout.read().decode())
print(stderr.read().decode())
c.close()