47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
import sys
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=40, allow_agent=False, look_for_keys=False)
|
|
_, o, e = c.exec_command(
|
|
"""
|
|
docker exec douyinweb-neko-7 supervisorctl restart google-chrome
|
|
sleep 15
|
|
docker exec -i douyinweb-neko-7 python3 <<'PY'
|
|
import json, os, re, urllib.request, time
|
|
from pathlib import Path
|
|
tabs=[]
|
|
for _ in range(10):
|
|
try:
|
|
tabs=json.loads(urllib.request.urlopen("http://127.0.0.1:9222/json/list", timeout=3).read()); break
|
|
except Exception: time.sleep(2)
|
|
print("tm_sw", sum(1 for t in tabs if t.get("type")=="service_worker" and "dhdgff" in (t.get("url") or "")))
|
|
print("tab_n", len(tabs))
|
|
for pid in os.listdir("/proc"):
|
|
if not pid.isdigit(): continue
|
|
try: cmd=open(f"/proc/{pid}/cmdline","rb").read().replace(b"\\x00",b" ").decode()
|
|
except Exception: continue
|
|
if "google-chrome" in cmd and "--type=" not in cmd and "load-extension" in cmd:
|
|
m=re.search(r"--load-extension=([^ ]+)", cmd); print("load_ext", m.group(1) if m else None); break
|
|
# rough script presence in LES
|
|
les=Path("/home/neko/.config/google-chrome/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo")
|
|
hits=0
|
|
for p in les.glob("*"):
|
|
try:
|
|
b=p.read_bytes()
|
|
if b"youtube" in b.lower() or b"dismiss" in b.lower() or b"@name" in b:
|
|
hits+=1
|
|
except Exception: pass
|
|
print("les_scriptish_files", hits)
|
|
PY
|
|
""",
|
|
timeout=90,
|
|
)
|
|
print((o.read() + e.read()).decode("utf-8", "replace"))
|
|
c.close()
|