douyinWEB/scripts/_diag_neko_tm.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 22:42:40 -05:00

44 lines
2.0 KiB
Python

# -*- coding: utf-8 -*-
from __future__ import annotations
import sys
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
HOST = "108.174.50.68"
PASS = "Xiao4669805"
CMD = r"""
for id in 1 2 3 4 5; do
name=douyinweb-neko-$id
if docker ps --format '{{.Names}}' | grep -qx "$name"; then
echo "===== $name ====="
docker exec "$name" supervisorctl status 2>/dev/null || true
docker exec "$name" sh -c 'ls /home/neko/.config/chromium/Default/Extensions/dhdgffkkebhmkfjojejmpbldmpobfkfo 2>/dev/null || echo NO_EXT_DIR'
docker exec "$name" sh -c 'grep -R -a "YouTube Studio Auto Dismiss" "/home/neko/.config/chromium/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo" 2>/dev/null | head -1 || echo NO_SCRIPT_IN_STORAGE'
docker exec "$name" python3 -c "import json;from pathlib import Path;p=Path('/home/neko/.config/chromium/Default/Preferences');d=json.loads(p.read_text()) if p.exists() else {};e=d.get('extensions',{}).get('settings',{}).get('dhdgffkkebhmkfjojejmpbldmpobfkfo',{});print('tm_state',e.get('state'),'path',e.get('path'),'loc',e.get('location'),'webstore',e.get('from_webstore'))"
docker exec "$name" sh -c 'curl -fsS http://127.0.0.1:18080/tampermonkey-provisioning.json | head -c 300; echo'
docker exec "$name" sh -c 'grep -R -a "YouTube Studio Auto Dismiss" /etc/neko/tampermonkey-seed 2>/dev/null | head -1 || echo NO_SEED_SCRIPT'
docker exec "$name" sh -c 'ls "/home/neko/.config/chromium/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo" 2>/dev/null | head -10 || echo NO_STORAGE_DIR'
fi
done
"""
def main() -> None:
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(HOST, 22, "root", PASS, timeout=60, allow_agent=False, look_for_keys=False)
_i, o, e = c.exec_command(CMD, timeout=120)
print(o.read().decode("utf-8", "replace"))
err = e.read().decode("utf-8", "replace")
if err.strip():
print("ERR", err[:2000])
c.close()
if __name__ == "__main__":
main()