import paramiko
import json
import base64
import urllib.request
import urllib.parse

c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect('160.187.143.253', username='root', password=';ur7n)LC1BQ;')

def r(cmd):
    print(f"Executing: {cmd}")
    try:
        _, so, se = c.exec_command(cmd, timeout=30)
        stdout = so.read().decode('utf-8', 'replace').strip()
        stderr = se.read().decode('utf-8', 'replace').strip()
        if stdout: print(f"STDOUT:\n{stdout}")
        if stderr: print(f"STDERR:\n{stderr}")
        return stdout
    except Exception as e: 
        return str(e)

# Create a mock token for Sofi
payload = {"email": "sofi@ultra.com", "role": "admin"}
payload_b64 = base64.b64encode(json.dumps(payload).encode()).decode()
mock_token = f"header.{payload_b64}.signature"

r(f"curl -I --cookie 'jumpa_token={mock_token}' http://127.0.0.1:3005/")

c.close()
