Пример #1
0
 def print_header(self):
     print_no_end(color_section(self.name.ljust(20)))
     print_no_end(" [ ")
     print_no_end(hex(self.start))
     print_no_end(" - ")
     print_no_end(hex(self.end))
     print_no_end(" - %d - %d" % (self.virt_size, self.real_size))
     print(" ]")
Пример #2
0
 def print_header(self):
     print_no_end(color_section(self.name.ljust(20)))
     print_no_end(" [ ")
     print_no_end(hex(self.start))
     print_no_end(" - ")
     print_no_end(hex(self.end))
     print_no_end(" - %d - %d" % (self.virt_size, self.real_size))
     print(" ]")
Пример #3
0
 def __print_addr(ad):
     if console.db.mem.is_code(ad):
         fid = console.db.mem.get_func_id(ad)
         if fid != -1:
             func_ad = console.db.func_id[fid]
             name = console.api.get_symbol(func_ad)
             print(color_symbol(name), end="")
             return
     s = console.gctx.dis.binary.get_section(ad)
     print(color_section(s.name), end=".")
     print(color_addr_normal(ad, False), end="")
Пример #4
0
    def print_symbols(self, print_sections, sym_filter=None):
        if sym_filter is not None:
            sym_filter = sym_filter.lower()
            if sym_filter[0] == "-":
                invert_match = True
                sym_filter = sym_filter[1:]
            else:
                invert_match = False

        total = 0

        # TODO: race condition with the analyzer ?
        for sy in list(self.db.symbols):
            ad = self.db.symbols[sy]

            if ad in self.db.reverse_demangled:
                dem = self.db.reverse_demangled[ad]
            else:
                dem = None

            print_sym = True

            if sym_filter is None or \
                    (invert_match and sym_filter not in sy.lower()) or \
                    (not invert_match and sym_filter in sy.lower()) or \
                    (dem is not None and
                     ((invert_match and sym_filter not in dem.lower()) or \
                      (not invert_match and sym_filter in dem.lower()))):

                if sy:
                    print_no_end(color_addr(ad))

                    if dem is not None:
                        print_no_end(" %s (%s) " % (dem, color_comment(sy)))
                    else:
                        print_no_end(" " + sy)

                    section = self.binary.get_section(ad)
                    if print_sections and section is not None:
                        print_no_end(" (" + color_section(section.name) + ")")
                    print()
                    total += 1

        print("Total:", total)