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)