import paramiko, sys
sys.stdout.reconfigure(encoding="utf-8")

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect("192.168.1.76", username="root", password="7309208104")

# proxy.conf obsah
_, out, _ = ssh.exec_command("docker exec swag cat /config/nginx/proxy.conf")
print("=== proxy.conf ===")
print(out.read().decode())

# fail2ban - banned IPs
_, out, _ = ssh.exec_command("docker exec swag fail2ban-client status 2>/dev/null | head -20")
print("=== fail2ban status ===")
print(out.read().decode() or "(fail2ban není)")

# access log - kde jsou uloženy a jak jsou velké
_, out, _ = ssh.exec_command("docker exec swag ls -lh /config/log/nginx/ 2>/dev/null")
print("=== nginx log soubory ===")
print(out.read().decode())

# starší access logy - gzip archiv?
_, out, _ = ssh.exec_command("docker exec swag ls -lh /config/log/nginx/*.gz 2>/dev/null | head -5")
print("=== archivované logy ===")
print(out.read().decode() or "(žádné)")

ssh.close()
