Linux下六十四位可執行文件python
IDA找主函數apache
輸入長度爲35的字符串,通過一次函數處理,以後if條件函數的返回值爲1,就能斷定輸入就是flagapp
函數sub_1447的參數 | |
---|---|
v3 | v3爲新申請的地址空間,而且判斷函數的參數爲v3,說明通過這個函數,輸入的字符串經操做後,存儲在v3中, |
35 | 輸入字符串的長度 |
v6 | v6 = [1,2,3,4] 有點像一個key |
v7 | 輸入的字符串 |
函數sub_1447,函數
能夠根據ida的Findcrypt插件能夠看出該函數是一個Tea加密,查看其內容,有>>二、>>三、>>四、>>5的操做,存在常數0x9E3779B9和0x4AB325AA,內循環執行的次數爲字符串的長度,外循環的條件爲v6 != 0x9E3779B9 * (52 / a2) - 0x4AB325AA
加密
很明顯,此加密函數是一個xxtea加密,key = [1,2,3,4]
插件
判斷函數sub_15503d
提取unk_501C數據code
在網上找解密腳本字符串
import struct _DELTA = 0x9E3779B9 def _long2str(v, w): n = (len(v) - 1) << 2 if w: m = v[-1] if (m < n - 3) or (m > n): return '' n = m s = struct.pack('<%iL' % len(v), *v) return s[0:n] if w else s def _str2long(s, w): n = len(s) m = (4 - (n & 3) & 3) + n s = s.ljust(m, "\0") v = list(struct.unpack('<%iL' % (m >> 2), s)) if w: v.append(n) return v v = [0xe74eb323, 0xb7a72836, 0x59ca6fe2, 0x967cc5c1, 0xe7802674, 0x3d2d54e6, 0x8a9d0356, 0x99dcc39c, 0x7026d8ed, 0x6a33fdad, 0xf496550a, 0x5c9c6f9e, 0x1be5d04c, 0x6723ae17, 0x5270a5c2, 0xac42130a, 0x84be67b2, 0x705cc779, 0x5c513d98, 0xfb36da2d, 0x22179645, 0x5ce3529d, 0xd189e1fb, 0xe85bd489, 0x73c8d11f, 0x54b5c196, 0xb67cb490, 0x2117e4ca, 0x9de3f994, 0x2f5aa1aa, 0xa7e801fd, 0xc30d6eab, 0x1baddc9c, 0x3453b04a, 0x92a406f9] k = [1, 2, 3, 4] n = len(v) - 1 z = v[n] y = v[0] q = 6 + 52 // (n + 1) sum = (q * _DELTA) & 0xffffffff while (sum != 0): e = sum >> 2 & 3 for p in range(n, 0, -1): z = v[p - 1] v[p] = (v[p] - ((z >> 5 ^ y << 2) + (y >> 3 ^ z << 4) ^ (sum ^ y) + (k[p & 3 ^ e] ^ z))) & 0xffffffff y = v[p] z = v[n] v[0] = (v[0] - ((z >> 5 ^ y << 2) + (y >> 3 ^ z << 4) ^ (sum ^ y) + (k[0 & 3 ^ e] ^ z))) & 0xffffffff y = v[0] sum = (sum - _DELTA) & 0xffffffff print(v) for i in range(len(v)): print(chr(v[i]), end='')
獲得hgame{l00ks_1ike_y0u_f0Und_th3_t34}
table