refactor: remove DecoderStyles enum

This commit is contained in:
Dobin Rutishauser
2024-06-25 09:41:14 +02:00
parent 68d1e1a535
commit 185c8fadb7
10 changed files with 19 additions and 36 deletions
+4 -4
View File
@@ -25,15 +25,15 @@ def asm_to_shellcode(asm_in: FilePath, build_exe: FilePath) -> bytes:
return code
def encode_payload(payload: bytes, decoder_style: DecoderStyle) -> bytes:
if decoder_style == DecoderStyle.PLAIN_1:
def encode_payload(payload: bytes, decoder_style: str) -> bytes:
if decoder_style == "plain":
return bytes(payload)
elif decoder_style == DecoderStyle.XOR_1:
elif decoder_style == "xor_1":
xor_key = config.xor_key
logger.info("---[ XOR payload with key 0x{:X}".format(xor_key))
xored = bytes([byte ^ xor_key for byte in payload])
return bytes(xored)
elif decoder_style == DecoderStyle.XOR_2:
elif decoder_style == "xor_2":
xor_key = config.xor_key2
logger.info("---[ XOR2 payload with key {}".format(xor_key))
xored = bytearray(payload)
-1
View File
@@ -83,7 +83,6 @@ class Injector():
# Patch IAT (if necessary and wanted)
self.injectable_patch_iat()
# DEL BOTH
carrier_shc_len = len(self.carrier_shc)
carrier_offset: int = 0 # file offset
+1 -1
View File
@@ -47,7 +47,7 @@ def create_c_from_template(settings: Settings, payload_len: int):
# Plugin: Decoder
filepath_decoder = PATH_DECODER + "{}.c".format(
settings.decoder_style.value)
settings.decoder_style)
with open(filepath_decoder, "r", encoding='utf-8') as file:
plugin_decoder = file.read()
plugin_decoder = Template(plugin_decoder).render({