Spaces:
Runtime error
Runtime error
File size: 1,246 Bytes
74ea0e0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import subprocess
import os
import json
def run_command(command):
process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
output, error = process.communicate()
if error:
print(f"Error: {error}")
return output
def main():
print("Updating system and installing dependencies...")
run_command("sudo apt-get update")
run_command("sudo apt-get install -y curl unzip jq xrdp kubuntu-desktop")
print("Changing root password...")
run_command("echo root:ilovedogshit | sudo chpasswd")
print("Starting xrdp...")
run_command("sudo /etc/init.d/xrdp start")
print("Installing ngrok...")
run_command("curl -s https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip > ngrok.zip")
run_command("unzip ngrok.zip")
run_command("chmod +x ./ngrok")
print("Starting ngrok tunnel...")
run_command("./ngrok authtoken 2N5KFYmyocPObelDKx26R1e2gfP_MiFweWSd9A8CbrC1E9Ef")
run_command("./ngrok tcp 3389 &")
output = run_command("curl --silent --show-error http://localhost:4040/api/tunnels")
tunnels = json.loads(output)
ngrok_url = tunnels['tunnels'][0]['public_url']
print(f"RDP connection: {ngrok_url}")
if __name__ == "__main__":
main()
|