adworld [rev] babymips

adworld [rev] babymips

简单的暴力题,直接上脚本:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
secret = [
0x51, 0x7c, 0x6a, 0x7b, 0x67, 0x52, 0xFD, 0x16,
0xA4, 0x89, 0xBD, 0x92, 0x80, 0x13, 0x41, 0x54,
0xA0, 0x8D, 0x45, 0x18, 0x81, 0xDE, 0xFC, 0x95,
0xF0, 0x16, 0x79, 0x1A, 0x15, 0x5B, 0x75, 0x1F
]

flag = []
# qctf{ReA11y_4_B@89_mlp5_4_XmAn_}
for i in range(32):
if i < 5:
flag.append(secret[i] ^ (32 - i))
else:
if i & 1 == 1:
flag.append((((secret[i] << 2) | (secret[i] >> 6)) ^ (32 - i)) & 0xff)
else:
for j in range(1, 127):
tmp = j
tmp ^= 32 - i
tmp &= 0xff
tmp = (4 * tmp) | (tmp >> 6)
tmp &= 0xff
if tmp == secret[i]:
flag.append(j)
break

print(len(secret))
print(len(flag))
print(''.join(list(map(chr, flag))))