import paramiko

client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('152.136.232.83', port=22, username='root', password='Jianhua105', timeout=10)

def run(cmd):
    print(f"\n>>> {cmd[:120]}")
    stdin, stdout, stderr = client.exec_command(cmd, timeout=15)
    out = stdout.read().decode('utf-8', errors='replace').strip()
    if out: print(out[-800:])
    return out

run("grep -n 'SYS_CONFIG_FILE' /www/wwwroot/zhinengtiapp/index.js | head -5")

# Check our endpoint code
run("sed -n '1080,1120p' /www/wwwroot/zhinengtiapp/index.js")

client.close()
