当前位置: 首页>>代码示例>>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;未经允许,请勿转载。