douyinWEB/scripts/_identify_frp_guest.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
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>
2026-09-04 22:42:40 -05:00

45 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
"""Identify which guest FRP:4014 actually hits."""
from __future__ import annotations
import sys
import time
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
PASS = "4669805"
REMOTE = r'''
import socket, subprocess
print("hostname", socket.gethostname())
print(subprocess.check_output("hostname -I; ip -4 addr show | grep -E 'inet ' ", shell=True, text=True, errors="replace"))
print(subprocess.check_output("uptime; free -h | head -2; cat /etc/machine-id 2>/dev/null; ls /opt/douyinWEB 2>/dev/null | head -3", shell=True, text=True, errors="replace"))
'''
def main():
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(
"107.173.30.245",
4014,
"eric",
PASS,
timeout=40,
banner_timeout=90,
allow_agent=False,
look_for_keys=False,
)
sftp = c.open_sftp()
with sftp.file("/tmp/_whoami.py", "w") as f:
f.write(REMOTE)
sftp.close()
_, o, e = c.exec_command(f"echo '{PASS}' | sudo -S -p '' python3 /tmp/_whoami.py", timeout=30)
print((o.read() + e.read()).decode("utf-8", "replace"))
c.close()
if __name__ == "__main__":
main()