feat: add scripts to inspect snarfhome proxy and redirection configurations via SSH
This commit is contained in:
21
scripts/check_snarfhome.py
Normal file
21
scripts/check_snarfhome.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import paramiko
|
||||||
|
|
||||||
|
client = paramiko.SSHClient()
|
||||||
|
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||||
|
client.connect("140.44.4.71", username="root", key_filename=r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet", timeout=10)
|
||||||
|
|
||||||
|
cmd = """python3 - << 'EOF'
|
||||||
|
import sqlite3
|
||||||
|
conn = sqlite3.connect('/var/lib/docker/volumes/nginx-proxy-manager_nginx-data/_data/database.sqlite')
|
||||||
|
print("PROXY HOSTS:")
|
||||||
|
for row in conn.execute("SELECT id, domain_names, forward_host, forward_port, forward_scheme, enabled FROM proxy_host WHERE domain_names LIKE '%snarfhome%'"):
|
||||||
|
print(row)
|
||||||
|
print("REDIRECTION HOSTS:")
|
||||||
|
for row in conn.execute("SELECT id, domain_names, forward_domain_name, forward_http_code, enabled FROM redirection_host WHERE domain_names LIKE '%snarfhome%'"):
|
||||||
|
print(row)
|
||||||
|
EOF
|
||||||
|
"""
|
||||||
|
stdin, stdout, stderr = client.exec_command(cmd)
|
||||||
|
print(stdout.read().decode())
|
||||||
|
print(stderr.read().decode())
|
||||||
|
client.close()
|
||||||
14
scripts/inspect_snarfhome_details.py
Normal file
14
scripts/inspect_snarfhome_details.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import paramiko
|
||||||
|
|
||||||
|
client = paramiko.SSHClient()
|
||||||
|
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||||
|
client.connect("140.44.4.71", username="root", key_filename=r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet", timeout=10)
|
||||||
|
|
||||||
|
cmd = """
|
||||||
|
ls -la /var/lib/docker/volumes/nginx-proxy-manager_nginx-data/_data/nginx/redirection_host/
|
||||||
|
cat /var/lib/docker/volumes/nginx-proxy-manager_nginx-data/_data/nginx/redirection_host/1.conf
|
||||||
|
"""
|
||||||
|
stdin, stdout, stderr = client.exec_command(cmd)
|
||||||
|
print(stdout.read().decode())
|
||||||
|
print(stderr.read().decode())
|
||||||
|
client.close()
|
||||||
Reference in New Issue
Block a user