Created
March 22, 2023 16:22
-
-
Save albertzsigovits/5c919d0f614dea5c19f6a0d4319be370 to your computer and use it in GitHub Desktop.
Python general malware decryptor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument("file_path", help="path to input file") | |
args = parser.parse_args() | |
KEY_OFFSET = 0x5000 | |
DATA_OFFSET = 0x15000 | |
KEY_SIZE = 8 | |
DATA_SIZE = 256 | |
# Open the file and extract the key and data | |
with open(args.file_path, "rb") as f: | |
f.seek(KEY_OFFSET) | |
key = f.read(KEY_SIZE) | |
f.seek(DATA_OFFSET) | |
data = f.read(DATA_SIZE) | |
# Decrypt the data using the key | |
decrypted_data = bytearray(DATA_SIZE) | |
for i in range(DATA_SIZE): | |
decrypted_data[i] = data[i] ^ key[i % KEY_SIZE] | |
# Print the results | |
print("Decryption key:", key.hex()) | |
print("Original data:", data.hex()) | |
print("Decrypted data:", decrypted_data.hex()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment