arevedudaa commited on
Commit
a35b458
·
verified ·
1 Parent(s): 28c782a

Create setup.py

Browse files
Files changed (1) hide show
  1. setup.py +122 -0
setup.py ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import subprocess
3
+ import shutil
4
+
5
+ CRD_SSH_Code = input("Google CRD SSH Code :")
6
+ username = "user" #@param {type:"string"}
7
+ password = "root" #@param {type:"string"}
8
+ os.system(f"useradd -m {username}")
9
+ os.system(f"adduser {username} sudo")
10
+ os.system(f"echo '{username}:{password}' | sudo chpasswd")
11
+ os.system("sed -i 's/\/bin\/sh/\/bin\/bash/g' /etc/passwd")
12
+
13
+ Pin = 123456 #@param {type: "integer"}
14
+ Autostart = True #@param {type: "boolean"}
15
+
16
+ class CRDSetup:
17
+ def __init__(self, user):
18
+ os.system("apt update")
19
+ self.installCRD()
20
+ self.installDesktopEnvironment()
21
+ self.changewall()
22
+ self.installGoogleChrome()
23
+ self.installTelegram()
24
+ self.installQbit()
25
+ self.finish(user)
26
+
27
+ @staticmethod
28
+ def installCRD():
29
+ subprocess.run(['wget', 'https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb'])
30
+ subprocess.run(['dpkg', '--install', 'chrome-remote-desktop_current_amd64.deb'])
31
+ subprocess.run(['apt', 'install', '--assume-yes', '--fix-broken'])
32
+ print("Chrome Remoted Desktop Installed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
33
+
34
+ @staticmethod
35
+ def installDesktopEnvironment():
36
+ os.system("export DEBIAN_FRONTEND=noninteractive")
37
+ os.system("apt install --assume-yes xfce4 desktop-base xfce4-terminal")
38
+ os.system("bash -c 'echo \"exec /etc/X11/Xsession /usr/bin/xfce4-session\" > /etc/chrome-remote-desktop-session'")
39
+ os.system("apt remove --assume-yes gnome-terminal")
40
+ os.system("apt install --assume-yes xscreensaver")
41
+ os.system("sudo apt purge light-locker")
42
+ os.system("sudo apt install --reinstall xfce4-screensaver")
43
+ os.system("systemctl disable lightdm.service")
44
+ print("Installed XFCE4 Desktop Environment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
45
+
46
+ @staticmethod
47
+ def installGoogleChrome():
48
+ subprocess.run(["wget", "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"])
49
+ subprocess.run(["dpkg", "--install", "google-chrome-stable_current_amd64.deb"])
50
+ subprocess.run(['apt', 'install', '--assume-yes', '--fix-broken'])
51
+ print("Google Chrome Installed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
52
+
53
+ @staticmethod
54
+ def installTelegram():
55
+ subprocess.run(["apt", "install", "--assume-yes", "telegram-desktop"])
56
+ print("Telegram Installed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
57
+
58
+ @staticmethod
59
+ def changewall():
60
+ os.system(f"curl -s -L -k -o xfce-verticals.png https://gitlab.com/chamod12/changewallpaper-win10/-/raw/main/CachedImage_1024_768_POS4.jpg")
61
+ current_directory = os.getcwd()
62
+ custom_wallpaper_path = os.path.join(current_directory, "xfce-verticals.png")
63
+ destination_path = '/usr/share/backgrounds/xfce/'
64
+ shutil.copy(custom_wallpaper_path, destination_path)
65
+ print("Wallpaper Changed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
66
+
67
+ @staticmethod
68
+ def installQbit():
69
+ subprocess.run(["sudo", "apt", "update"])
70
+ subprocess.run(["sudo", "apt", "install", "-y", "qbittorrent"])
71
+ print("Qbittorrent Installed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
72
+
73
+ @staticmethod
74
+ def finish(user):
75
+ if Autostart:
76
+ os.makedirs(f"/home/{user}/.config/autostart", exist_ok=True)
77
+ link = "www.youtube.com/@The_Disala"
78
+ colab_autostart = """[Desktop Entry]
79
+ print("Finalizing !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
80
+
81
+ Type=Application
82
+ Name=Colab
83
+ Exec=sh -c "sensible-browser {}"
84
+ Icon=
85
+ Comment=Open a predefined notebook at session signin.
86
+ X-GNOME-Autostart-enabled=true""".format(link)
87
+ with open(f"/home/{user}/.config/autostart/colab.desktop", "w") as f:
88
+ f.write(colab_autostart)
89
+ os.system(f"chmod +x /home/{user}/.config/autostart/colab.desktop")
90
+ os.system(f"chown {user}:{user} /home/{user}/.config")
91
+
92
+ os.system(f"adduser {user} chrome-remote-desktop")
93
+ command = f"{CRD_SSH_Code} --pin={Pin}"
94
+ os.system(f"su - {user} -c '{command}'")
95
+ os.system("service chrome-remote-desktop start")
96
+
97
+ print("..........................................................")
98
+ print(".....Brought By The Disala................................")
99
+ print("..........................................................")
100
+ print("......#####...######...####....####...##.......####.......")
101
+ print("......##..##....##....##......##..##..##......##..##......")
102
+ print("......##..##....##.....####...######..##......######......")
103
+ print("......##..##....##........##..##..##..##......##..##......")
104
+ print("......#####...######...####...##..##..######..##..##......")
105
+ print("..........................................................")
106
+ print("..Youtube Video Tutorial - https://youtu.be/xqpCQCJXKxU ..")
107
+ print("..........................................................")
108
+ print("Log in PIN : 123456")
109
+ print("User Name : user")
110
+ print("User Pass : root")
111
+ while True:
112
+ pass
113
+
114
+ try:
115
+ if CRD_SSH_Code == "":
116
+ print("Please enter authcode from the given link")
117
+ elif len(str(Pin)) < 6:
118
+ print("Enter a pin more or equal to 6 digits")
119
+ else:
120
+ CRDSetup(username)
121
+ except NameError as e:
122
+ print("'username' variable not found, Create a user first")