本文整理汇总了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...
示例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
# --------------------------------------------------------------------------
示例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
示例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)
示例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)
示例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)
示例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)
#-------------------------------------
示例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
示例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
示例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
示例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