idapython api 記錄

來源:互聯網
上載者:User

標籤:dia   執行個體   有一個   文檔   etop   text   location   param   his   

GetOperandValue作用
  • 參數1: ea 虛擬位址
  • 參數2: 運算元號

返回指令的運算元的被解析過的值

文檔
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作用
  • 參數1: ea 虛擬位址

返回指令的作業碼的助記符

文檔
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作用
  • 參數1: ea 虛擬位址
  • 參數2: 運算元索引

返回指令的運算元

文檔
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作用
  • 參數1: ea 虛擬位址

得到指令的反組譯碼字串

文檔
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作用
  • 參數1: ea 虛擬位址

得到前一條或者後一條指令的地址

執行個體
.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 記錄

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.