#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Diagnose ops-neko profile damage: Google login / cookies / backups.""" import sys import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") SH = r""" set -e echo "===== profile dirs =====" for i in 1 2; do p=/opt/douyinWEB/backend/data/ops_neko/profiles/$i echo "--- profile $i ---" ls -la "$p/Default" 2>/dev/null | head -40 || echo MISSING echo "size:" du -sh "$p" "$p/Default" 2>/dev/null || true for f in Cookies "Login Data" "Web Data" Preferences "Secure Preferences" "Network/Cookies" "Account Web Data"; do fp="$p/Default/$f" if [ -e "$fp" ]; then echo "OK $f $(stat -c '%s %y' "$fp")" else echo "NO $f" fi done # google account hints in Preferences python3 - </dev/null | head ls -la /opt/douyinWEB/backend/data/ops_neko/ 2>/dev/null find /opt/douyinWEB -name '*ops_neko*bak*' 2>/dev/null | head ls /tmp/*ops*neko* 2>/dev/null | head ls /tmp/*profile* 2>/dev/null | head echo "===== current chrome tabs / urls =====" for i in 1 2; do name=douyinweb-ops-neko-$i echo "--- $name ---" docker exec "$name" python3 - <<'PY' 2>/dev/null || echo cdp_fail import json, urllib.request try: tabs=json.loads(urllib.request.urlopen("http://127.0.0.1:9222/json/list", timeout=4).read()) except Exception as e: print("err", e); raise SystemExit for t in tabs: if t.get("type") in ("page","service_worker"): print(t.get("type"), (t.get("url") or "")[:120]) PY done """ def main() -> None: c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("107.173.30.245", 4014, "eric", "4669805", timeout=40, allow_agent=False, look_for_keys=False) sftp = c.open_sftp() with sftp.file("/tmp/_diag_ops_profiles.sh", "wb") as f: f.write(SH.encode()) sftp.close() _i, o, e = c.exec_command("echo 4669805 | sudo -S -p '' bash /tmp/_diag_ops_profiles.sh", timeout=120) print((o.read() + e.read()).decode("utf-8", "replace")) c.close() if __name__ == "__main__": main()