在 Ida 伪代码中,当我按下堆栈的变量时,我可以看到该变量在堆栈中的位置。
char buffer[XXX]; // [sp+YYh]
如何在 IDAPython 中获取该信息(缓冲区大小和该缓冲区在堆栈中的位置)?
您可以使用 idapython 执行此操作 - 使用ida_hexraysapi:
ida_hexrays
ida_hexrays.init_hexrays_plugin() for var in ida_hexrays.decompile(ea).get_lvars(): # offset offset = -stack_size + var.get_stkoff() # variable size size = var.width # variable type type = var.tif
在 ida gui 中,您可以看到声明旁边的注释。