西湖论剑 2024 Reverse WriteUp Posted on 2024-02-04 MZ使用IDAPython脚本进行一次搜索即可: 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950import idaapiimport string# 512 dwords, 256 structstable = []table_addr = 0x00449078steps = []print(hex(idaapi.get_dword(table_addr + (2 * ord("a")) * 4)))for i, v in enumerate(string.printable): c = ord(v) next_c = chr(idaapi.get_dword(table_addr + (2 * c) * 4) & 0xFF) next_addr = idaapi.get_dword(table_addr + (2 * c + 1) * 4) if (c - 5) == ord(next_c) or (c + 5) == ord(next_c): steps.append({"path": v, "addr": next_addr})print(steps)# 剪枝,一遍遍从输出中找到有意义的子字符串,减少爆破时间steps = [{"path": "Somet1mes_ch0ice_i5_more_import@nt_tHan_effor", "addr": 4522496}]res = []# traversewhile len(steps) != 0: step = steps[0] steps = steps[1:] print("------------------------") print(steps) print(step) print("------------------------") if len(step["path"]) == 48: res.append(step) continue addr = step["addr"] for i, v in enumerate(string.printable): c = ord(v) next_c = chr(idaapi.get_dword(addr + (2 * c) * 4) & 0xFF) next_table = idaapi.get_dword(addr + (2 * c + 1) * 4) if (c - 5) == ord(next_c) or (c + 5) == ord(next_c): new_step = step.copy() new_step["path"] += v new_step["addr"] = next_table steps.append(new_step)print(res)# 'Somet1mes_ch0ice_i5_more_import@nt_tHan_effort~!' BabyCPP用到C++的STL,使用函数实现&、<<、>>、^,然后实现了TEA,后面有点体力活,有时间再更…