標籤:dia 執行個體 有一個 文檔 etop text location param his
GetOperandValue作用
返回指令的運算元的被解析過的值
文檔
def GetOperandValue(ea, n): """ Get number used in the operand This function returns an immediate number used in the operand @param ea: linear address of instruction @param n: the operand number @return: value operand is an immediate value => immediate value operand has a displacement => displacement operand is a direct memory ref => memory address operand is a register => register number operand is a register phrase => phrase number otherwise => -1 """
執行個體
.text:080488C9 cmp eax, 1.text:080488CC jz short loc_80488D8.text:080488CE sub esp, 0Ch
其中 080488CC 處的指令的16進位表示為
74 0A
這一條指令有一個運算元,所以通過 GetOperandValue 可以擷取擷取通過 ida 解析的值。
Python>hex(GetOperandValue(0x080488CC,0))0x80488d8L
GetMnem作用
返回指令的作業碼的助記符
文檔
def GetMnem(ea): """ Get instruction mnemonics @param ea: linear address of instruction @return: "" - no instruction at the specified location
執行個體
.text:080488C9 cmp eax, 1.text:080488CC jz short loc_80488D8.text:080488CE sub esp, 0Ch
Python>GetMnem(0x80488CC)jz
GetOpnd作用
返回指令的運算元
文檔
def GetOpnd(ea, n): """ Get operand of an instruction @param ea: linear address of instruction @param n: number of operand: 0 - the first operand 1 - the second operand @return: the current text representation of operand or "" """
執行個體
.text:080488C9 cmp eax, 1.text:080488CC jz short loc_80488D8.text:080488CE sub esp, 0Ch
Python>GetOpnd(0x80488CC,0)loc_80488D8
GetDisasm作用
得到指令的反組譯碼字串
文檔
def GetDisasm(ea): """ Get disassembly line @param ea: linear address of instruction @return: "" - could not decode instruction at the specified location @note: this function may not return exactly the same mnemonics as you see on the screen. """
執行個體
.text:080488C9 cmp eax, 1.text:080488CC jz short loc_80488D8.text:080488CE sub esp, 0Ch
Python>GetDisasm(0x80488CC)jz short loc_80488D8
PrevHead 和 NextHead作用
得到前一條或者後一條指令的地址
執行個體
.text:080488AF add esp, 10h.text:080488B2 mov [ebp+fd], eax.text:080488B5 sub esp, 4
Python>hex(PrevHead(0x080488B2))0x80488afLPython>hex(NextHead(0x080488B2))0x80488b5L
idapython api 記錄