refactor: remove source_style enum, do it with directories

This commit is contained in:
Dobin
2024-05-19 10:33:06 +01:00
parent 32000b5b78
commit 849df50dc8
11 changed files with 110 additions and 119 deletions
-2
View File
@@ -12,8 +12,6 @@ PATH_EXES = "data/binary/exes/"
PATH_EXES_MORE = "data/binary/exes_more/"
PATH_SHELLCODES = "data/binary/shellcodes/"
PATH_CARRIER = "data/source/carrier/"
PATH_PEB_WALK = "data/source/carrier/peb_walk/"
PATH_IAT_REUSE = "data/source/carrier/iat_reuse/"
PATH_PAYLOAD = "data/source/payload/"
PATH_DECODER = "data/source/carrier/decoder/"
+1
View File
@@ -5,6 +5,7 @@ from model.defs import *
logger = logging.getLogger("Payload")
class Payload():
def __init__(self, filepath: FilePath):
self.payload_path: FilePath = filepath
+4 -1
View File
@@ -34,9 +34,12 @@ class Project():
def prepare_project(project_name, settings):
src = "{}{}/".format(PATH_CARRIER, settings.source_style.value)
src = "{}{}/".format(PATH_CARRIER, settings.carrier_name)
dst = "{}{}/".format(PATH_WEB_PROJECT, project_name)
if not os.path.exists(dst):
os.makedirs(dst)
# delete all files in dst directory
for file in os.listdir(dst):
if file == "project.pickle":
+5 -5
View File
@@ -5,11 +5,12 @@ logger = logging.getLogger("Views")
class Settings():
def __init__(self):
def __init__(self, project_name: str = "default"):
self.project_name = project_name
self.payload_path: FilePath = ""
# Settings
self.source_style: FunctionInvokeStyle = FunctionInvokeStyle.peb_walk
self.carrier_name: str = ""
self.decoder_style: DecoderStyle = DecoderStyle.XOR_1
self.short_call_patching: bool = False
@@ -34,9 +35,8 @@ class Settings():
self.payload_location = PayloadLocation.DATA
def prep_web(self, project_name):
self.main_dir = "{}{}/".format(PATH_WEB_PROJECT, project_name)
self.template_path = self.main_dir + "template.c"
def prep_web(self):
self.main_dir = "{}{}/".format(PATH_WEB_PROJECT, self.project_name)
self.main_c_path = self.main_dir + "main.c"
self.main_asm_path = self.main_dir + "main.asm"
self.main_exe_path = self.main_dir + "main.exe"