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


Python idaapi.get_segm_by_name方法代碼示例

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


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

示例1: pablo

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import get_segm_by_name [as 別名]
def pablo(mode, address, end, search):

    while address < end:
        address = idaapi.find_binary(address, end, search, 0x10, SEARCH_DOWN)
        
        if address > idaapi.get_segm_by_name('CODE').end_ea:
            offset = address - 0x3
            
            if idaapi.isUnknown(idaapi.getFlags(offset)):
                if idaapi.get_qword(offset) <= end:
                    idaapi.create_data(offset, FF_QWORD, 0x8, BADNODE)
            
            address = offset + 0x4
        
        else:
            address += mode
            idaapi.do_unknown(address, 0)
            idaapi.create_insn(address)
            idaapi.add_func(address, BADADDR)
            address += 0x1

# Load Input Binary... 
開發者ID:SocraticBliss,項目名稱:ps4_module_loader,代碼行數:24,代碼來源:ps4_module.py

示例2: find_malloc_par

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import get_segm_by_name [as 別名]
def find_malloc_par():
    mp_ = idc.get_name_ea_simple("mp_")
    if mp_ != idc.BADADDR:
        return mp_

    segm = idaapi.get_segm_by_name("[heap]")
    if segm is None:
        return None

    offset = get_struct_offsets(malloc_par()).get('sbrk_base')
    sbrk_base = segm.start_ea
    ea = idc.get_segm_start(get_name_ea_simple("_IO_2_1_stdin_"))
    end_ea = idc.get_segm_end(ea)

    while ea < end_ea:
        ptr = config.get_ptr(ea)
        if idaapi.is_loaded(ptr) and ptr == sbrk_base:
            return (ea-offset)
        ea += config.ptr_size

    return None

# -------------------------------------------------------------------------- 
開發者ID:danigargu,項目名稱:heap-viewer,代碼行數:25,代碼來源:ptmalloc.py

示例3: get_thread_tib

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import get_segm_by_name [as 別名]
def get_thread_tib(tid):
    tib_segm_name = "TIB[%08X]" % tid
    tib_segm = idaapi.get_segm_by_name(tib_segm_name)
    tib = None

    if not tib_segm:
        return tib

    ea  = tib_segm.start_ea
    tid_offset = m.ptr_size * 9
    while ea < tib_segm.end_ea:
        thread_id = m.get_ptr(ea+tid_offset)
        if thread_id == tid:
            tib = ea
            break
        ea += 0x1000
    return tib 
開發者ID:danigargu,項目名稱:deREferencing,代碼行數:19,代碼來源:dbg.py

示例4: seg_by_name

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import get_segm_by_name [as 別名]
def seg_by_name(self, name):
        ida_seg = idaapi.get_segm_by_name(name)
        if ida_seg is None:
            return None
        perms = 0
        perms |= SEG_PROT_R if ida_seg.perm & idaapi.SEGPERM_READ else 0
        perms |= SEG_PROT_W if ida_seg.perm & idaapi.SEGPERM_WRITE else 0
        perms |= SEG_PROT_X if ida_seg.perm & idaapi.SEGPERM_EXEC else 0
        return self.angrdbg_mod.Segment(name, ida_seg.start_ea, ida_seg.end_ea, perms) 
開發者ID:andreafioraldi,項目名稱:IDAngr,代碼行數:11,代碼來源:ida_debugger.py

示例5: get_got

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import get_segm_by_name [as 別名]
def get_got(self): #return tuple(start_addr, end_addr)
        ida_seg = idaapi.get_segm_by_name(".got.plt")
        return (ida_seg.start_ea, ida_seg.end_ea) 
開發者ID:andreafioraldi,項目名稱:IDAngr,代碼行數:5,代碼來源:ida_debugger.py

示例6: get_plt

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import get_segm_by_name [as 別名]
def get_plt(self): #return tuple(start_addr, end_addr)
        ida_seg = idaapi.get_segm_by_name(".plt")
        return (ida_seg.start_ea, ida_seg.end_ea) 
