47 lines
1.9 KiB
Python
47 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Re-apply TM seed on dylive if path broken; confirm seed markers."""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
import time
|
|
|
|
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=50,
|
|
allow_agent=False,
|
|
look_for_keys=False,
|
|
banner_timeout=180,
|
|
)
|
|
_i, o, e = c.exec_command(
|
|
r"""
|
|
set +e
|
|
SEED='/opt/douyinWEB/backend/neko/tampermonkey-seed/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo'
|
|
GOOD='/opt/douyinWEB/backend/data/neko/profiles/2/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo'
|
|
echo -n 'seed_exists='; [ -d "$SEED" ] && echo yes || echo no
|
|
echo -n 'seed_markers='; grep -a -R -c 'YouTube Studio Auto Dismiss' "$SEED" 2>/dev/null | awk -F: '{s+=$2} END{print s+0}'
|
|
echo -n 'good_markers='; grep -a -R -c 'YouTube Studio Auto Dismiss' "$GOOD" 2>/dev/null | awk -F: '{s+=$2} END{print s+0}'
|
|
if ! grep -a -R -q 'YouTube Studio Auto Dismiss' "$SEED" 2>/dev/null; then
|
|
echo 'refreshing seed from profile 2'
|
|
mkdir -p "$(dirname "$SEED")"
|
|
rm -rf "$SEED"
|
|
cp -a "$GOOD" "$SEED"
|
|
rm -f "$SEED/LOCK"
|
|
fi
|
|
echo -n 'seed_markers_after='; grep -a -R -c 'YouTube Studio Auto Dismiss' "$SEED" 2>/dev/null | awk -F: '{s+=$2} END{print s+0}'
|
|
docker ps --filter name=douyinweb-neko --format '{{.Names}} {{.Status}}' | sort -V
|
|
docker exec douyinweb-neko-2 python3 -c "import os,re;p='/home/neko/.config/google-chrome/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo';b=b''.join(open(os.path.join(r,f),'rb').read() for r,_,fs in os.walk(p) for f in fs);print('neko2', 'OK' if b'YouTube Studio Auto Dismiss' in b else 'EMPTY', len(b))"
|
|
curl -sS -m 5 -o /dev/null -w 'public_neko2:%{http_code}\n' https://dylive.nomadro.com/neko/2/
|
|
""",
|
|
timeout=60,
|
|
)
|
|
print((o.read() + e.read()).decode("utf-8", "replace"))
|
|
c.close()
|