mirror of
https://github.com/dobin/SuperMega
synced 2026-06-03 01:27:11 +00:00
feature: 2-byte xor key
This commit is contained in:
@@ -46,5 +46,12 @@ def encode_payload(payload: bytes, decoder_style: DecoderStyle) -> bytes:
|
||||
logger.info("---[ XOR payload with key 0x{:X}".format(xor_key))
|
||||
xored = bytes([byte ^ xor_key for byte in payload])
|
||||
return xored
|
||||
elif decoder_style == DecoderStyle.XOR_2:
|
||||
xor_key = config.xor_key2
|
||||
logger.info("---[ XOR2 payload with key {}".format(xor_key))
|
||||
xored = bytearray(payload)
|
||||
for i in range(len(xored)):
|
||||
xored[i] ^= xor_key[i % 2]
|
||||
return xored
|
||||
else:
|
||||
raise Exception("Unknown decoder style")
|
||||
|
||||
@@ -34,6 +34,7 @@ def create_c_from_template(settings: Settings, payload_len: int):
|
||||
plugin_decoder = Template(plugin_decoder).render({
|
||||
'PAYLOAD_LEN': payload_len,
|
||||
'XOR_KEY': config.xor_key,
|
||||
'XOR_KEY2': ascii_to_hex_bytes(config.xor_key2),
|
||||
})
|
||||
|
||||
# Choose correct template
|
||||
|
||||
Reference in New Issue
Block a user