-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathframework.py
1934 lines (1446 loc) · 74 KB
/
framework.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'''
Mavoc-Antivirus Tool
By Smukx
My Opensource Codes :https://github.com/Whitecat18
For Work : https://twitter.com/Smukx07
'''
from PyQt5.QtWidgets import *
from PyQt5 import QtCore, QtGui
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import sys
import os
from select import select
import sys
import shutil
import ctypes
import hashlib
import tempfile
from turtle import update
import typing
from PyQt5 import QtCore
import requests
import subprocess
from send2trash import send2trash
from PyQt5.QtWidgets import *
from PyQt5 import QtCore, QtGui
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import psutil
from datetime import datetime
import self
import time
import getpass
import threading
from antivirus.ui_design import show_help_menu
from antivirus import clean
'''
self.status_text_edit.clear()
self.hash_text_edit.clear()
Theses mode is used to clear the screen of the black ones . To clear the screen , append the module at front
'''
## Password autherntication
class LoginWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Mavoc Login")
self.setGeometry(100, 100, 200, 200)
self.init_ui()
def init_ui(self):
central_widget = QWidget(self)
self.setCentralWidget(central_widget)
layout = QVBoxLayout()
image_label = QLabel(self)
pixmap = QPixmap("core\mavoc_banner.jpg")
# pixmap = QPixmap("mavoc-anti.png")
pixmap = pixmap.scaledToWidth(500)
image_label.setPixmap(pixmap)
layout.addWidget(image_label)
self.password_input = QLineEdit(self)
self.password_input.setEchoMode(QLineEdit.Password)
login_button = QPushButton("Login", self)
login_button.clicked.connect(self.check_password)
layout.addWidget(self.password_input)
layout.addWidget(login_button)
central_widget.setLayout(layout)
def check_password(self):
entered_password = self.password_input.text()
if entered_password == "qwerty":
self.close()
self.run_antivirus_tool()
else:
self.show_wrong_password_message()
sys.exit()
def run_antivirus_tool(self):
msgbox = QMessageBox()
msgbox.setWindowTitle("Info from Smukx")
msgbox.setText("<b><center>Welcome to Mavoc Antivitus .</center></b>")
msgbox.setFixedSize(300, 150)
msgbox.exec_()
#print("Welcome to Mavoc Antivirus!")
def show_wrong_password_message(self):
msg_box = QMessageBox()
msg_box.setWindowTitle("Wrong Password")
msg_box.setIcon(QMessageBox.Warning)
msg_box.setText("Incorrect password. Please try again.")
msg_box.setFixedSize(300, 150)
msg_box.exec_()
# Scan Loading page for user
## Scan Dialog for Quick Scans.
class ScanTypeDialog(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.setWindowTitle("Select Scan Type")
self.setMinimumWidth(300)
self.setMinimumHeight(100)
layout = QVBoxLayout()
self.recursive_radio = QRadioButton("Quick Recursive Scan")
self.non_recursive_radio = QRadioButton("Quick Non-Recursive Scan")
radio_layout = QHBoxLayout()
radio_layout.addWidget(self.recursive_radio)
radio_layout.addWidget(self.non_recursive_radio)
layout.addLayout(radio_layout)
button_layout = QHBoxLayout()
self.ok_button = QPushButton("OK")
self.cancel_button = QPushButton("Cancel")
self.ok_button.clicked.connect(self.accept)
self.cancel_button.clicked.connect(self.reject)
button_layout.addWidget(self.ok_button)
button_layout.addWidget(self.cancel_button)
layout.addLayout(button_layout)
self.setLayout(layout)
def get_selected_option(self):
if self.recursive_radio.isChecked():
return "recursive"
elif self.non_recursive_radio.isChecked():
return "non_recursive"
else:
return None
class fullscantypedialog(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.setWindowTitle("Select Scanning Method ...")
self.setMinimumWidth(300)
self.setMinimumHeight(100)
layout = QVBoxLayout()
self.recursive_radio = QRadioButton("Full Scan")
self.nonrecursive_radio = QRadioButton("Partition Scan")
radio_layout = QHBoxLayout()
radio_layout.addWidget(self.recursive_radio)
radio_layout.addWidget(self.nonrecursive_radio)
layout.addLayout(radio_layout)
button_layout = QHBoxLayout()
self.ok_button = QPushButton("OK")
self.cancel_button = QPushButton("Cancel")
self.ok_button.clicked.connect(self.accept)
self.cancel_button.clicked.connect(self.reject)
button_layout.addWidget(self.ok_button)
button_layout.addWidget(self.cancel_button)
layout.addLayout(button_layout)
self.setLayout(layout)
def full_scan_selected_options(self):
if self.recursive_radio.isChecked():
return "full_scan"
elif self.nonrecursive_radio.isChecked():
return "partition_scan"
else:
return None
class networkProtectionDialog(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.setWindowTitle("Network Protection")
self.setMinimumWidth(300)
self.setMinimumHeight(150)
layout = QVBoxLayout()
self.enable_radio = QRadioButton("Enable Protection")
self.disable_radio = QRadioButton("Disable Protection")
radio_layout = QHBoxLayout()
radio_layout.addWidget(self.enable_radio)
radio_layout.addWidget(self.disable_radio)
layout.addLayout(radio_layout)
# Button to open the hosts file
self.open_hosts_button = QPushButton("Open BlackList File")
self.open_hosts_button.clicked.connect(self.open_hosts_file)
layout.addWidget(self.open_hosts_button)
button_layout = QHBoxLayout()
self.ok_button = QPushButton("OK")
self.cancel_button = QPushButton("Cancel")
self.ok_button.clicked.connect(self.accept)
self.cancel_button.clicked.connect(self.reject)
button_layout.addWidget(self.ok_button)
button_layout.addWidget(self.cancel_button)
layout.addLayout(button_layout)
self.setLayout(layout)
def network_protection_selected_option(self):
if self.enable_radio.isChecked():
return "enable"
elif self.disable_radio.isChecked():
return "disable"
else:
return None
def open_hosts_file(self):
hosts_path = r'network\blacklist.txt'
if os.path.exists(hosts_path):
os.system(f'notepad.exe {hosts_path}')
else:
QMessageBox.critical(self, "Error", "The hosts file does not exist.")
## SHEDULE CLASS PROGRAMMING
class ScheduleScanDialog(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.setWindowTitle("Schedule Scan")
self.setMinimumWidth(300)
self.setMinimumHeight(150)
layout = QVBoxLayout()
self.enable_radio = QRadioButton("Enable Schedule Scan")
self.disable_radio = QRadioButton("Disable Schedule Scan")
radio_layout = QHBoxLayout()
radio_layout.addWidget(self.enable_radio)
radio_layout.addWidget(self.disable_radio)
layout.addLayout(radio_layout)
# Button to open the schedule scan log file
self.open_log_button = QPushButton("Open Schedule Scan Log")
self.open_log_button.clicked.connect(self.open_schedule_scan_log)
layout.addWidget(self.open_log_button)
button_layout = QHBoxLayout()
self.ok_button = QPushButton("OK")
self.cancel_button = QPushButton("Cancel")
self.ok_button.clicked.connect(self.accept)
self.cancel_button.clicked.connect(self.reject)
button_layout.addWidget(self.ok_button)
button_layout.addWidget(self.cancel_button)
layout.addLayout(button_layout)
self.setLayout(layout)
def schedule_scan_selected_option(self):
if self.enable_radio.isChecked():
return "enable"
elif self.disable_radio.isChecked():
return "disable"
else:
return None
## THE class is in DEVELOPMENT. THE GUI LOGIN WILL BE SOON .
"""
class LoginApp(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("Mavoc Antivirus Login")
self.setGeometry(100, 100, 400, 200)
self.password_label = QLabel("Enter Password:")
self.password_input = QLineEdit()
self.login_button = QPushButton("Login")
layout = QVBoxLayout()
layout.addWidget(self.password_label)
layout.addWidget(self.password_input)
layout.addWidget(self.login_button)
self.setLayout(layout)
self.login_button.clicked.connect(self.check_password)
self.correct_password = "qwerty"
def check_password(self):
entered_password = self.password_input.text()
if entered_password == self.correct_password:
self.close() # Close the login window
self.run_antivirus_tool()
else:
self.show_wrong_password_message()
sys.exit()
def run_antivirus_tool(self):
# Your Mavoc Antivirus functionality logic goes here
msgbox = QMessageBox()
msgbox.setWindowTitle("Info from Smukx")
msgbox.setText("Welcome to Mavoc Antivitus")
msgbox.setFixedSize(400, 200)
msgbox.exec_()
#print("Welcome to Mavoc Antivirus!")
def show_wrong_password_message(self):
msg_box = QMessageBox()
msg_box.setWindowTitle("Wrong Password")
msg_box.setIcon(QMessageBox.Warning)
msg_box.setText("Incorrect password. Please try again.")
msg_box.exec_()
"""
## PASSWORD AUTH LOGIN !!
"""
class PasswordDialog(QtWidgets.QDialog):
def __init__(self, parent=None):
super(PasswordDialog, self).__init__(parent)
self.setWindowTitle("Enter Password")
self.setGeometry(200, 200, 200)
self.passwordLineEdit = QtWidgets.QLineEdit(self)
self.passwordLineEdit.setEchoMode(QtWidgets.QLineEdit.Password)
self.submitButton = QtWidgets.QPushButton("Submit", self)
self.connect(self.submitButton, QtCore.SIGNAL("clicked()"), self.onSubmitButtonClicked)
layout = QtWidgets.QHBoxLayout()
layout.addWidget(self.passwordLineEdit)
layout.addWidget(self.submitButton)
self.setLayout(layout)
def password_auth(self):
self.passwordLineEdit.clear()
self.submitButton.setText("Authenticate")
def onSubmitButtonClicked(self):
password = self.passwordLineEdit.text()
# Do something with the password here.
self.accept()
def password_auth():
app = QtWidgets.QApplication(sys.argv)
dialog = PasswordDialog()
dialog.password_auth()
dialog.show()
sys.exit(app.exec_())
"""
# PROGRAM FOR FULL MOUNTING USING psutil MODULE
#import psutil
### PSUTIL PROGRAM TO AUTOMOUNT ALL PARTITION
"""
def run_full_computer_scan(self):
self.status_text_edit.clear()
self.hash_text_edit.clear()
self.log("Running Full Computer Scan ...")
partitions = psutil.disk_partitions(all=True)
self.status("Scanning for malicious files...\n")
signature_hashes_md5 = set()
signature_hashes_sha256 = set()
with open("hashes/md5_hashes.txt", "r") as hash_file_md5, open("hashes/sha256_hashes.txt", "r") as hash_file_sha256:
for line_md5, line_sha256 in zip(hash_file_md5, hash_file_sha256):
signature_hashes_md5.add(line_md5.strip())
signature_hashes_sha256.add(line_sha256.strip())
virus_extensions = set()
with open("hashes/virus-extensions.txt", "r") as ext_file:
for line in ext_file:
virus_extensions.add(line.strip())
detected_malicious_files = []
for partition in partitions:
detected_malicious_files.extend(self.scan_directory_recursive(partition.mountpoint, signature_hashes_md5, signature_hashes_sha256, virus_extensions))
if detected_malicious_files:
self.log("Detected malicious files:\n")
self.hash_text_edit.insertPlainText("Hash Information:\n")
for file_info in detected_malicious_files:
file_path, checksum_md5, checksum_sha256, extension = file_info
self.log(f"File: {file_path}, Extension: {extension}\n")
self.hash_text_edit.insertPlainText(f"File: {file_path}\nMD5 Hash: {checksum_md5}\nSHA256 Hash: {checksum_sha256}\nExtension: {extension}\n\n")
self.confirm_and_remove_file(file_path, os.path.basename(file_path))
self.status("Malicious files detected. Review hash information.")
else:
self.log("No malicious files detected.\n")
self.status("No malicious files detected.")
self.log("\nFull Computer Scan completed.")
self.hash_text_edit.verticalScrollBar().setValue(self.hash_text_edit.verticalScrollBar().maximum())
"""
scan_alert = """
powershell.exe -Command "[void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('The Files are Scanning Do not intercept the process . Please Click OK to Continue . ', 'Mavoc Antivirus')
"""
class TextViewDialog(QDialog):
def __init__(self, title, content, parent=None):
super().__init__(parent)
self.setWindowTitle(title)
layout = QVBoxLayout(self)
text_browser = QTextBrowser(self)
text_browser.setPlainText(content)
layout.addWidget(text_browser)
close_button = QPushButton("Close", self)
close_button.clicked.connect(self.accept)
layout.addWidget(close_button)
self.setLayout(layout)
class MaliciousFilesDialog(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.setWindowTitle("Detected Malicious Files")
layout = QVBoxLayout()
self.text_browser = QTextBrowser(self)
layout.addWidget(self.text_browser)
self.setLayout(layout)
def set_malicious_files(self, files):
self.text_browser.setPlainText("\n".join(files))
# Progress bar to scan malicious files
class ScanThread(QThread):
progress_updated = pyqtSignal(int)
def __init__(self):
super().__init__()
self.stopped = False
def run(self):
total_files = 100 # Example total number of files to scan
for file_num in range(1, total_files + 1):
if self.stopped:
break
# Simulate scanning a file
self.progress_updated.emit(int(file_num * 100 / total_files))
self.msleep(100) # Simulate the scan process
class LoadingWindow(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("Scanning...")
self.setGeometry(100, 100, 300, 150)
layout = QVBoxLayout()
self.progress_bar = QProgressBar()
layout.addWidget(self.progress_bar)
self.cancel_button = QPushButton("Cancel")
self.cancel_button.clicked.connect(self.cancel_scan)
layout.addWidget(self.cancel_button)
self.setLayout(layout)
def set_progress(self, percentage):
self.progress_bar.setValue(percentage)
def cancel_scan(self):
self.parent_thread.stopped = True
self.close()
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.scan_thread = ScanThread()
self.loading_window = LoadingWindow()
self.loading_window.parent_thread = self.scan_thread
self.scan_thread.progress_updated.connect(self.loading_window.set_progress)
start_scan_button = QPushButton("Start Scan")
start_scan_button.clicked.connect(self.start_scan)
self.setCentralWidget(start_scan_button)
def start_scan(self):
self.loading_window.show()
self.scan_thread.start()
### ------------------------------------------------------------------------###
### MAIN CLASS STARTS HERE ###
### BE CAREFUL TO EDIT THIS CLASS ###
### THIS MAY HARM SYSTEM IF FILE CONFIGS ARE NOT PROPER ###
###-------------------------------------------------------------------------###
class AntivirusUI(QMainWindow):
def __init__(self):
super().__init__()
self.init_ui()
show_help_menu(self)
# self.detected_malicious_files = []
self.malicious_files_dialog = MaliciousFilesDialog(self)
## SHEDULE SCAN PROGRAM USING SUBPROCESS
self.start_schedule_scan_action = QAction("Start Schedule Scan", self)
self.start_schedule_scan_action.triggered.connect(self.start_schedule_scan)
self.addAction(self.start_schedule_scan_action)
def start_schedule_scan(self):
try:
# Start the CLI program as a subprocess
self.schedule_scan_process = subprocess.Popen([sys.executable, "schedule-scanning.py", "1"])
except Exception as e:
# Handle any exceptions if the subprocess fails to start
print(f"Failed to start the schedule scan: {str(e)}")
def closeEvent(self, event):
# This method is called when the GUI program is closed
# You can use it to terminate the subprocess and close the program gracefully
if hasattr(self, 'schedule_scan_process') and self.schedule_scan_process.poll() is None:
# If the subprocess is still running, terminate it
self.schedule_scan_process.terminate()
self.schedule_scan_process.wait()
event.accept() # Close the GUI program
## RUN WITH ADMIN PRIVILAGE
def run_with_elevated_privileges(command):
runas_command = ["runas", "/user:Administrator", "powershell", "-Command", command]
subprocess.run(runas_command, shell=True)
def run_as_admin():
if ctypes.windll.shell32.IsUserAnAdmin() == 0:
print("Requesting admin privileges...")
command = "Remove-Item -Path 'C:\\Path\\To\\Your\\Suspicious\\Files\\*' -Recurse -Force"
run_with_elevated_privileges(command)
else:
print("Running with admin privileges.")
def password_auth(self):
self.setWindowTitle("Mavoc Autherntication")
self.setGeometry(200,200.200,200)
def show_malicious_files(self, files):
self.malicious_files_dialog.set_malicious_files(files)
self.malicious_files_dialog.exec_()
## UI OF THE MAVOC-ANTIVIRUS
## MAIN BUTTONS
def init_ui(self):
self.setWindowTitle("Mavoc Antivirus")
self.setGeometry(200, 200, 1500, 750)
# Set background picture
background_label = QLabel(self)
pixmap = QPixmap("core\Mavoc antivirus.png")
background_label.setPixmap(pixmap)
background_label.setGeometry(0, 0, pixmap.width(), pixmap.height())
app_icon = QIcon("core\mavoc_icon.png")
self.setWindowIcon(app_icon)
# design elements
label = QLabel("", self)
label.setGeometry(280, 100, 200, 50)
label.setStyleSheet("color: white; ;font-family: monospace; font-size: 27px;text-shadow: 3px 3px 5px black;")
# Use QPushButton instead of QOpenGLWidget
scan_button = QPushButton(" Quick Scan", self)
# Set the size of the icon
scan_button.setIconSize(QSize(43, 43))
# Set the icon for the button
icon = QIcon("core\stopwatch.png")
scan_button.setIcon(icon)
scan_button.setGeometry(200, 110, 304, 120)
scan_button.setStyleSheet(
"QPushButton { border: 3px solid black; border-radius: 18px; background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #E8E8E8, stop: 1 #E8E8E8); color: #00008B; font-size: 23px; font-weight: bold; font-family: 'League Spartan', sans-serif; }"
"QPushButton:hover { background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #D9D9DD, stop: 1 #D9D9DD); }"
)
scan_button.clicked.connect(self.run_quick_scan)
# SHEDULE SCAN CHANGE
scan_button = QPushButton(" Schedule Scan", self)
# Set the size of the icon
scan_button.setIconSize(QSize(43, 43))
# Set the icon for the button
icon = QIcon("core\schedule.png")
scan_button.setIcon(icon)
scan_button.setGeometry(631, 110, 304, 120)
scan_button.setStyleSheet(
"QPushButton { border: 3px solid black; border-radius: 18px; background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #E8E8E8, stop: 1 #E8E8E8); color: #00008B; font-size: 23px; font-weight: bold; font-family: 'League Spartan', sans-serif; }"
"QPushButton:hover { background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #D9D9DD, stop: 1 #D9D9DD); }"
)
scan_button.clicked.connect(self.open_schedule_scan_log)
# Full Scan
fullscan_button = QPushButton(" Full Scan", self)
# Set the size of the icon
fullscan_button.setIconSize(QSize(43, 43))
# Set the icon for the button
icon = QIcon("core\error.png")
fullscan_button.setIcon(icon)
# Set the geometry for the button
fullscan_button.setGeometry(1050, 110, 304, 120)
# Set the stylesheet for the button
fullscan_button.setStyleSheet(
"QPushButton { border: 3px solid black; border-radius: 18px; background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #E8E8E8, stop: 1 #E8E8E8); color: #00008B; font-size: 23px; font-weight: bold; font-family: 'League Spartan', sans-serif; }"
"QPushButton:hover { background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #D9D9DD, stop: 1 #D9D9DD); }"
)
fullscan_button.clicked.connect(self.run_full_scan)
# NETWORK SCAN
network_security_button = QPushButton(" Network Protection", self)
# Set the size of the icon
network_security_button.setIconSize(QSize(43, 43))
# Set the icon for the button
icon = QIcon("core\globe-grid.png")
network_security_button.setIcon(icon)
# Set the geometry for the button
network_security_button.setGeometry(200, 260, 304, 120)
# Set the stylesheet for the button
network_security_button.setStyleSheet(
"QPushButton { border: 3px solid black; border-radius: 18px; background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #E8E8E8, stop: 1 #E8E8E8); color: #00008B; font-size: 23px; font-weight: bold; font-family: 'League Spartan', sans-serif; }"
"QPushButton:hover { background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #D9D9DD, stop: 1 #D9D9DD); }"
)
network_security_button.clicked.connect(self.show_network_protection_dialog)
# CLOUD SCAN
cloudbasedscan_button = QPushButton("Cloud Frim Scan", self)
# Set the size of the icon
cloudbasedscan_button.setIconSize(QSize(43, 43))
# Set the icon for the button
icon = QIcon("core\security.png")
cloudbasedscan_button.setIcon(icon)
# Set the geometry for the button
cloudbasedscan_button.setGeometry(631, 260, 304, 120)
# Set the stylesheet for the button
cloudbasedscan_button.setStyleSheet(
"QPushButton { border: 3px solid black; border-radius: 18px; background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #E8E8E8, stop: 1 #E8E8E8); color: #00008B; font-size: 23px; font-weight: bold; font-family: 'League Spartan', sans-serif; }"
"QPushButton:hover { background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #D9D9DD, stop: 1 #D9D9DD); }"
)
cloudbasedscan_button.clicked.connect(self.run_cloud_scan)
# CLEAN System
# Create a QPushButton widget for the clean system button
deltempfiles_button = QPushButton(" Clean System", self)
# Set the size of the icon
deltempfiles_button.setIconSize(QSize(43, 43))
# Set the icon for the button
icon = QIcon("core\system.png")
deltempfiles_button.setIcon(icon)
# Set the geometry for the button
deltempfiles_button.setGeometry(1050, 260, 304, 120)
# Set the stylesheet for the button
deltempfiles_button.setStyleSheet(
"QPushButton { border: 3px solid black; border-radius: 18px; background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #E8E8E8, stop: 1 #E8E8E8); color: #00008B; font-size: 23px; font-weight: bold; font-family: 'League Spartan', sans-serif; }"
"QPushButton:hover { background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #D9D9DD, stop: 1 #D9D9DD); }"
)
deltempfiles_button.clicked.connect(self.delete_temp_files)
## 1ST BLACK BOX CONTENT
self.hash_text_edit = QTextEdit(self)
self.hash_text_edit.setGeometry(200, 420, 500, 250)
# self.hash_text_edit.setStyleSheet(
# "background-color: lightgray; color: black; font-size: 14px;"
# )
self.hash_text_edit.setStyleSheet("border : 2px solid black; border-radius : 20px; background-color: #00008B; color: white; font-size: 18px; ")
### 2ND BLACK BOX CONTENT
self.status_text_edit = QTextEdit(self)
self.status_text_edit.setGeometry(850, 420, 500, 250)
self.status_text_edit.setStyleSheet(
"border : 2px solid black; border-radius : 20px; background-color: #00008B; color: white; font-size: 18px;"
)
# Add progress bar
self.show()
## Adding Bar
#### For File Menu
menu_bar = self.menuBar()
file_menu = menu_bar.addMenu("Files")
add_menu_md5 = QAction("Add Single MD5 Hash", self)
add_menu_sha = QAction("Add Single SHA-256 Hash", self)
view_menu_md5 = QAction("View MD5 DB", self)
view_menu_sha = QAction("View SHA256 DB",self)
add_file_md5 = QAction("Add MD5 File", self)
add_file_sha = QAction("Add SHA256 File", self)
add_menu_md5.triggered.connect(self.add_md5_to_database)
add_menu_sha.triggered.connect(self.add_sha256_to_database)
view_menu_md5.triggered.connect(self.view_md5_database)
view_menu_sha.triggered.connect(self.view_sha256_database)
add_file_md5.triggered.connect(self.add_md5_database)
add_file_sha.triggered.connect(self.add_sha256_database)
file_menu.addAction(add_menu_md5)
file_menu.addAction(add_menu_sha)
file_menu.addAction(add_file_md5)
file_menu.addAction(add_file_sha)
file_menu.addAction(view_menu_md5)
file_menu.addAction(view_menu_sha)
## For Special Options !
options_menu = menu_bar.addMenu("Options")
update_menu = QAction("Update", self)
add_menu = QAction("Contact", self)
view_logs = QAction("View Logs", self)
update_menu.triggered.connect(self.update_info)
add_menu.triggered.connect(self.contact_info)
view_logs.triggered.connect(self.view_hash)
options_menu.addAction(update_menu)
options_menu.addAction(add_menu)
options_menu.addAction(view_logs)
## For File Menu !
help_menu = menu_bar.addMenu("Help")
about_action = QAction("Info", self)
about_help = QAction("Help", self)
summary_guide = QAction("Summary",self)
about_action.triggered.connect(self.show_about_dialog)
about_help.triggered.connect(self.show_help_menu)
summary_guide.triggered.connect(self.summary_page)
help_menu.addAction(about_action)
help_menu.addAction(about_help)
help_menu.addAction(summary_guide)
## LOG VIEWER
log_analysis = menu_bar.addMenu("Logs")
log_quick_recursive = QAction("Quick Scan Logs", self)
log_non_recursive = QAction("Partition Scan Log", self)
log_cloud_scan = QAction("Cloud Logs", self)
log_shedule_scan = QAction("Scheduled Logs", self)
log_quick_recursive.triggered.connect(self.quickscan_logs)
log_non_recursive.triggered.connect(self.non_recursive_logs)
log_cloud_scan.triggered.connect(self.cloud_logs)
log_shedule_scan.triggered.connect(self.shedule_logs)
log_analysis.addAction(log_quick_recursive)
log_analysis.addAction(log_non_recursive)
log_analysis.addAction(log_cloud_scan)
log_analysis.addAction(log_shedule_scan)
self.show()
def contact_info(self):
contact_box = """
<h3> Contact of Creators</h3>
Smukx -> <b> Framework and Core Creator </b>
"""
QMessageBox.about(self, "Mavoc Help" , contact_box)
def update_info(self):
self.log("Updating Database ...\n")
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
self.log(f"Current Update : {current_time}\n")
script_directory = os.path.dirname(os.path.abspath(__file__))
os.system('powershell.exe ./update_database.ps1')
os.system('msg * Database Updated Successfully')
update_box = f"""
<center><h3> Database Info</h3></center><br>\n
Database Update Date {current_time}\n
<b> Antivirus Version 1.0.0 </b><br>
"""
time.sleep(0.8)
QMessageBox.about(self, "Database Update" , update_box )
# def view_hash(self):
# log_history = self.read_file_content("log-file.txt")
# self.show_text_dialog("Log History", log_history )
# SUMMARY OPENING PAGE BOX
def summary_page(self):
os.system("powershell.exe Start-Process https://github.com/Whitecat18/Mavoc-Antivirus")
# QUICK SCAN VIEW BUTTONS
def view_hash(self):
log_history = self.read_file_content("logfiles/log-file-nonrecursive-quick-scan.txt")
dialog = QDialog(self)
dialog.setWindowTitle("Quick Scan Result")
dialog.setGeometry(100, 100, 800, 600)
text_edit = QTextEdit(dialog)
text_edit.setPlainText(log_history)
text_edit.setFontPointSize(15) # Set the font size to 12 (customize as needed)
text_edit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
layout = QVBoxLayout()
layout.addWidget(text_edit)
close_button = QPushButton("Close", dialog)
close_button.clicked.connect(dialog.close)
layout.addWidget(close_button)
dialog.setLayout(layout)
dialog.exec_()
def quickscan_logs(self):
log_history = self.read_file_content("logfiles/log-file-nonrecursive-quick-scan.txt")
dialog = QDialog(self)
dialog.setWindowTitle("Quick Scan Result")
dialog.setGeometry(100, 100, 800, 600)
text_edit = QTextEdit(dialog)
text_edit.setPlainText(log_history)
text_edit.setFontPointSize(15) # Set the font size to 12 (customize as needed)
text_edit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
layout = QVBoxLayout()
layout.addWidget(text_edit)
close_button = QPushButton("Close", dialog)
close_button.clicked.connect(dialog.close)
layout.addWidget(close_button)
dialog.setLayout(layout)
dialog.exec_()
# LOG VIEWER BUTTON MODULES !
def non_recursive_logs(self):
log_history = self.read_file_content("logfiles/log-file.txt")
dialog = QDialog(self)
dialog.setWindowTitle("Partition Scan Result")
dialog.setGeometry(100, 100, 800, 600)
text_edit = QTextEdit(dialog)
text_edit.setPlainText(log_history)
text_edit.setFontPointSize(15) # Set the font size to 12 (customize as needed)
text_edit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
layout = QVBoxLayout()
layout.addWidget(text_edit)
close_button = QPushButton("Close", dialog)
close_button.clicked.connect(dialog.close)
layout.addWidget(close_button)
dialog.setLayout(layout)
dialog.exec_()
# CLOUD LOG VIEWER
def cloud_logs(self):
log_history = self.read_file_content("logfiles/log-file-cloud-scan.txt")
dialog = QDialog(self)
dialog.setWindowTitle("Cloud Log Result")
dialog.setGeometry(100, 100, 800, 600)
text_edit = QTextEdit(dialog)
text_edit.setPlainText(log_history)
text_edit.setFontPointSize(15) # Set the font size to 12 (customize as needed)
text_edit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
layout = QVBoxLayout()
layout.addWidget(text_edit)
close_button = QPushButton("Close", dialog)
close_button.clicked.connect(dialog.close)
layout.addWidget(close_button)
dialog.setLayout(layout)
dialog.exec_()
# SHEDULE SCAN LOG VIEWER
def shedule_logs(self):
log_history = self.read_file_content("logfiles/schedule-log.txt")
dialog = QDialog(self)
dialog.setWindowTitle("Shedule Scan Log")
dialog.setGeometry(100, 100, 800, 600)
text_edit = QTextEdit(dialog)
text_edit.setPlainText(log_history)
text_edit.setFontPointSize(15) # Set the font size to 12 (customize as needed)
text_edit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
layout = QVBoxLayout()
layout.addWidget(text_edit)