本文整理汇总了Python中idc.get_segm_name方法的典型用法代码示例。如果您正苦于以下问题:Python idc.get_segm_name方法的具体用法?Python idc.get_segm_name怎么用?Python idc.get_segm_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idc
的用法示例。
在下文中一共展示了idc.get_segm_name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: is_ELF_got_pointer
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def is_ELF_got_pointer(ea):
"""Returns `True` if this is a pointer to a pointer stored in the
`.got` section of an ELF binary. For example, `__gmon_start___ptr` is
a pointer in the `.got` that will be fixed up to contain the address of
the external function `__gmon_start__`. We don't want to treat
`__gmon_start___ptr` as external because it is really a sort of local
variable that will will resolve with a data cross-reference."""
seg_name = idc.get_segm_name(ea).lower()
if ".got" not in seg_name:
return False
name = get_symbol_name(ea)
target_ea = get_reference_target(ea)
target_name = get_true_external_name(get_symbol_name(target_ea))
if target_name not in name:
return False
return is_referenced_by(target_ea, ea)
示例2: get_area_name
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def get_area_name(self, ea, val_type):
name = None
if val_type == T_CODE:
fcn_name = idc.get_func_off_str(ea)
if fcn_name:
name = fcn_name
else:
symbol_name = idaapi.get_name(ea)
if symbol_name:
name = symbol_name
else:
symbol_name = idaapi.get_name(ea)
if symbol_name:
name = symbol_name
seg_name = idc.get_segm_name(ea)
if seg_name is not None:
if name:
name = "%s ! %s" % (seg_name, name)
else:
name = seg_name
return name
示例3: enum_segments
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def enum_segments():
for segstart in idautils.Segments():
segend = idc.get_segm_end(segstart)
segname = idc.get_segm_name(segstart)
yield segstart, segend, segname
示例4: get_all_func
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def get_all_func():
num = 0
content = []
for func in idautils.Functions():
seg_perm = idc.get_segm_attr(func,SEGATTR_PERM) # 段属性
if(5 !=seg_perm):
continue
seg_name = idc.get_segm_name(func) # 段名
if(".plt" == seg_name):
continue
func_name = idc.get_func_name(func) # 函数名
func_flags = hex(idc.get_func_attr(func,FUNCATTR_FLAGS))# 函数信息
func_head = hex(idc.get_func_attr(func,FUNCATTR_START)) # 函数头
func_end = hex(idc.get_func_attr(func,FUNCATTR_END)) # 函数尾
l = []
l.append(num)
l.append(seg_name)
l.append(seg_perm)
l.append(func_name)
l.append(func_flags)
l.append(func_head)
l.append(func_end)
content.append(l)
num += 1
#print(l)
return content
# 程序入口
示例5: chunk_info
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def chunk_info(self, chunk_addr, chunk):
line = idaapi.COLSTR("Chunk ", idaapi.SCOLOR_NUMBER)
line += idaapi.COLSTR("0x%x\n\n" % (chunk_addr), idaapi.SCOLOR_INSN)
line += idaapi.COLSTR("size: 0x%x\nfd: 0x%x - %s" % \
(chunk.size, chunk.fd, idc.get_segm_name(chunk.fd)), SCOLOR_DEFAULT)
return line
示例6: bin_info
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def bin_info(self, node_title, chunk_addr, chunk, with_size=True):
line = idaapi.COLSTR("%s " % node_title, idaapi.SCOLOR_NUMBER)
line += idaapi.COLSTR("0x%x\n\n" % chunk_addr, idaapi.SCOLOR_INSN)
chunk_info = ""
if with_size:
chunk_info += "size: 0x%x\n" % chunk.size
chunk_info += "fd: 0x%x - %s\nbk: 0x%x - %s" % (chunk.fd, \
idc.get_segm_name(chunk.fd), chunk.bk, idc.get_segm_name(chunk.bk))
line += idaapi.COLSTR(chunk_info, idaapi.SCOLOR_DEFAULT)
return line
示例7: is_tls_segment
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def is_tls_segment(ea):
try:
seg_name = idc.get_segm_name(ea)
return seg_name in (".tbss", ".tdata", ".tls")
except:
return False
# Returns `True` if `ea` looks like a thread-local thing.
示例8: is_invalid_ea
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def is_invalid_ea(ea):
"""Returns `True` if `ea` is not valid, i.e. it doesn't point into any
valid segment."""
if (idc.BADADDR == ea) or \
(idc.get_segm_name(ea) == "LOAD"):
return True
try:
idc.get_segm_attr(idc.get_segm_start(ea), idc.SEGATTR_TYPE)
return False # If we get here, then it must be a valid ea!
except:
return True
示例9: segment_contains_external_function_pointers
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def segment_contains_external_function_pointers(seg_ea):
"""Returns `True` if a segment contains pointers to external functions."""
try:
seg_name = idc.get_segm_name(seg_ea)
return seg_name.lower() in (".idata", ".plt.got")
except:
return False
示例10: is_external_segment
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def is_external_segment(ea):
"""Returns `True` if the segment containing `ea` looks to be solely containing
external references."""
global _NOT_EXTERNAL_SEGMENTS
seg_ea = idc.get_segm_start(ea)
if seg_ea in _NOT_EXTERNAL_SEGMENTS:
return False
if seg_ea in _EXTERNAL_SEGMENTS:
return True
if is_external_segment_by_flags(ea):
_EXTERNAL_SEGMENTS.add(seg_ea)
return True
ext_types = []
seg_name = idc.get_segm_name(seg_ea).lower()
if IS_ELF:
if ".got" in seg_name or ".plt" in seg_name:
_EXTERNAL_SEGMENTS.add(seg_ea)
return True
elif IS_PE:
if ".idata" == seg_name: # Import table.
_EXTERNAL_SEGMENTS.add(seg_ea)
return True
_NOT_EXTERNAL_SEGMENTS.add(seg_ea)
return False
示例11: is_constructor_segment
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def is_constructor_segment(ea):
"""Returns `True` if the segment containing `ea` belongs to global constructor section"""
seg_ea = idc.get_segm_start(ea)
seg_name = idc.get_segm_name(seg_ea).lower()
if seg_name in [".init_array", ".ctor"]:
return True
return False
示例12: get_destructor_segment
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def get_destructor_segment():
"""Returns the start address of the global destructor section"""
for seg_ea in idautils.Segments():
seg_name = idc.get_segm_name(seg_ea).lower()
if seg_name in [".fini_array", ".dtor"]:
return seg_ea;
示例13: recover_frame_entries
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def recover_frame_entries(seg_ea):
if seg_ea == idc.BADADDR:
return
DEBUG("Recover entries from section : {}".format(idc.get_segm_name(seg_ea)))
ea = idc.get_segm_start(seg_ea)
end_ea = idc.get_segm_end(seg_ea)
while ea != idc.BADADDR and ea < end_ea:
ea = format_entries(ea)
示例14: recover_exception_table
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def recover_exception_table():
""" Recover the CIE and FDE entries from the segment .eh_frame
"""
seg_eas = [ea for ea in idautils.Segments() if not is_invalid_ea(ea)]
for seg_ea in seg_eas:
seg_name = idc.get_segm_name(seg_ea)
if seg_name in [".eh_frame", "__eh_frame"]:
recover_frame_entries(seg_ea)
break
示例15: get_header_idb
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_segm_name [as 别名]
def get_header_idb():
"""get file header from idb"""
if idc.get_segm_name(0) == 'HEADER':
header = bytearray(
[idc.get_wide_byte(ea) for ea in range(0, idc.get_segm_end(0))])
return header
return bytearray(b'')