diff --git a/peda-arm.py b/peda-arm.py index 53d548a..da3c21d 100644 --- a/peda-arm.py +++ b/peda-arm.py @@ -176,7 +176,7 @@ def format_shellcode(self, buf, arch='arm'): shellcode = [] # ' 0: e49df004 pop {pc} ; (ldr pc, [sp], #4)' - pattern = re.compile("\s*([0-9a-f]+):\s*([0-9a-f]+)(.+)") + pattern = re.compile(r"\s*([0-9a-f]+):\s*([0-9a-f]+)(.+)") # matches = pattern.findall(asmcode) for line in asmcode.splitlines(): @@ -252,7 +252,7 @@ def _get_function_args_32(self, code, argc=None): if argc is None: # deal with regs - p = re.compile(":\s*(\S+)\s*(\w+),") + p = re.compile(r":\s*(\S+)\s*(\w+),") matches = p.findall(code) m = [r for (_, r) in matches] @@ -502,7 +502,7 @@ def _testjump(self, inst=None): return None # inst='=> 0x8b84 <_start+40>:\tblxeq.n\t0xa3bc <__libc_start_main>' - match = re.match('.*:\s+(b[l|x]{0,2})(\S{0}|\S{2})(\.w|\.n)?\s+', inst) + match = re.match(r'.*:\s+(b[l|x]{0,2})(\S{0}|\S{2})(\.w|\.n)?\s+', inst) next_addr = self.peda.eval_target(inst) if next_addr is None: next_addr = 0 @@ -567,7 +567,7 @@ def _testjump_cb(self, inst=None): return None # inst='=> 0xaf130bd4:\tcbz\tr0, 0xaf130be4' - match = re.match('.*:\s+cb(n?z)?\s+(\S+),\s*(\S+)', inst) + match = re.match(r'.*:\s+cb(n?z)?\s+(\S+),\s*(\S+)', inst) if not match: return None cond, r, next_addr = match.groups() diff --git a/peda-intel.py b/peda-intel.py index 305715d..ac32def 100644 --- a/peda-intel.py +++ b/peda-intel.py @@ -97,7 +97,7 @@ def nasm2shellcode(asmcode): return "" shellcode = [] - pattern = re.compile("([0-9A-F]{8})\s*([^\s]*)\s*(.*)") + pattern = re.compile(r"([0-9A-F]{8})\s*([^\s]*)\s*(.*)") # matches = pattern.findall(asmcode) for line in asmcode.splitlines(): @@ -263,7 +263,7 @@ def _get_function_args_32(self, code, argc=None): """ if not argc: argc = 0 - p = re.compile(".*mov.*\[esp(.*)\],") + p = re.compile(r".*mov.*\[esp(.*)\],") matches = p.findall(code) if matches: l = len(matches) @@ -297,7 +297,7 @@ def _get_function_args_64(self, code, argc=None): arg_order = ["rdi", "rsi", "rdx", "rcx", "r8", "r9"] if not argc: - p = re.compile(":\s*([^ ]*)\s*(.*),") + p = re.compile(r":\s*([^ ]*)\s*(.*),") matches = p.findall(code) regs = [r for (_, r) in matches] p = re.compile("di|si|dx|cx|r8|r9") @@ -559,7 +559,7 @@ def traceinst(self, *arg): prev_depth = self.peda.backtrace_depth(peda.getreg("sp")) logfd = open(logname, "w") - p = re.compile(".*?:\s*[^ ]*\s*([^,]*),(.*)") + p = re.compile(r".*?:\s*[^ ]*\s*([^,]*),(.*)") while count: result = self.peda.stepuntil(",".join(instlist), mapname, prev_depth) if result is None: @@ -571,7 +571,7 @@ def traceinst(self, *arg): # special case for JUMP inst prev_code = "" - if re.search("j[^m]", code.split(":\t")[-1].split()[0]): + if re.search(r"j[^m]", code.split(":\t")[-1].split()[0]): prev_insts = self.peda.prev_inst(peda.getpc()) if prev_insts: prev_code = "0x%x:%s" % prev_insts[0] @@ -580,7 +580,7 @@ def traceinst(self, *arg): text = "%s%s%s" % (" " * (prev_depth - 1), " dep:%02d " % (prev_depth - 1), code.strip()) msg(text, teefd=logfd) - if re.search("call", code.split(":\t")[-1].split()[0]): + if re.search(r"call", code.split(":\t")[-1].split()[0]): args = self.peda.get_function_args() if args: for (i, a) in enumerate(args): diff --git a/peda/core.py b/peda/core.py index 66ef1ee..4e629a4 100644 --- a/peda/core.py +++ b/peda/core.py @@ -1440,7 +1440,7 @@ def examine_data(value, bits=32): if start <= value < end: if type == "code": out = self.get_disasm(value) - p = re.compile(".*?0x[^ ]*?\s(.*)") + p = re.compile(r".*?0x[^ ]*?\s(.*)") m = p.search(out) result = (to_hex(value), "code", m.group(1)) else: # rodata address @@ -1458,7 +1458,7 @@ def examine_data(value, bits=32): out = examine_data(value, bits) result = (to_hex(value), "rodata", out.split(":", 1)[1].strip()) else: - p = re.compile(".*?0x[^ ]*?\s(.*)") + p = re.compile(r".*?0x[^ ]*?\s(.*)") m = p.search(out) result = (to_hex(value), "code", m.group(1)) @@ -1640,7 +1640,7 @@ def elfheader_solib(self, solib=None, name=None): if not out: return {} - p = re.compile("^ *(0x\S+) - (0x\S+) is (\.\S+) in (\S+)") + p = re.compile(r"^ *(0x\S+) - (0x\S+) is (\.\S+) in (\S+)") soheaders = p.findall(out) headers = [ (to_int(start), to_int(end), hname, os.path.realpath(libname)) for (start, end, hname, libname) in soheaders diff --git a/peda/utils.py b/peda/utils.py index 44fa880..a245c87 100644 --- a/peda/utils.py +++ b/peda/utils.py @@ -610,7 +610,7 @@ def format_disasm_code_arm(code, nearby=None): results.append(line) else: color = style = None - m = re.search(".*(0x\S*).*:\s*(\S*)", line) + m = re.search(r".*(0x\S*).*:\s*(\S*)", line) if not m: # failed to parse results.append(line) continue @@ -685,7 +685,7 @@ def format_disasm_code_intel(code, nearby=None): results.append(line) else: color = style = None - m = re.search(".*(0x\S*).*:\s*(\S*)", line) + m = re.search(r".*(0x\S*).*:\s*(\S*)", line) if not m: # failed to parse results.append(line) continue