https://ctftime.org/task/7455python
A babyrust to become a hardcore reverser數組
點我下載函數
一道用rust寫的逆向題,先拖到IDA PRO裏,期間會報錯,不用理會便可,能夠看到裏面有兩個main函數,選比較長的那個main函數_ZN15beginer_reverse4main17h80fa15281f646bc1E
,這個main函數看起來邏輯很複雜,但真正有用的部分只有這裏ui
do { if ( v15 == v22 ) break; v25 = ((*((_DWORD *)v30 + v23) >> 2) ^ 0xA) == *(_DWORD *)&v15[4 * v23]; // if we set a breakpoint here, v15 is the input but is unsigned extended to DWORD array ++v23; v24 += v25; v22 -= 4; }
這段被加密過的字符串解密方式爲(data[i] >> 2) ^ 0xA,data
是uint32_t
類型的數組,解密以後的字符串即爲flag,而後會拿來和本身輸入的字符串做比較。加密
Python>flag = "" Python>for p in range(0x51000, 0x51080, 4) + range(0x6722, 0x672a, 4): Python> flag += chr((Dword(p) >> 2) ^0xA) Python> Python>flag INS{y0ur_a_r3a1_h4rdc0r3_r3v3rs3r}