Haha / app.py.old
Guinnessgshep's picture
Rename app.py to app.py.old
6646611
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()