1. 程式人生 > 實用技巧 >BUU-[RoarCTF2019]polyre

BUU-[RoarCTF2019]polyre

指令碼取自https://github.com/cq674350529/deflat

首先去平坦化

然後去虛假控制流

之後逆向舉行了

主要是瞭解一下平坦化和虛假控制流

import libnum
#unk_402170的前0x30個值
a = [
    0x96,0x62,0x53,0x43,0x6D,0xF2,0x8F,0xBC,
    0x16,0xEE,0x30,0x05,0x78,0x00,0x01,0x52,
    0xEC,0x08,0x5F,0x93,0xEA,0xB5,0xC0,0x4D,
    0x50,0xF4,0x53,0xD8,0xAF,0x90,0x2B,0x34,
    0x81,0x36,0x2C,0xAA,0xBC,0x0E,0x25,0x8B,
    0xE4,0x8A,0xC6,0xA2,0x81,0x9F,0x75,0x55
   ]
def decode(s): for _ in range(64): if s&1 == 0: s //= 2 # print(chr(s),end=' ' ) else: s ^= 0xB0004B7679FA26B3 s //= 2 s += 0x8000000000000000 # print(chr(s),end=' ' ) return s for i in range(0,len(a),8): flag = (a[i]) + (a[i+1]<<8) + (a[i+2]<<16) + (a[i+3]<<24) + (a[i+4]<<32) + (a[i+5]<<40) + (a[i+6]<<48) + (a[i+7]<<56)
print(libnum.n2s(decode(flag))[::-1],end='')
View Code