示例#1
0
 def print_register_diff(self, a, b):
     for k, v in b.items():
         if a[k] != v:
             print(k + ': ', end='')
             Color.print(Color.BLUE, str(v))
         else:
             print(k + ': ' + str(v))
示例#2
0
    def __init__(self, dbg):
        self.ins_history = []
        # TODO: Keep history of registers? Can get memory intensive?
        self.dbg = dbg
        self.commands_dict = {
            # Change funcion pointers to Command objects with description
            'exit': self.stop,
            'quit': self.stop,
            'help': self.print_help,
            'registers': self.print_diff,
            'memory': self.print_memory,
            'clear': self.clear_screen,
            'history': self.print_history,
            'zero': self.zero_registers,
            # Add command to pass a string to radare?
        }

        self.before_regs = dbg.get_registers()
        self.after_regs = self.before_regs

        self.retdec = Retdec()

        if Context().debug_enabled:
            self.commands_dict.update({
                'debug': self.debug,
            })
        self.running = True
        signal.signal(signal.SIGINT, self.int_handler)
        Color.print(Color.RED, 'Initialized shell')
示例#3
0
def debug_print(s):
    if Context().debug_enabled:
        Color.print(Color.GREEN, str(s))