31 lines
770 B
Python
Executable File
31 lines
770 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import sys
|
|
|
|
KEY = (
|
|
b"\x2B\x5F\x52\x17\x05\x56\x41\x37\x38\x75\x01\x44\x5E\x06\x6C\x27\x09"
|
|
b"\x50\x41\x11\x18\x78\x56\x0D\x33\x0B\x07\x4C\x58\x0B\x07\x4C\x5F\x0B"
|
|
b"\x0A\x40\x59\x0B\x00\x40\x55\x0B\x06"
|
|
)
|
|
|
|
def decrypt(hex_string):
|
|
# Convert hex dump to bytes
|
|
encrypted_bytes = bytes.fromhex(hex_string.replace(" ", "").replace("\n", ""))
|
|
|
|
decrypted = []
|
|
key_len = len(KEY)
|
|
|
|
# Rolling XOR Logic (matches Rust sub_D7B0)
|
|
for i, byte in enumerate(encrypted_bytes):
|
|
k = KEY[i % key_len]
|
|
decrypted.append(byte ^ k)
|
|
|
|
result_bytes = bytes(decrypted)
|
|
|
|
print(result_bytes.decode('utf-8'))
|
|
|
|
if len(sys.argv) != 2:
|
|
print("pass decrypt text as hexstring")
|
|
|
|
decrypt(sys.argv[1])
|