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>
66 lines
2.0 KiB
Python
66 lines
2.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
GUEST_PW = "4669805"
|
|
|
|
|
|
def main() -> int:
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(
|
|
"107.173.30.245",
|
|
4014,
|
|
"eric",
|
|
GUEST_PW,
|
|
timeout=40,
|
|
banner_timeout=80,
|
|
allow_agent=False,
|
|
look_for_keys=False,
|
|
)
|
|
script = r"""
|
|
set -x
|
|
echo '=== dig deeper ==='
|
|
grep -RIn '192.168.21.36' /etc /home/eric /root /opt/douyinWEB 2>/dev/null | head -50 || true
|
|
grep -RIn 'HTTP_PROXY\|http_proxy' /etc/profile.d /etc/systemd /etc/default 2>/dev/null | head -40 || true
|
|
cat /etc/environment
|
|
echo '--- systemd default ---'
|
|
grep -i proxy /etc/systemd/system.conf /etc/systemd/user.conf 2>/dev/null || true
|
|
systemctl show-environment | grep -i proxy || echo no_systemd_env_proxy
|
|
echo '--- shellcrash profile ---'
|
|
ls /etc/profile.d/ 2>/dev/null
|
|
# ShellCrash often writes /etc/profile.d/shellcrash.sh or similar
|
|
cat /etc/profile.d/* 2>/dev/null | head -100
|
|
echo '--- eric bashrc ---'
|
|
grep -n -i proxy /home/eric/.bashrc /home/eric/.profile 2>/dev/null || echo none
|
|
# clean systemd manager env if set
|
|
systemctl unset-environment http_proxy https_proxy HTTP_PROXY HTTPS_PROXY ALL_PROXY all_proxy no_proxy NO_PROXY 2>/dev/null || true
|
|
# also check /etc/environment.d
|
|
ls /etc/environment.d 2>/dev/null || true
|
|
cat /etc/environment.d/* 2>/dev/null || true
|
|
# pam
|
|
grep -RIn 7897 /etc/security 2>/dev/null || true
|
|
# fresh ssh env for this session vs login
|
|
echo '--- current sudo env ---'
|
|
env | grep -i proxy || echo clean_now
|
|
"""
|
|
sftp = c.open_sftp()
|
|
with sftp.file("/tmp/_dig_proxy.sh", "w") as f:
|
|
f.write(script.replace("\r\n", "\n"))
|
|
sftp.close()
|
|
_, o, e = c.exec_command(
|
|
f"echo '{GUEST_PW}' | sudo -S -p '' bash /tmp/_dig_proxy.sh",
|
|
timeout=60,
|
|
)
|
|
print((o.read() + e.read()).decode("utf-8", "replace")[-8000:])
|
|
c.close()
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|