開發者ID:andreafioraldi,項目名稱:IDAngr,代碼行數:5,代碼來源:ida_debugger.py

示例7: get_idata

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import get_segm_by_name [as 別名]
def get_idata(self): #return tuple(start_addr, end_addr)
        ida_seg = idaapi.get_segm_by_name(".idata")
        if ida_seg is None:
            addr = None
            def cb(ea, name, i):
                addr = ea
            idaapi.enum_import_names(0, cb)
            ida_seg = idaapi.seg_by_addr(addr)
        return (ida_seg.start_ea, ida_seg.end_ea)
    
    #------------------------------------- 
開發者ID:andreafioraldi,項目名稱:IDAngr,代碼行數:13,代碼來源:ida_debugger.py

示例8: get_heap_base

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import get_segm_by_name [as 別名]
def get_heap_base(self, address=None):
        if not address:
            segm = idaapi.get_segm_by_name("[heap]") # same as mp_->sbrk_base
            if segm:
                return segm.start_ea
        else:
            heap_addr = self.heap_for_ptr(address)
            heap_addr = heap_addr + sizeof(self.heap_info_s) + sizeof(self.malloc_state_s)
            return round_up(heap_addr, self.malloc_alignment)
        return None 
開發者ID:danigargu,項目名稱:heap-viewer,代碼行數:12,代碼來源:ptmalloc.py

示例9: __init__

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import get_segm_by_name [as 別名]
def __init__(self, ea=UseCurrentAddress, name=None, index=None, segment_t=None):
        """Wrapper around IDA segments.

        There are 3 ways to get a segment - by name, ea or index. Only use one.

        Args:
            ea - address in the segment
            name - name of the segment
            index - index of the segment
        """
        if sum((ea not in (self.UseCurrentAddress, None), name is not None, index is not None,
                segment_t is not None,)) > 1:
            raise ValueError((
                                 "Expected only one (ea, name, index or segment_t)."
                                 " Got (ea={!r}, name={!r}, index={!r}, segment_t={!r})"
                             ).format(ea,
                                      name,
                                      index,
                                      segment_t))


        elif segment_t is not None:
            seg = segment_t

        elif name is not None:
            seg = idaapi.get_segm_by_name(name)

        elif index is not None:
            seg = idaapi.getnseg(index)

        elif ea == self.UseCurrentAddress:
            seg = idaapi.getseg(idc.here())

        elif ea is None:
            raise ValueError("`None` is not a valid address. To use the current screen ea, "
                             "use `Function(ea=Function.UseCurrentAddress)` or supply no `ea`.")

        else:
            seg = idaapi.getseg(ea)

        self._segment = seg 
開發者ID:tmr232,項目名稱:Sark,代碼行數:43,代碼來源:segment.py

示例10: by_name

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import get_segm_by_name [as 別名]
def by_name(name):
    '''Return the segment with the given `name`.'''
    res = utils.string.to(name)
    seg = idaapi.get_segm_by_name(res)
    if seg is None:
        raise E.SegmentNotFoundError(u"{:s}.by_name({!r}) : Unable to locate the segment with the specified name.".format(__name__, name))
    return seg 
開發者ID:arizvisa,項目名稱:ida-minsc,代碼行數:9,代碼來源:segment.py

示例11: resolve_expr

# 需要導入模塊: import idaapi [as 別名]
# 或者: from idaapi import get_segm_by_name [as 別名]
def resolve_expr(self, expr):
        res = None
        try:
            expr = re.sub(r'[(|)]', '', expr)
            res = int(expr, 16)
        except ValueError:
            segm = idaapi.get_segm_by_name(expr)
            if segm:
                res = segm.start_ea
            else:
                ea = idaapi.str2ea(expr)
                if ea != idc.BADADDR:
                    res = ea
        return res 
開發者ID:danigargu,項目名稱:deREferencing,代碼行數:16,代碼來源:custom.py


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