Created
March 31, 2013 19:51
-
-
Save steeve85/5281785 to your computer and use it in GitHub Desktop.
xor algo used in an APT1 sample
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
#!/usr/bin/python | |
# encoded data | |
encoded = [] | |
encoded.append([0x2D, 0xC8, 0xD4, 0xDD, 0xCF, 0xCC, 0xDA, 0xC9, 0xDE, 0xC7, 0xD6, 0xF2, 0xF8, 0xE9, 0xF4, 0xE8, 0xF4, 0xFD, 0xEF, 0xC7, 0xCC, 0xF2, 0xF5, 0xFF, 0xF4, 0xEC, 0xE8, 0xC7, 0xD8, 0xEE, 0xE9, 0xE9, 0xFE, 0xF5, 0xEF, 0xCD, 0xFE, 0xE9, 0xE8, 0xF2, 0xF4, 0xF5, 0xC7, 0xC9, 0xEE, 0xF5, 0xB6, 0x00]) | |
encoded.append([0x08, 0x21, 0x0F, 0x39, 0x1C, 0x08, 0x0D, 0x18, 0x09, 0x64, 0x00]) | |
encoded.append([0x26, 0xB2, 0xAE, 0xAE, 0xAA, 0xE0, 0xF5, 0xF5, 0xE8, 0xEB, 0xEC, 0xF4, 0xEB, 0xEF, 0xF4, 0xE8, 0xEB, 0xEA, 0xF4, 0xEC, 0xE2, 0xF5, 0xEB, 0xE3, 0xED, 0xF4, 0xEB, 0xF4, 0xEB, 0xEC, 0xF4, 0xE9, 0x85, 0xED, 0xF4, 0xB2, 0xAE, 0xB7, 0xB6, 0xFC, 0x0, 0x0]) | |
encoded.append([0x32, 0x3D, 0x1F, 0x0A, 0x19, 0x1C, 0x1C, 0x11, 0x5F, 0x44, 0x5E, 0x40, 0x50, 0x58, 0x13, 0x1F, 0x1D, 0x00, 0x11, 0x04, 0x19, 0x12, 0x1C, 0x15, 0x4B, 0x50, 0x3D, 0x23, 0x39, 0x35, 0x50, 0x46, 0x5E, 0x40, 0x4B, 0x50, 0x27, 0x19, 0x1E, 0x14, 0x1F, 0x07, 0x03, 0x50, 0x3E, 0x24, 0x50, 0x45, 0x5E, 0x41, 0x59, 0x42, 0x00]) | |
encoded.append([0x0C, 0x48, 0x55, 0x59, 0x59, 0x54, 0x30, 0x3B, 0x37, 0x3C, 0x20, 0x39, 0x38, 0x78, 0x00]) | |
encoded.append([0x04, 0x70, 0x7D, 0x7D, 0x6E, 0x54, 0x00]) | |
encoded.append([0x05, 0x32, 0x06, 0x00, 0x1C, 0x05, 0x76, 0x00]) | |
encoded.append([0x06, 0xD3, 0xE7, 0xE6, 0xFA, 0xFD, 0xE0, 0x94, 0x00]) | |
encoded.append([0x07, 0xF9, 0xE5, 0xE5, 0xE1, 0xAB, 0xBE, 0xBE, 0x96, 0x00]) | |
encoded.append([0x03, 0xD5, 0xC8, 0xD5, 0xB3, 0x00]) | |
def decode_data(encoded): | |
decoded = [0] * 0x100 | |
char = encoded[0] | |
xor_char = encoded[char+1] ^ char | |
i = 0 | |
while i < char: | |
decoded[i] = encoded[i+1] ^ xor_char | |
i += 1 | |
res = "" | |
for j in decoded: | |
res += chr(j) | |
print "%s : %s"% (encoded, res) | |
for e in encoded: | |
decode_data(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment