#!/usr/bin/env python3 import hashlib import sys from pathlib import Path import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") data = Path(r"c:\Users\admin\Desktop\douyinWEB\backend\app\youtube_neko.py").read_bytes() print("hash", hashlib.sha256(data).hexdigest()[:12], flush=True) 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) sftp = c.open_sftp() with sftp.file("/opt/douyinWEB/backend/app/youtube_neko.py", "wb") as f: f.write(data) sftp.close() _i, o, e = c.exec_command( "systemctl restart douyinweb-api; sleep 2; systemctl is-active douyinweb-api; " "grep -c 'relay may leave Chrome' /opt/douyinWEB/backend/app/youtube_neko.py", timeout=60, ) print(o.read().decode(), flush=True) print(e.read().decode()[:400], flush=True) c.close() print("dylive_ok", flush=True)