38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
|
|
def main() -> None:
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(
|
|
"107.173.30.245",
|
|
22,
|
|
"root",
|
|
"Xiao4669805",
|
|
timeout=30,
|
|
allow_agent=False,
|
|
look_for_keys=False,
|
|
banner_timeout=60,
|
|
)
|
|
_i, o, e = c.exec_command(
|
|
"grep -nE 'neko/[0-9]|920[0-9]' /etc/caddy/sites/dylive.nomadro.com.caddy | head -60; "
|
|
"echo '---'; "
|
|
"docker inspect douyinweb-neko-8 --format 'HTTP={{(index (index .HostConfig.PortBindings \"8080/tcp\") 0).HostPort}}' 2>/dev/null; "
|
|
"docker inspect douyinweb-neko-8 --format '{{range $p,$c := .HostConfig.PortBindings}}{{$p}}->{{(index $c 0).HostPort}} {{end}}' | tr ' ' '\\n' | grep 8080",
|
|
timeout=30,
|
|
)
|
|
print((o.read() + e.read()).decode("utf-8", "replace"))
|
|
c.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|