This commit is contained in:
Luftmensch
2026-08-26 14:11:37 +07:00
commit e528419f9a
135 changed files with 413970 additions and 0 deletions
+155
View File
@@ -0,0 +1,155 @@
import os
import sys
from colorama import Fore
from platform import system
from PyQt5 import uic
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPalette, QColor
from PyQt5.QtWidgets import QInputDialog, QLineEdit, QStyleFactory, QDesktopWidget
from PyQt5.QtWidgets import QMainWindow, QApplication, QMessageBox, QFileDialog
import audit_decryption
# Application root location ↓
if system() == "Windows":
appFolder = os.path.dirname(os.path.realpath(sys.argv[0])) + "\\"
elif system() == "Linux":
appFolder = os.path.dirname(os.path.realpath(sys.argv[0])) + "//"
class App(QMainWindow):
def __init__(self):
"""Constructor."""
super(App, self).__init__()
uic.loadUi(appFolder + "ImaP.ui", self) # Load the UI(User Interface) file.
self.makeWindowCenter()
self.run_system() # main operating function of this GUI FIle
# Status Bar Message
self.statusBar().showMessage("Convert txt to excel.")
self.setWindowTitle("Convert Excel Windows Hardening Audit")
QMessageBox.information(self, "Warning!", "You have to add the 1st file is a .xlsx checklist file, 2nd file is "
"config.json, and then the list of .txt.enc files!")
def makeWindowCenter(self):
"""For launching windows in center."""
qtRectangle = self.frameGeometry()
centerPoint = QDesktopWidget().availableGeometry().center()
qtRectangle.moveCenter(centerPoint)
self.move(qtRectangle.topLeft())
def run_system(self):
"""Main load function"""
# self.pushButton.clicked.connect(self.add_folder_button_on_click)
self.pushButton_add.clicked.connect(self.add_images_button_on_click)
self.pushButton_remove.clicked.connect(self.remove_button_on_click)
self.pushButton_up.clicked.connect(self.up_button_on_click)
self.pushButton_down.clicked.connect(self.down_button_on_click)
self.pushButton_make_pdf.clicked.connect(self.make_pdf_button_on_click)
self.pushButton_clear.clicked.connect(self.clear_button_on_click)
def add_images_button_on_click(self):
file_names, _ = QFileDialog.getOpenFileNames(self, "Open Files") # Cho phép chọn nhiều file
if file_names: # Kiểm tra nếu có file được chọn
for file_name in file_names:
next_row = self.listWidget.count()
self.listWidget.insertItem(next_row, file_name)
def remove_button_on_click(self):
current_row = self.listWidget.currentRow()
item = self.listWidget.item(current_row)
if item is None:
pass
else:
get_reply = QMessageBox.question(self, "Remove An txt File", "Do you want to remove " + str(item.text())
+ " from the list?", QMessageBox.Yes | QMessageBox.No)
if get_reply == QMessageBox.Yes:
element = self.listWidget.takeItem(current_row)
del element
else:
pass
def up_button_on_click(self):
current_row = self.listWidget.currentRow()
if current_row >= 1:
item = self.listWidget.takeItem(current_row)
self.listWidget.insertItem(current_row - 1, item)
self.listWidget.setCurrentItem(item)
def down_button_on_click(self):
current_row = self.listWidget.currentRow()
if current_row < self.listWidget.count() - 1:
item = self.listWidget.takeItem(current_row)
self.listWidget.insertItem(current_row + 1, item)
self.listWidget.setCurrentItem(item)
def clear_button_on_click(self):
reply = QMessageBox.question(self, "Clear List Box", "Do you want to clear all the selections?",
QMessageBox.Yes | QMessageBox.No)
if reply == QMessageBox.Yes:
self.listWidget.clear()
def make_pdf_button_on_click(self):
print(Fore.BLUE + r"""
_ _ _____ _____ _______ _ _ _____ _____ ______ _ _ _____ _ _ _____
/\ | | | | __ \_ _|__ __| | | | | /\ | __ \| __ \| ____| \ | |_ _| \ | |/ ____|
/ \ | | | | | | || | | | ______ | |__| | / \ | |__) | | | | |__ | \| | | | | \| | | __
/ /\ \| | | | | | || | | | |______| | __ | / /\ \ | _ /| | | | __| | . ` | | | | . ` | | |_ |
/ ____ \ |__| | |__| || |_ | | | | | |/ ____ \| | \ \| |__| | |____| |\ |_| |_| |\ | |__| |
/_/ \_\____/|_____/_____| |_| |_| |_/_/ \_\_| \_\_____/|______|_| \_|_____|_| \_|\_____|
""" + Fore.RESET)
if self.listWidget.count() == 0:
reply = QMessageBox.information(self, "Warning!", "List box is empty! Add files to list box first.",
QMessageBox.Ok)
elif ".xlsx" not in str(self.listWidget.item(0).text()) or ".json" not in str(self.listWidget.item(1).text()):
reply = QMessageBox.information(self, "Warning!", "You have to add the 1st file is a .xlsx checklist "
"file, 2nd file is config.json, and then the list of "
".txt.enc files!",
QMessageBox.Ok)
else:
items_list = []
for i in range(2, self.listWidget.count()):
items_list.append(str(self.listWidget.item(i).text()))
for f in items_list:
audit_decryption.run_generate_excel(str(self.listWidget.item(0).text()), str(self.listWidget.item(1).text()), f)
last_reply = QMessageBox.information(self, "Done!", "Your Report Excel is ready! "
"Go to your folder to read "
"the excel.", QMessageBox.Ok)
if last_reply == QMessageBox.Ok:
pass
else:
return
if __name__ == '__main__':
app = QApplication(sys.argv)
app.setStyle(QStyleFactory.create("Fusion"))
darkPalette = QPalette()
darkColor = QColor(45, 45, 45)
disabledColor = QColor(127, 127, 127)
darkPalette.setColor(QPalette.Window, darkColor)
darkPalette.setColor(QPalette.WindowText, Qt.white)
darkPalette.setColor(QPalette.Base, QColor(40, 40, 40))
darkPalette.setColor(QPalette.AlternateBase, darkColor)
darkPalette.setColor(QPalette.ToolTipBase, Qt.white)
darkPalette.setColor(QPalette.ToolTipText, Qt.white)
darkPalette.setColor(QPalette.Text, Qt.white)
darkPalette.setColor(QPalette.Disabled, QPalette.Text, disabledColor)
darkPalette.setColor(QPalette.Button, darkColor)
darkPalette.setColor(QPalette.ButtonText, Qt.white)
darkPalette.setColor(QPalette.Disabled, QPalette.ButtonText, disabledColor)
darkPalette.setColor(QPalette.BrightText, Qt.red)
darkPalette.setColor(QPalette.Link, QColor(42, 130, 218))
darkPalette.setColor(QPalette.Highlight, QColor(42, 130, 218))
darkPalette.setColor(QPalette.HighlightedText, Qt.black)
darkPalette.setColor(QPalette.Disabled, QPalette.HighlightedText, disabledColor)
app.setPalette(darkPalette)
app.setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }")
run_main = App() # Instantiate The App() class
run_main.show()
sys.exit(app.exec_())