diff --git a/voltron/entry.py b/voltron/entry.py index 0baa982..5934a03 100644 --- a/voltron/entry.py +++ b/voltron/entry.py @@ -18,7 +18,7 @@ WinDbg/CDB (via PyKD): > .load pykd.pyd - > !py --global C:\path\to\voltron\entry.py + > !py --global C:\\path\\to\\voltron\\entry.py """ log = None @@ -36,7 +36,6 @@ pass try: - import logging import os import sys blessed = None @@ -113,7 +112,7 @@ def invoke(*args): msg = ("An error occurred while loading Voltron:\n\n{}" "\nPlease ensure Voltron is installed correctly per the documentation: " "https://github.com/snare/voltron/wiki/Installation").format(traceback.format_exc()) - if blessed: + if 'blessed' in globals() and blessed: msg = blessed.Terminal().bold_red(msg) if log: log.exception("Exception raised while loading Voltron") diff --git a/voltron/plugins/debugger/dbg_gdb.py b/voltron/plugins/debugger/dbg_gdb.py index ff26def..df8f2f9 100644 --- a/voltron/plugins/debugger/dbg_gdb.py +++ b/voltron/plugins/debugger/dbg_gdb.py @@ -385,7 +385,7 @@ def disassembly_flavor(self): Returns 'intel' or 'att' """ - flavor = re.search('flavor is "(.*)"', gdb.execute("show disassembly-flavor", to_string=True)).group(1) + flavor = re.search(r'flavor is "(.*)"', gdb.execute("show disassembly-flavor", to_string=True)).group(1) return flavor @post_event @@ -418,9 +418,9 @@ def breakpoints(self, target_id=0): addr = int(b.location[1:], 16) else: output = gdb.execute('info addr {}'.format(b.location), to_string=True) - m = re.match('.*is at ([^ ]*) .*', output) + m = re.match(r'.*is at ([^ ]*) .*', output) if not m: - m = re.match('.*at address ([^ ]*)\..*', output) + m = re.match(r'.*at address ([^ ]*)\..*', output) if m: addr = int(m.group(1), 16) else: @@ -588,7 +588,7 @@ def get_registers_sse(self, num=8): # the old way of doing this randomly crashed gdb or threw a python exception regs = {} for line in gdb.execute('info all-registers', to_string=True).split('\n'): - m = re.match('^([xyz]mm\d+)\s.*uint128 = (0x[0-9a-f]+)\}', line) + m = re.match(r'^([xyz]mm\d+)\s.*uint128 = (0x[0-9a-f]+)\}', line) if m: regs[m.group(1)] = int(m.group(2), 16) return regs @@ -648,7 +648,7 @@ def get_arch(self): try: arch = gdb.selected_frame().architecture().name() except: - arch = re.search('\(currently (.*)\)', gdb.execute('show architecture', to_string=True)).group(1) + arch = re.search(r'\(currently (.*)\)', gdb.execute('show architecture', to_string=True)).group(1) return self.archs[arch] def get_addr_size(self): diff --git a/voltron/plugins/view/memory.py b/voltron/plugins/view/memory.py index b18abed..c293ecd 100644 --- a/voltron/plugins/view/memory.py +++ b/voltron/plugins/view/memory.py @@ -36,7 +36,7 @@ def configure_subparser(cls, subparsers): help='address (in hex or decimal) from which to start reading memory') group.add_argument('--command', '-c', action='store', help='command to execute resulting in the address from which to start reading memory. ' - 'voltron will do his almighty best to find an address. e.g. "print \$rip + 0x1234"', + 'voltron will do his almighty best to find an address. e.g. "print $rip + 0x1234"', default=None) group.add_argument('--register', '-r', action='store', help='register containing the address from which to start reading memory', default=None) diff --git a/voltron/view.py b/voltron/view.py index 250972e..9829445 100644 --- a/voltron/view.py +++ b/voltron/view.py @@ -110,7 +110,7 @@ def __len__(self): return len(self.chars) def clean(self): - return re.sub('\033\[.{1,2}m', '', str(self)) + return re.sub(r'\033\[.{1,2}m', '', str(self)) def requires_async(func):