Debug installing app, that didn't tested on VT

This commit is contained in:
BarsTiger
2022-03-01 21:42:26 +02:00
parent be4762a983
commit b2bd838924
2 changed files with 53 additions and 43 deletions

View File

@@ -91,6 +91,7 @@ def install(package):
"You can add it by entering horsy --vt [key] in terminal") "You can add it by entering horsy --vt [key] in terminal")
download_ui.logs_box.moveCursor(QtGui.QTextCursor.End) download_ui.logs_box.moveCursor(QtGui.QTextCursor.End)
else: else:
try:
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") download_ui.logs_box.append("Starting virustotal scan for program")
download_ui.logs_box.moveCursor(QtGui.QTextCursor.End) download_ui.logs_box.moveCursor(QtGui.QTextCursor.End)
@@ -101,12 +102,16 @@ def install(package):
f"{analysis['link']} \n" f"{analysis['link']} \n"
f"{analysis['detect']['malicious']} antivirus flagged this file as malicious") f"{analysis['detect']['malicious']} antivirus flagged this file as malicious")
download_ui.logs_box.moveCursor(QtGui.QTextCursor.End) download_ui.logs_box.moveCursor(QtGui.QTextCursor.End)
except:
pass
if r['download']: if r['download']:
try:
download_ui.logs_box.append("") download_ui.logs_box.append("")
download_ui.logs_box.append("Starting virustotal scan for dependency") download_ui.logs_box.append("Starting virustotal scan for dependency")
download_ui.logs_box.moveCursor(QtGui.QTextCursor.End) download_ui.logs_box.moveCursor(QtGui.QTextCursor.End)
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"Scan finished for dependency") download_ui.logs_box.append(f"Scan finished for dependency")
download_ui.logs_box.moveCursor(QtGui.QTextCursor.End) download_ui.logs_box.moveCursor(QtGui.QTextCursor.End)
analysis = get_report('{2}apps/{0}/{1}'.format(r['name'], r['download'].split('/')[-1], analysis = get_report('{2}apps/{0}/{1}'.format(r['name'], r['download'].split('/')[-1],
@@ -124,6 +129,8 @@ def install(package):
f"or use horsy CLI to force install") f"or use horsy CLI to force install")
download_ui.logs_box.append("") download_ui.logs_box.append("")
download_ui.logs_box.moveCursor(QtGui.QTextCursor.End) download_ui.logs_box.moveCursor(QtGui.QTextCursor.End)
except:
pass
if r['url'].split('.')[-1] == 'zip': if r['url'].split('.')[-1] == 'zip':
os.remove('{2}apps/{0}/{1}'.format(r['name'], r['url'].split('/')[-1], horsy_vars.horsypath)) os.remove('{2}apps/{0}/{1}'.format(r['name'], r['url'].split('/')[-1], horsy_vars.horsypath))

View File

@@ -63,6 +63,7 @@ def get_report(filename):
def scan_to_cli(filename): def scan_to_cli(filename):
try:
print(f"Starting virustotal scan") print(f"Starting virustotal scan")
if not get_key(): if not get_key():
print(f"[red]Virustotal api key not found[/]") print(f"[red]Virustotal api key not found[/]")
@@ -78,3 +79,5 @@ def scan_to_cli(filename):
print(f"{analysis['detect']['malicious']} antivirus flagged this file as malicious") print(f"{analysis['detect']['malicious']} antivirus flagged this file as malicious")
return analysis return analysis
except:
return None