Created
October 21, 2016 09:54
-
-
Save msm-code/40091e15ec2ac43c0c94c5b5cfa8055d to your computer and use it in GitHub Desktop.
paper.python.216d5b6e2e17f913cd9d692ad17a7f4a
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
| def nymaim_config_crypt(self, mem, ndx): | |
| """decrypt final config (read keys and length and decrypt raw data)""" | |
| key0 = mem.dword(ndx) | |
| key1 = mem.dword(ndx+4) | |
| len = mem.dword(ndx+8) | |
| raw = mem.read(ndx + 12, len) | |
| prev_chr = 0 | |
| result = '' | |
| for i, c in enumerate(raw): | |
| bl = ((key0 & 0x000000FF) + prev_chr) & 0xFF | |
| key0 = (key0 & 0xFFFFFF00) + bl | |
| prev_chr = ord(c) ^ bl | |
| result += chr(prev_chr) | |
| key0 = (key0 + key1) & 0xFFFFFFFF | |
| key0 = ((key0 & 0x00FFFFFF) << 8) + ((key0 & 0xFF000000) >> 24) | |
| return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment