nomadro/apps/miniprogram/weapp/scripts/_ssh_probe_book.py
eric 3e5b7c2098 Monorepo super-optimize: src layout, workspace scripts, docs.
Collapse portal under src/, unify pnpm workspace/scripts, thin VIP topic re-exports, drop orphan vip scaffolds and one-shot scripts, ignore xhs/release, document root commands.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-01 00:34:04 +08:00

46 lines
2.1 KiB
Python

import paramiko
from pathlib import Path
host = "129.204.21.129"
user = "ubuntu"
password = "Xiao4669805"
out_path = Path(__file__).with_name("_ssh_probe_book.out.txt")
cmd = r"""
set +e
echo '=== www.hackrobot.cn tree (depth 3) ==='
find /www/wwwroot/www.hackrobot.cn -maxdepth 3 \( -type d -o -name '*.md' -o -name '*book*' -o -name '*content*' \) 2>/dev/null | head -120
echo '=== nomadbook tree ==='
find /www/wwwroot/nomadbook -maxdepth 4 \( -name '*.md' -o -name 'book.json' -o -name '*chapter*' -o -path '*/content/*' -o -path '*/data/*' \) 2>/dev/null | head -150
ls -la /www/wwwroot/nomadbook 2>/dev/null | head -40
echo '=== digital ebook.md head ==='
ls -la /www/wwwroot/digital/app/data/ 2>/dev/null
wc -l /www/wwwroot/digital/app/data/ebook.md /www/wwwroot/nomadvip/app/data/ebook.md 2>/dev/null
echo '=== search md under wwwroot relevant ==='
find /www/wwwroot/www.hackrobot.cn /www/wwwroot/nomadbook /www/wwwroot/digital /www/wwwroot/api.hackrobot.cn -name '*.md' 2>/dev/null | head -80
echo '=== minio hackrobot sample ==='
ls /home/ubuntu/minio/data/hackrobot 2>/dev/null | head -40
find /home/ubuntu/minio/data/hackrobot -maxdepth 3 -type f 2>/dev/null | head -60
echo '=== pocketbase / api book ==='
ls /www/wwwroot/pocketbase.hackrobot.cn 2>/dev/null | head -30
ls /www/wwwroot/api.hackrobot.cn 2>/dev/null | head -40
echo '=== grep content path in nomadbook src ==='
grep -Rsn --include='*.{js,ts,tsx,json,env*}' -E 'chapters|content/|ebook\.md|markdown|/book' /www/wwwroot/nomadbook/src /www/wwwroot/www.hackrobot.cn 2>/dev/null | head -80
"""
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)
_stdin, stdout, stderr = client.exec_command(cmd, timeout=180)
out = stdout.read().decode("utf-8", errors="replace")
err = stderr.read().decode("utf-8", errors="replace")
client.close()
out_path.write_text(out + ("\nSTDERR:\n" + err if err.strip() else ""), encoding="utf-8")
print(f"wrote {out_path} size={out_path.stat().st_size}")