Last active
April 26, 2016 17:58
-
-
Save tqkve/3bdceffa8fb66b564168a69251c39a4a to your computer and use it in GitHub Desktop.
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
| from Crypto.Cipher import AES | |
| arr = [146, 108, 15, 234, 5, 175, 214, 95, 89, 49, 210, 154, 156, 107, 63, 156,153, 221, 77, 116, 82, 151, 18, 214, 136, 34, 18, 174, 172, 217, 53, 29] | |
| cmp = [40, 164, 61, 120, 84, 234, 165, 53, 142, 239, 147, 112, 88, 228, 226, 148] | |
| key = bytearray(16) | |
| j = 0 | |
| for i in xrange(len(arr)): | |
| if i % 2 == 0: | |
| key[j] = arr[i] + 2 | |
| j += 1 | |
| for i in xrange(len(cmp)): | |
| if i % 3 == 0: | |
| cmp[i] += i | |
| else: | |
| if cmp[i] % 3 == 0: | |
| cmp[i] /= 3 | |
| elif (cmp[i] + 256) % 3 == 0: | |
| cmp[i] = (cmp[i] + 256) / 3 | |
| elif (cmp[i] - 256) % 3 == 0: | |
| cmp[i] = ((cmp[i] - 256) / 3) & 0xff | |
| for i in xrange(len(cmp)): | |
| if i % 2 == 0: | |
| cmp[i] += 9 | |
| else: | |
| cmp[i] -= 6 | |
| cipher = AES.new(str(key), AES.MODE_ECB) | |
| ciphertext = ''.join([chr(x) for x in cmp]) | |
| flag = cipher.decrypt(ciphertext) | |
| padding = ord(flag[-1]) | |
| print flag[:-padding] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment