當前位置: 首頁>>代碼示例>>Python>>正文


Python ida_bytes.get_bytes方法代碼示例

本文整理匯總了Python中ida_bytes.get_bytes方法的典型用法代碼示例。如果您正苦於以下問題:Python ida_bytes.get_bytes方法的具體用法?Python ida_bytes.get_bytes怎麽用?Python ida_bytes.get_bytes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ida_bytes的用法示例。


在下文中一共展示了ida_bytes.get_bytes方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: add_method_xref

# 需要導入模塊: import ida_bytes [as 別名]
# 或者: from ida_bytes import get_bytes [as 別名]
def add_method_xref(self,xref):
        Message("Adding cross reference to method implementation for %s\n" % GetFunctionName(self.method_pointer))
        
        add_dref(xref.frm,self.method_pointer,dr_I|XREF_USER)

        offset=self.method_pointer-xref.frm
        
        instruction_bytes=get_bytes(xref.frm,self.ARM64_INSTRUCTION_SIZE)
        #TODO: are there other instructions that could reference a method selector
        #and then move the selector reference into a register?
        arm64_ldr=AArch64LDRInstruction(instruction_bytes)
        
        arm64_ldr.patch_offset(offset)

        PatchDword(xref.frm,arm64_ldr.instruction_int)
        return ObjcMethodXref(xref.frm,self.method_pointer,xref.to) 
開發者ID:fireeye,項目名稱:flare-ida,代碼行數:18,代碼來源:objc2_xrefs_helper.py

示例2: check_guid

# 需要導入模塊: import ida_bytes [as 別名]
# 或者: from ida_bytes import get_bytes [as 別名]
def check_guid(address):
    """correctness is determined based on the number of unique bytes"""
    return (len(set(ida_bytes.get_bytes(address, 16))) > 8) 
開發者ID:yeggor,項目名稱:UEFI_RETool,代碼行數:5,代碼來源:utils.py

示例3: _get_memory

# 需要導入模塊: import ida_bytes [as 別名]
# 或者: from ida_bytes import get_bytes [as 別名]
def _get_memory(self):
        result = bytearray()
        segment_starts = [ea for ea in idautils.Segments()]
        offsets = []
        start_len = 0
        for start in segment_starts:
            end = idc.get_segm_attr(start, idc.SEGATTR_END)
            result += ida_bytes.get_bytes(start, end - start)
            offsets.append((start, start_len, len(result)))
            start_len = len(result)
        return bytes(result), offsets 
開發者ID:polymorf,項目名稱:findcrypt-yara,代碼行數:13,代碼來源:findcrypt3.py

示例4: getInstructionBytes

# 需要導入模塊: import ida_bytes [as 別名]
# 或者: from ida_bytes import get_bytes [as 別名]
def getInstructionBytes(self, offset):
        ins = idautils.DecodeInstruction(offset)
        ins_bytes = ida_bytes.get_bytes(offset, ins.size)
        return ins_bytes 
開發者ID:danielplohmann,項目名稱:smda,代碼行數:6,代碼來源:IdaInterface.py

示例5: getBinary

# 需要導入模塊: import ida_bytes [as 別名]
# 或者: from ida_bytes import get_bytes [as 別名]
def getBinary(self):
        result = b""
        segment = ida_segment.get_first_seg()
        while segment:
            result += ida_bytes.get_bytes(segment.start_ea, segment.end_ea - segment.start_ea)
            segment = ida_segment.get_next_seg(segment.end_ea)
        return result 
開發者ID:danielplohmann,項目名稱:smda,代碼行數:9,代碼來源:IdaInterface.py

示例6: main

# 需要導入模塊: import ida_bytes [as 別名]
# 或者: from ida_bytes import get_bytes [as 別名]
def main():
    is_selected, sel_start, sel_end = idaapi.read_selection()
    if not is_selected:
        logger.error('range must be selected')
        return -1

    sel_end = idc.NextHead(sel_end)

    buf = ida_bytes.get_bytes(sel_start, sel_end - sel_start)
    if buf is None:
        logger.error('failed to fetch instruction bytes')
        return -1

    f = idaapi.get_func(sel_start)
    if f != idaapi.get_func(sel_end):
        logger.error('range must be within a single function')
        return -1

    # find mappings from "$localN" to "custom_name"
    regvars = {}
    for i in range(0x1000):
        regvar = idaapi.find_regvar(f, sel_start, '$local%d' % (i))
        if regvar is None:
            continue
        regvars[regvar.canon] = regvar.user

        if len(regvars) >= f.regvarqty:
            break

    globals_ = {}
    for i, offset in netnode.Netnode('$ wasm.offsets').get('globals', {}).items():
        globals_['$global' + i] = ida_name.get_name(offset)

    frame = {}
    if f.frame != idc.BADADDR:
        names = set([])
        for i in range(idc.GetStrucSize(f.frame)):
            name = idc.GetMemberName(f.frame, i)
            if not name:
                continue
            if name in names:
                continue
            frame[i] = name
            names.add(name)

    emu = Emulator(buf)
    emu.run()
    print(emu.render(ctx={
        'regvars': regvars,
        'frame': frame,
        'globals': globals_,
    })) 
開發者ID:fireeye,項目名稱:idawasm,代碼行數:54,代碼來源:wasm_emu.py


注:本文中的ida_bytes.get_bytes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。