Пример #1
0
    def loop(self, console):
        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="")

        if sys.stdin.isatty():
            prompt = bold(color("plasma> ", 11))
        else:
            prompt = ""

        while 1:
            if SHOULD_EXIT:
                break
            try:
                for i, widgets in enumerate(console.visual_last_widgets):
                    # the visual %0 can be None if we moved it
                    # see save_visual_0
                    if widgets is None:
                        continue

                    if i == console.visual_previous_idx:
                        print(bold(color("%%%d" % i, 201)), end="  ")
                    else:
                        print(color("%%%d" % i, 118), end="  ")

                    n = 0
                    for w in widgets:
                        if isinstance(w, Disasmbox):
                            if n > 0:
                                print(", ", end="")
                            n += 1
                            __print_addr(w.get_current_addr())
                    print()

                line = input(prompt)
                if line:
                    self.con.exec_command(line)

            except KeyboardInterrupt:
                print()
                pass

            except EOFError:
                if sys.stdin.isatty():
                    print()
                break
Пример #2
0
 def print(self):
     for l in self.token_lines:
         for (string, col, is_bold) in l:
             if self.gctx.color:
                 if col != 0:
                     string = color(string, col)
                 if is_bold:
                     string = bold(string)
             print_no_end(string)
         print()
Пример #3
0
 def print(self):
     for l in self.token_lines:
         for (string, col, is_bold) in l:
             if self.gctx.color:
                 if col != 0:
                     string = color(string, col)
                 if is_bold:
                     string = bold(string)
             print_no_end(string)
         print()
Пример #4
0
    def loop(self):
        while 1:
            if SHOULD_EXIT:
                break
            try:
                line = input(bold(color("plasma> ", 11)))
                if line:
                    self.con.exec_command(line)

            except KeyboardInterrupt:
                print()
                pass

            except EOFError:
                print()
                break
Пример #5
0
    def loop(self):
        if sys.stdin.isatty():
            prompt = bold(color("plasma> ", 11))
        else:
            prompt = ""

        while 1:
            if SHOULD_EXIT:
                break
            try:
                line = input(prompt)
                if line:
                    self.con.exec_command(line)

            except KeyboardInterrupt:
                print()
                pass

            except EOFError:
                if sys.stdin.isatty():
                    print()
                break
Пример #6
0
    def loop(self):
        if sys.stdin.isatty():
            prompt = bold(color("plasma> ", 11))
        else:
            prompt = ""

        while 1:
            if SHOULD_EXIT:
                break
            try:
                line = input(prompt)
                if line:
                    self.con.exec_command(line)

            except KeyboardInterrupt:
                print()
                pass

            except EOFError:
                if sys.stdin.isatty():
                    print()
                break