Created
February 1, 2020 20:26
-
-
Save pawlos/9b77d9f32fe3339dc3739f2743144c59 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
a = [0x2a,0x7c,0x2d,0x49,0x66,0x6e,0x71,0x32, | |
0x30,0x21,0x20,0x0a,0x41,0x5a,0x64,0x24, | |
0x72,0x3c,0x58,0x6f,0x5c,0x44,0x2f,0x7b, | |
0x4b,0x43,0x7e,0x61,0x34,0x54,0x7a,0x37, | |
0x29,0x59,0x5e,0x3a,0x78,0x60,0x0b,0x7d, | |
0x53,0x73,0x31,0x79,0x4f,0x6d,0x69,0x76, | |
0x23,0x0d,0x25,0x5d,0x40,0x5b,0x5f,0x4e, | |
0x28,0x48,0x6a,0x2c,0x56,0x51,0x75,0x67] | |
finals = [ | |
0x34,0x60,0x51,0x25,0x41,0x5f,0x41,0x23, | |
0x54,0x3a,0x5a,0x25,0x41,0x2f,0x48,0x7d, | |
0x7b,0x25,0x6d,0x53,0x41,0x5b,0x51,0xb, | |
] | |
import string | |
import itertools | |
alphabet = string.ascii_lowercase + string.digits + '_+' | |
def find_chars(finals): | |
#print(finals) | |
for x,y,z in itertools.product(string.printable, repeat=3): | |
if finals[0] != a[ord(x) >> 2]: | |
continue | |
second = (ord(y) >> 4) | ((ord(x) & 3) << 4) | |
if finals[1] != a[second]: | |
continue | |
third = (ord(z) >> 6) | ((ord(y) & 0xf) << 2) | |
if finals[2] != a[third]: | |
continue | |
if finals[3] != a[(ord(z) & 0x3f)]: | |
continue | |
return ''.join([x,y,z]) | |
flag = [] | |
for i in range(len(finals)/4): | |
flag.append(find_chars(finals[i*4:(i+1)*4])) | |
print(''.join(flag)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment