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 30 31
| input = [0x17, 0x63, 0x77, 0x03, 0x52, 0x2E, 0x4A, 0x28, 0x52, 0x1B, 0x17, 0x12, 0x3A, 0x0A, 0x6C, 0x62]
def add(a, b): input[a] -= b
def xor(a, b): input[a] ^= input[b]
def sub(a, b): # maybe_input1.append(input[a] + input[b]) # maybe_input2.append(input[b] - input[a]) input[a] = abs(input[a] - input[b]) # 因为abs有两种可能性,全取这种可能得到的flag最正常
key = "MLGPOKFCJENIHDBA" opcode = [1, 2, 1, 3, 2, 3, 1, 2, 3, 3, 2, 3, 2, 1] # 1表示加密中的add, 2表示xor, 3表示sub a1 = [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 14, 15] # 第一个参数 a2 = [10, 2, 7, 7, 5, 1, 3, 7, 8, 7, 12, 2, 15, 2] # 第二个参数
for i in range(13, -1, -1): if opcode[i] == 1: add(a1[i], a2[i]) elif opcode[i] == 2: xor(a1[i], a2[i]) elif opcode[i] == 3: sub(a1[i], a2[i])
for i in range(16): input[i] ^= ord(key[i])
for i in input: print(chr(i), end = '')
|