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>
72 lines
3.1 KiB
Python
72 lines
3.1 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"""
|
|
name=douyinweb-neko-3
|
|
echo "=== container ==="
|
|
docker ps -a --filter name=$name --format '{{.Names}} {{.Status}}'
|
|
echo "=== supervisor ==="
|
|
docker exec "$name" supervisorctl status 2>/dev/null || true
|
|
echo "=== tm extension ==="
|
|
docker exec "$name" sh -c 'ls -la /home/neko/.config/chromium/Default/Extensions/dhdgffkkebhmkfjojejmpbldmpobfkfo/ 2>/dev/null || echo NO_EXT'
|
|
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'), 'disabled', e.get('disable_reasons'))
|
|
"
|
|
echo "=== storage ==="
|
|
docker exec "$name" sh -c 'ls -la "/home/neko/.config/chromium/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo" 2>/dev/null | head -8'
|
|
docker exec "$name" sh -c 'grep -R -a "YouTube Studio Auto Dismiss" "/home/neko/.config/chromium/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo" 2>/dev/null | wc -c'
|
|
echo "=== managed ==="
|
|
docker exec "$name" sh -c 'ls -la "/home/neko/.config/chromium/Default/Managed Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo" 2>/dev/null | head -8'
|
|
echo "=== chrome cmd ==="
|
|
docker exec "$name" sh -c 'for f in /proc/[0-9]*/cmdline; do tr "\0" " " < "$f"; echo; done 2>/dev/null | grep -i chrome | head -3'
|
|
echo "=== browser-launch key lines ==="
|
|
docker exec "$name" sh -c 'grep -n "Managed Extension Settings\|profile_has_session\|copy_seed_dir" /etc/neko/browser-launch.sh | head -10'
|
|
echo "=== chrome log tm errors ==="
|
|
docker exec "$name" sh -c 'grep -iE "tampermonkey|dhdgff|extension|internal|error" /var/log/neko/google-chrome.log 2>/dev/null | tail -25 || true'
|
|
echo "=== tabs ==="
|
|
docker exec "$name" python3 -c "
|
|
import json, urllib.request
|
|
try:
|
|
tabs=json.load(urllib.request.urlopen('http://127.0.0.1:9222/json/list',timeout=5))
|
|
print('tabs', len(tabs))
|
|
for t in tabs:
|
|
u=t.get('url') or ''
|
|
if any(x in u for x in ('tampermonkey','dhdgff','studio.youtube','extension')):
|
|
print(u[:120])
|
|
except Exception as e:
|
|
print('cdp_fail', e)
|
|
" 2>/dev/null || true
|
|
echo "=== policies ==="
|
|
docker exec "$name" sh -c 'test -f /etc/opt/chrome/policies/managed/policies.json && python3 -c "import json;print(json.load(open(\"/etc/opt/chrome/policies/managed/policies.json\")).get(\"ExtensionInstallForcelist\"))" || echo no_policies'
|
|
"""
|
|
|
|
|
|
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[:1500])
|
|
c.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|