def list(**type):
"""List all the segments defined in the database.
Search type can be identified by providing a named argument.
like = glob match
regex = regular expression
selector = segment selector
index = particular index
name = specific segment name
predicate = function predicate
"""
res = __builtin__.list(iterate(**type))
maxindex = max(__builtin__.map(operator.attrgetter('index'), res) or [1])
maxaddr = max(__builtin__.map(operator.attrgetter('endEA'), res) or [1])
maxsize = max(__builtin__.map(operator.methodcaller('size'), res) or [1])
maxname = max(__builtin__.map(utils.compose(idaapi.get_true_segm_name,len), res) or [1])
cindex = math.ceil(math.log(maxindex)/math.log(10))
caddr = math.ceil(math.log(maxaddr)/math.log(16))
csize = math.ceil(math.log(maxsize)/math.log(16))
for seg in res:
comment = idaapi.get_segment_cmt(seg, 0) or idaapi.get_segment_cmt(seg, 1)
print("[{:{:d}d}] {:0{:d}x}:{:0{:d}x} {:>{:d}s} {:<+#{:d}x} sel:{:04x} flags:{:02x}{:s}".format(seg.index, int(cindex), seg.startEA, int(caddr), seg.endEA, int(caddr), idaapi.get_true_segm_name(seg), maxname, seg.size(), int(csize), seg.sel, seg.flags, "// {:s}".format(comment) if comment else ''))
return
## searching
评论列表
文章目录