44 lines
1.7 KiB
Python
44 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
import sys
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
SH = r"""
|
|
set -e
|
|
for i in 1 2; do
|
|
name=douyinweb-ops-neko-$i
|
|
echo "===== $name ====="
|
|
docker inspect "$name" --format '{{range .Mounts}}{{.Source}} -> {{.Destination}} ({{.Mode}}){{println}}{{end}}' | grep -E 'neko|browser|policy|tamper|opt/douyin' || true
|
|
echo --- browser-launch head ---
|
|
docker exec "$name" head -n 5 /etc/neko/browser-launch.sh
|
|
echo --- has tm load? ---
|
|
docker exec "$name" grep -n "Offline Tampermonkey\|tm_load_dir\|load-extension" /etc/neko/browser-launch.sh | head -20 || true
|
|
echo --- host opt browser-launch has tm? ---
|
|
grep -n "Offline Tampermonkey\|tm_load_dir" /opt/douyinWEB/backend/neko/browser-launch.sh | head -10 || true
|
|
done
|
|
# find image/compose source for browser-launch
|
|
ls -la /opt/douyinWEB/backend/neko/browser-launch.sh
|
|
# check if compose mounts it
|
|
ls /opt/douyinWEB/docker* 2>/dev/null; ls /opt/douyinWEB/*compose* 2>/dev/null; ls /opt/douyinWEB/backend/neko/*compose* 2>/dev/null
|
|
find /opt/douyinWEB -name '*ops*neko*' -o -name '*compose*.yml' 2>/dev/null | head -40
|
|
"""
|
|
|
|
|
|
def main() -> None:
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("107.173.30.245", 4014, "eric", "4669805", timeout=40, allow_agent=False, look_for_keys=False)
|
|
sftp = c.open_sftp()
|
|
with sftp.file("/tmp/_tm_find_mount.sh", "wb") as f:
|
|
f.write(SH.encode())
|
|
sftp.close()
|
|
_i, o, e = c.exec_command("echo 4669805 | sudo -S -p '' bash /tmp/_tm_find_mount.sh", timeout=120)
|
|
print((o.read() + e.read()).decode("utf-8", "replace"))
|
|
c.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|