import paramiko from pathlib import Path host = "129.204.21.129" user = "ubuntu" password = "Xiao4669805" out = Path(__file__).resolve().parent / "_hackrobot_book" / "index.tsx" out_parent = out.parent out_parent.mkdir(exist_ok=True) client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(host, username=user, password=password, timeout=25, allow_agent=False, look_for_keys=False) sftp = client.open_sftp() sftp.get("/www/wwwroot/nomadbook/src/pages/book/index.tsx", str(out)) sftp.close() # also extract which md is imported _stdin, stdout, stderr = client.exec_command( "grep -nE 'import|book\\.md|info\\.md|require|raw' /www/wwwroot/nomadbook/src/pages/book/index.tsx | head -40; " "ls -la /www/wwwroot/www.hackrobot.cn/; " "ls -la /www/wwwroot/nomadbook/dist/ 2>/dev/null | head -20; " "readlink -f /www/wwwroot/www.hackrobot.cn 2>/dev/null; " "ls /www/wwwroot/nomadbook/dist/h5 2>/dev/null | head -20", timeout=60, ) probe = stdout.read().decode("utf-8", errors="replace") (out_parent / "loader-probe.txt").write_text(probe, encoding="utf-8") client.close() print("saved", out, out.stat().st_size) print(probe[:2000])