#!/usr/bin/env python3 """Check TM script payload size + provisioning on dylive neko-2; compare dy if reachable.""" from __future__ import annotations import sys import time import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") def ssh(host): c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) for i in range(8): try: c.connect( host, 22, "root", "Xiao4669805", timeout=50, allow_agent=False, look_for_keys=False, banner_timeout=180, ) return c except Exception as e: print("retry", host, i, e) time.sleep(2) raise SystemExit(f"fail {host}") def run(c, cmd, t=120): _i, o, e = c.exec_command(cmd, timeout=t) return (o.read() + e.read()).decode("utf-8", "replace") cmd = r""" set +e echo '=== provisioning files ===' ls -la /opt/douyinWEB/backend/neko/provisioning/ echo echo '=== TM leveldb strings (scripts?) on running nekos ===' for name in $(docker ps --format '{{.Names}}' | grep '^douyinweb-neko-' | sort -V); do echo "--- $name ---" docker exec "$name" sh -c ' sz=$(du -sb "/home/neko/.config/google-chrome/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo" 2>/dev/null | awk "{print \$1}") echo "tm_settings_bytes=$sz" # extract printable hints python3 - <<"PY" import os,re p="/home/neko/.config/google-chrome/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo" files=[] for root,_,fs in os.walk(p): for f in fs: files.append(os.path.join(root,f)) blob=b"" for f in files: try: blob += open(f,"rb").read() except Exception: pass text=blob.decode("latin1","ignore") # look for userscript markers hits=re.findall(r"@name[^\x00]{0,80}|youtube-studio[^\x00]{0,40}|UserScript[^\x00]{0,40}|live-ops[^\x00]{0,40}", text) print("markers", len(hits)) for h in hits[:15]: print(" ", repr(h)[:100]) print("blob_len", len(blob)) PY curl -sS -m 2 http://127.0.0.1:8080/ 2>/dev/null | head -c 80; echo ' done echo echo '=== how provisioning works ===' ls /opt/douyinWEB/backend/neko/provisioning/ head -80 /opt/douyinWEB/backend/neko/provisioning/*.json 2>/dev/null grep -RIn "tampermonkey\|userscript\|provision" /opt/douyinWEB/backend/neko --include="*.sh" --include="*.py" --include="*.conf" 2>/dev/null | head -40 echo echo '=== live-ops extension ===' ls /opt/douyinWEB/backend/neko/live-ops-extension/ | head docker exec douyinweb-neko-2 sh -c "ls /etc/neko/live-ops-extension | head; grep -n load-extension /etc/neko/browser-launch.sh | head" """ print("===== dylive =====", flush=True) dl = ssh("107.173.30.245") print(run(dl, cmd), flush=True) dl.close() print("===== dy (compare healthy) =====", flush=True) dy = ssh("108.174.50.68") print( run( dy, r""" set +e for name in $(docker ps --format '{{.Names}}' | grep '^douyinweb-neko-' | sort -V); do echo "--- $name ---" docker exec "$name" sh -c ' sz=$(du -sb "/home/neko/.config/google-chrome/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo" 2>/dev/null | awk "{print \$1}") echo "tm_settings_bytes=$sz running" python3 - <<"PY" import os,re p="/home/neko/.config/google-chrome/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo" blob=b"" for root,_,fs in os.walk(p): for f in fs: try: blob+=open(os.path.join(root,f),"rb").read() except: pass hits=re.findall(r"@name[^\x00]{0,60}|youtube-studio[^\x00]{0,40}", blob.decode("latin1","ignore")) print("markers",len(hits),"blob",len(blob)) for h in hits[:8]: print(" ",repr(h)[:90]) PY ' done """, ), flush=True, ) dy.close() print("DONE")