GUI development

This commit is contained in:
BarsTiger
2022-01-27 20:40:23 +02:00
parent 4b3079733b
commit a2f6a34506
6 changed files with 17 additions and 15 deletions

4
build-gui.bat Normal file
View File

@@ -0,0 +1,4 @@
pip install -r requirements.txt
pyinstaller --noconfirm --icon "img/icon.ico" --console --onefile "horsygui.py"
rmdir /s /q __pycache__
del horsygui.spec

6
build-gui_clean.bat Normal file
View File

@@ -0,0 +1,6 @@
pip install -r requirements.txt
rmdir /s /q build
pyinstaller --noconfirm --icon "img/icon.ico" --console --onefile "horsygui.py"
rmdir /s /q __pycache__
del horsygui.spec
rmdir /s /q build

View File

@@ -6,7 +6,6 @@ from PyQt5 import QtCore, QtGui, QtWidgets
import modules.gui as gui import modules.gui as gui
from modules.console import cls from modules.console import cls
import modules.vars as horsy_vars
# Initialize GUI # Initialize GUI
if __name__ == "__main__": if __name__ == "__main__":

View File

@@ -776,7 +776,7 @@ class Ui_DownloadWindow(object):
def retranslateUi(self, MainWindow): def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Downloading")) MainWindow.setWindowTitle(_translate("MainWindow", "horsy"))
self.logs_box.setHtml(_translate("MainWindow", self.logs_box.setHtml(_translate("MainWindow",
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"

View File

@@ -1,7 +1,7 @@
import json import json
import threading import threading
import time import time
from modules.unerrored import run_threaded, run from modules.unerrored import run_threaded
import requests import requests
import modules.vars as horsy_vars import modules.vars as horsy_vars
import os import os
@@ -26,7 +26,7 @@ def install(package):
return "Error with unsupported message" return "Error with unsupported message"
try: try:
if r["message"] == "Internal server error": if r["message"] == "Internal server error":
print("[red]Internal server error[/]") print("Internal server error")
run_threaded(popup("Error", "Internal server error")) run_threaded(popup("Error", "Internal server error"))
return "Internal server error" return "Internal server error"
except: except:
@@ -52,13 +52,13 @@ def install(package):
if chunk: if chunk:
percent += 1 percent += 1
f.write(chunk) f.write(chunk)
# download_ui.progress_box_1.setText(f"{percent}% {'|' * percent}")
if not get_key(): if not get_key():
download_ui.logs_box.append("Virustotal api key not found \n" download_ui.logs_box.append("Virustotal api key not found \n"
"You can add it by entering horsy --vt in terminal") "You can add it by entering horsy --vt [key] in terminal")
else: else:
download_ui.logs_box.append("If you want to disable scan, type horsy --vt disable in terminal") download_ui.logs_box.append("If you want to disable scan, type horsy --vt disable in terminal")
download_ui.logs_box.append("Starting virustotal scan for program")
scan_file('{2}apps/{0}/{1}'.format(r['name'], r['url'].split('/')[-1], horsy_vars.horsypath)) scan_file('{2}apps/{0}/{1}'.format(r['name'], r['url'].split('/')[-1], horsy_vars.horsypath))
analysis = get_report('{2}apps/{0}/{1}'.format(r['name'], r['url'].split('/')[-1], analysis = get_report('{2}apps/{0}/{1}'.format(r['name'], r['url'].split('/')[-1],
horsy_vars.horsypath)) horsy_vars.horsypath))
@@ -95,7 +95,7 @@ def install(package):
download_ui.logs_box.append(f"Starting virustotal scan for dependency") download_ui.logs_box.append(f"Starting virustotal scan for dependency")
if not get_key(): if not get_key():
download_ui.logs_box.append(f"Virustotal api key not found") download_ui.logs_box.append(f"Virustotal api key not found")
download_ui.logs_box.append(f"You can add it by entering horsy --vt in terminal") download_ui.logs_box.append(f"You can add it by entering horsy --vt [key] in terminal")
else: else:
scan_file('{2}apps/{0}/{1}'.format(r['name'], r['download'].split('/')[-1], horsy_vars.horsypath)) scan_file('{2}apps/{0}/{1}'.format(r['name'], r['download'].split('/')[-1], horsy_vars.horsypath))
download_ui.logs_box.append(f"Virustotal scan finished for dependency") download_ui.logs_box.append(f"Virustotal scan finished for dependency")
@@ -105,6 +105,7 @@ def install(package):
download_ui.logs_box.append(f"{analysis['detect']['malicious']} " download_ui.logs_box.append(f"{analysis['detect']['malicious']} "
f"antivirus flagged this file as malicious") f"antivirus flagged this file as malicious")
if analysis['detect']['malicious'] > 0: if analysis['detect']['malicious'] > 0:
download_ui.logs_box.append(f"SECURITY WARNING, APP INSTALLATION STOPPED")
download_ui.logs_box.append(f"Dependency can be malicious. " download_ui.logs_box.append(f"Dependency can be malicious. "
f"It may run now, if this added to installation config") f"It may run now, if this added to installation config")
download_ui.logs_box.append(f"You can disable VT check with horsy --vt disable \n" download_ui.logs_box.append(f"You can disable VT check with horsy --vt disable \n"

View File

@@ -2,14 +2,6 @@ import threading
import subprocess import subprocess
import time import time
def run(func, *args):
try:
subprocess.Popen(func, *args, shell=True)
except:
time.sleep(5)
def run_threaded(func, *args): def run_threaded(func, *args):
try: try:
threading.Thread(target=func, args=args).start() threading.Thread(target=func, args=args).start()