epicminer

epic miner

Jan 17th, 2024 (edited)
4,882
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.09 KB | Source Code | 0 0
  1. !python3 -m pip install notebook
  2.  
  3. !wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz
  4.  
  5. !tar -xvf ngrok-v3-stable-linux-amd64.tgz
  6.  
  7. !./ngrok authtoken 2cfB9NhaTOH7vSNfWnteSUd48IM_3PV4ieVyEQiehafJe6D1R
  8.  
  9. !./ngrok http 8888 & python3 -m notebook --allow-root
  10.  
  11.  
  12. ------------------------------------------------------------------------------------
  13.  
  14. import os
  15.  
  16. username = "user" #@param {type:"string"}
  17. password = "root" #@param {type:"string"}
  18. print("Creating User and Setting it up")
  19. os.system(f"useradd -m {username}")
  20. os.system(f"adduser {username} sudo")
  21. os.system(f"echo '{username}:{password}' | sudo chpasswd")
  22. os.system("sed -i 's/\/bin\/sh/\/bin\/bash/g' /etc/passwd")
  23. print(f"User created and configured having username `{username}` and password `{password}`")
  24. import subprocess
  25.  
  26. #@markdown  Visit http://remotedesktop.google.com/headless and copy the command after Authentication
  27.  
  28. CRP = '' #@param {type:"string"}
  29.  
  30. #@markdown Enter a Pin (more or equal to 6 digits)
  31. Pin = 123456 #@param {type: "integer"}
  32.  
  33. #@markdown Autostart Notebook in RDP
  34. Autostart = True #@param {type: "boolean"}
  35.  
  36.  
  37. class CRD:
  38.     def __init__(self, user):
  39.         os.system("apt update")
  40.         self.installCRD()
  41.         self.installDesktopEnvironment()
  42.         self.installGoogleChorme()
  43.         self.finish(user)
  44.         print("\nRDP created succesfully move to https://remotedesktop.google.com/access")
  45.  
  46.     @staticmethod
  47.     def installCRD():
  48.         print("Installing Chrome Remote Desktop")
  49.         subprocess.run(['wget', 'https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb'], stdout=subprocess.PIPE)
  50.         subprocess.run(['dpkg', '--install', 'chrome-remote-desktop_current_amd64.deb'], stdout=subprocess.PIPE)
  51.         subprocess.run(['apt', 'install', '--assume-yes', '--fix-broken'], stdout=subprocess.PIPE)
  52.  
  53.     @staticmethod
  54.     def installDesktopEnvironment():
  55.         print("Installing Desktop Environment")
  56.         os.system("export DEBIAN_FRONTEND=noninteractive")
  57.         os.system("apt install --assume-yes xfce4 desktop-base xfce4-terminal")
  58.         os.system("bash -c 'echo \"exec /etc/X11/Xsession /usr/bin/xfce4-session\" > /etc/chrome-remote-desktop-session'")
  59.         os.system("apt remove --assume-yes gnome-terminal")
  60.         os.system("apt install --assume-yes xscreensaver")
  61.         os.system("systemctl disable lightdm.service")
  62.  
  63.     @staticmethod
  64.     def installGoogleChorme():
  65.         print("Installing Google Chrome")
  66.         subprocess.run(["wget", "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"], stdout=subprocess.PIPE)
  67.         subprocess.run(["dpkg", "--install", "google-chrome-stable_current_amd64.deb"], stdout=subprocess.PIPE)
  68.         subprocess.run(['apt', 'install', '--assume-yes', '--fix-broken'], stdout=subprocess.PIPE)
  69.     @staticmethod
  70.     def finish(user):
  71.         print("Finalizing")
  72.         if Autostart:
  73.             os.makedirs(f"/home/{user}/.config/autostart", exist_ok=True)
  74.             link = "www.youtube.com/@epic_miner"
  75.             colab_autostart = """[Desktop Entry]
  76. Type=Application
  77. Name=Colab
  78. Exec=sh -c "sensible-browser {}"
  79. Icon=
  80. Comment=Open a predefined notebook at session signin.
  81. X-GNOME-Autostart-enabled=true""".format(link)
  82.             with open(f"/home/{user}/.config/autostart/colab.desktop", "w") as f:
  83.                 f.write(colab_autostart)
  84.             os.system(f"chmod +x /home/{user}/.config/autostart/colab.desktop")
  85.             os.system(f"chown {user}:{user} /home/{user}/.config")
  86.  
  87.         os.system(f"adduser {user} chrome-remote-desktop")
  88.         command = f"{CRP} --pin={Pin}"
  89.         os.system(f"su - {user} -c '{command}'")
  90.         os.system("service chrome-remote-desktop start")
  91.        
  92.  
  93.         print("Finished Succesfully")
  94.  
  95.         while True:pass
  96.  
  97. try:
  98.     if CRP == "":
  99.         print("Please enter authcode from the given link")
  100.     elif len(str(Pin)) < 6:
  101.         print("Enter a pin more or equal to 6 digits")
  102.     else:
  103.         CRD(username)
  104. except NameError as e:
  105.     print("'username' variable not found, Create a user first")
  106.  
Advertisement
Add Comment
Please, Sign In to add comment