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>
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Find writable root path to physical guest."""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
VPS = "107.173.30.245"
|
|
VPS_PW = "Xiao4669805"
|
|
|
|
|
|
def run(c, cmd, timeout=90):
|
|
_, o, e = c.exec_command(cmd, timeout=timeout)
|
|
return (o.read() + e.read()).decode("utf-8", "replace")
|
|
|
|
|
|
def main():
|
|
v = paramiko.SSHClient()
|
|
v.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
v.connect(VPS, 22, "root", VPS_PW, timeout=30, allow_agent=False, look_for_keys=False)
|
|
print("vps", run(v, "whoami; hostname; ping -c1 -W2 10.8.0.2 | tail -1").strip())
|
|
print(
|
|
run(
|
|
v,
|
|
"command -v sshpass >/dev/null || apt-get install -y sshpass >/dev/null 2>&1; "
|
|
"for u in root eric; do for p in Xiao4669805 4669805; do "
|
|
"out=$(sshpass -p \"$p\" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=8 "
|
|
"$u@10.8.0.2 'echo WHO=$(whoami); echo UID=$(id -u); "
|
|
"test -w /opt/douyinWEB/backend/app && echo WRITABLE || echo RO' 2>&1) && "
|
|
"echo OK $u/$p && echo \"$out\" && echo ---; done; done",
|
|
120,
|
|
)
|
|
)
|
|
v.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|