查壳,拖入64位IDA
LOBYTE8位就是一个字节,在此处无意义,因为我们输入的本来就是按字节输入的
设 a = byte_414040,b=dword_40F040,c=byte_40F0E0,输入的字符串为flag;
从题目里得到 加密代码
a[i] = flag[b[i]];
a[i] ^= b[i];
c == a
即c[i] = a[i] ^ b[i]
解密就反过来 ,因为a是不知道的,所以就先解除a
a = a ^ b 即 a = c ^ b
然后 flag[b[i]] = a[i]
b = [0x9, 0x0A, 0x0F, 0x17, 0x7, 0x18, 0x0C, 0x6, 0x1, 0x10, 0x3, 0x11, 0x20, 0x1D, 0x0B, 0x1E, 0x1B, 0x16, 0x4, 0x0D, 0x13, 0x14, 0x15, 0x2, 0x19, 0x5, 0x1F, 0x8, 0x12, 0x1A, 0x1C, 0x0E, 0]
a = [0x67, 0x79, 0x7B, 0x7F, 0x75, 0x2B, 0x3C, 0x52, 0x53, 0x79, 0x57, 0x5E, 0x5D, 0x42, 0x7B, 0x2D, 0x2A, 0x66, 0x42, 0x7E, 0x4C, 0x57, 0x79, 0x41, 0x6B, 0x7E, 0x65, 0x3C, 0x5C, 0x45, 0x6F, 0x62, 0x4D]
flag = [0]*33
for i in range(len(b)):
a[i] ^= b[i]
for i in range(len(b)):
flag[b[i]] = a[i]
print (''.join([chr(x) for x in flag]))