当前位置: 首页>>代码示例>>Python>>正文


Python idaapi.add_segm_ex方法代码示例

本文整理汇总了Python中idaapi.add_segm_ex方法的典型用法代码示例。如果您正苦于以下问题:Python idaapi.add_segm_ex方法的具体用法?Python idaapi.add_segm_ex怎么用?Python idaapi.add_segm_ex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在idaapi的用法示例。


在下文中一共展示了idaapi.add_segm_ex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: myAddSeg

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import add_segm_ex [as 别名]
def myAddSeg(startea, endea, base, use32, name, clas):
    s = idaapi.segment_t()
    s.start_ea = startea
    s.end_ea   = endea
    s.sel      = idaapi.setup_selector(base)
    s.bitness  = use32
    s.align    = idaapi.saRelPara
    s.comb     = idaapi.scPub
    #idaapi.add_segm_ex(s, name, clas, idaapi.ADDSEG_NOSREG|idaapi.ADDSEG_OR_DIE)
    idaapi.add_segm(base, startea, endea, name, clas) 
开发者ID:TakahiroHaruyama,项目名称:ida_haru,代码行数:12,代码来源:ida_loader_drv_vm.py

示例2: AddWasmSegment

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import add_segm_ex [as 别名]
def AddWasmSegment(startea, endea, name, cls=None, base=0):
    s = segment_t()
    s.start_ea = startea
    s.end_ea = endea
    s.sel = setup_selector(base)
    s.use32 = 0
    s.align = saRelByte # saRelDble
    s.perm = SEGPERM_EXEC | SEGPERM_WRITE | SEGPERM_READ
    fl = ADDSEG_OR_DIE
    idaapi.add_segm_ex(s, name, cls, fl)
    return 
开发者ID:sophoslabs,项目名称:WebAssembly,代码行数:13,代码来源:wasm_loader.py

示例3: load_file

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import add_segm_ex [as 别名]
def load_file(li, neflags, format):
    
    # Select the PC processor module
    idaapi.set_processor_type("EVM", SETPROC_ALL|SETPROC_FATAL)
    
    # TODO: detect and emulate contract creation code
    li.seek(0)
    buf = li.read(li.size())
    if not buf:
        return 0

    if buf[0:2] == '0x':
        print "Detected hex"
        new_buf = buf[2:].strip().rstrip()
        buf_set = set()
        for c in new_buf:
            buf_set.update(c)
        hex_set = set(list('0123456789abcdef'))
        if buf_set <= hex_set: # subset
            print "Replacing original buffer with hex decoded version"
            buf = new_buf.decode('hex')

    # Load all shellcode into different segments
    start = 0x0
    seg = idaapi.segment_t()
    size = len(buf)
    end  = start + size
    
    # Create the segment
    seg.startEA = start
    seg.endEA   = end
    seg.bitness = 1 # 32-bit
    idaapi.add_segm_ex(seg, "evm", "CODE", 0)

    # TODO: make segments for stack, memory, storage

    # Copy the bytes
    idaapi.mem2base(buf, start, end)


    # check for swarm hash and make it data instead of code
    swarm_hash_address = buf.find('ebzzr0')
    if swarm_hash_address != -1:
        print "Swarm hash detected, making it data"
        for i in range(swarm_hash_address-1, swarm_hash_address+42):
            MakeByte(i)
        ida_bytes.set_cmt(swarm_hash_address-1, "swarm hash", True)
    # add entry point
    idaapi.add_entry(start, start, "start", 1) 

    # add comment to beginning of disassembly
    idaapi.describe(start, True, "EVM bytecode disassembly")

    # Mark for analysis
    AutoMark(start, AU_CODE)

    #setup_enums()
    return 1 
开发者ID:crytic,项目名称:ida-evm,代码行数:60,代码来源:evm-loader.py


注:本文中的idaapi.add_segm_ex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。