-
Notifications
You must be signed in to change notification settings - Fork 806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SyntaxWarning: invalid escape sequence #177
Comments
can confirm. Arch, gdb 14.2:
|
can confirm the invalid sequence warnings. |
1.for SyntaxWarningyou can fix this by adding r to the strings p = re.compile(r"(.*)\[(.*)\]") # DWORD PTR [esi+eax*1] to make it raw string, pull request #178 fixes this. 2.for
|
issue longld#177 fixes applied
I have the similar issue, it seems to be the new python's behavior. see https://stackoverflow.com/questions/52335970/how-to-fix-syntaxwarning-invalid-escape-sequence-in-python. Need to update the code!!! You can also disable this warnings by using Details└─$ gdb ./stack_overflow_32
GNU gdb (Debian 13.2-1+b2) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
/home/liudonghua/peda/peda.py:151: SyntaxWarning: invalid escape sequence '\['
p = re.compile("(.*)\[(.*)\]") # DWORD PTR [esi+eax*1]
/home/liudonghua/peda/peda.py:373: SyntaxWarning: invalid escape sequence '\s'
p = re.compile(".*exec file:\s*`(.*)'")
/home/liudonghua/peda/peda.py:550: SyntaxWarning: invalid escape sequence '\d'
p = re.compile("^(\d*)\s*(.*breakpoint)\s*(keep|del)\s*(y|n)\s*(0x[^ ]*)\s*(.*)")
/home/liudonghua/peda/peda.py:554: SyntaxWarning: invalid escape sequence '\d'
p = re.compile("^(\d*)\s*(.*point)\s*(keep|del)\s*(y|n)\s*(.*)")
/home/liudonghua/peda/peda.py:567: SyntaxWarning: invalid escape sequence '\d'
m = re.match("in.*at(.*:\d*)", what)
/home/liudonghua/peda/peda.py:596: SyntaxWarning: invalid escape sequence '\d'
m = re.match("^(\d*).*", line)
/home/liudonghua/peda/peda.py:916: SyntaxWarning: invalid escape sequence '\s'
p = re.compile("\s*(0x[^ ]*).*?:\s*([^ ]*)\s*(.*)")
/home/liudonghua/peda/peda.py:918: SyntaxWarning: invalid escape sequence '\s'
p = re.compile("(.*?)\s*<.*?>\s*([^ ]*)\s*(.*)")
/home/liudonghua/peda/peda.py:937: SyntaxWarning: invalid escape sequence '\['
p = re.compile(".*mov.*\[esp(.*)\],")
/home/liudonghua/peda/peda.py:969: SyntaxWarning: invalid escape sequence '\s'
p = re.compile(":\s*([^ ]*)\s*(.*),")
/home/liudonghua/peda/peda.py:1116: SyntaxWarning: invalid escape sequence '\s'
p = re.compile(".*?:\s*(.*)")
/home/liudonghua/peda/peda.py:1223: SyntaxWarning: invalid escape sequence '\s'
p = re.compile(".*?:\s*[^ ]*\s*(.* PTR ).*(0x[^ ]*)")
/home/liudonghua/peda/peda.py:1226: SyntaxWarning: invalid escape sequence '\s'
p = re.compile(".*?:\s.*\s(0x[^ ]*|\w+)")
/home/liudonghua/peda/peda.py:1235: SyntaxWarning: invalid escape sequence '\s'
p = re.compile(".*?:\s*[^ ]*\s*(.* PTR ).*\[(.*)\]")
/home/liudonghua/peda/peda.py:1430: SyntaxWarning: invalid escape sequence '\s'
pattern = re.compile("([^\n]*)\s* ([0-9a-f][^-\s]*)-([^\s]*) \[.*\]\s([^/]*).* (.*)")
/home/liudonghua/peda/peda.py:2096: SyntaxWarning: invalid escape sequence '\s'
p = re.compile(".*?0x[^ ]*?\s(.*)")
/home/liudonghua/peda/peda.py:2114: SyntaxWarning: invalid escape sequence '\s'
p = re.compile(".*?0x[^ ]*?\s(.*)")
/home/liudonghua/peda/peda.py:2214: SyntaxWarning: invalid escape sequence '\s'
p = re.compile("Entry point: ([^\s]*)")
/home/liudonghua/peda/peda.py:2242: SyntaxWarning: invalid escape sequence '\s'
p = re.compile("\s*(0x[^-]*)->(0x[^ ]*) at (0x[^:]*):\s*([^ ]*)\s*(.*)")
/home/liudonghua/peda/peda.py:2316: SyntaxWarning: invalid escape sequence '\s'
m = re.findall(".*(0x[^ ]*)\s*%s" % re.escape(symname), out)
/home/liudonghua/peda/peda.py:2416: SyntaxWarning: invalid escape sequence '\['
p = re.compile(".*\[.*\] (\.[^ ]*) [^0-9]* ([^ ]*) [^ ]* ([^ ]*)(.*)")
/home/liudonghua/peda/peda.py:2474: SyntaxWarning: invalid escape sequence '\s'
p = re.compile("[^\n]*\s*(0x[^ ]*) - (0x[^ ]*) is (\.[^ ]*) in (.*)")
/home/liudonghua/peda/peda.py:2681: SyntaxWarning: invalid escape sequence '\ '
if re.search(re.escape(asmcode).replace("\ ",".*").replace("\?",".*"), asmcode_rs)\
/home/liudonghua/peda/peda.py:2681: SyntaxWarning: invalid escape sequence '\?'
if re.search(re.escape(asmcode).replace("\ ",".*").replace("\?",".*"), asmcode_rs)\
/home/liudonghua/peda/peda.py:2832: SyntaxWarning: invalid escape sequence '\ '
pattern = re.compile(b'|'.join(JMPCALL).replace(b' ', b'\ '))
/home/liudonghua/peda/peda.py:3414: SyntaxWarning: invalid escape sequence '\['
m = re.search(".*\[(.*)\]|.*?s:(0x[^ ]*)", exp)
/home/liudonghua/peda/peda.py:3519: SyntaxWarning: invalid escape sequence '\['
sock = re.search("socket:\[(.*)\]", rpath)
/home/liudonghua/peda/peda.py:3529: SyntaxWarning: invalid escape sequence '\s'
ppid = re.search("PPid:\s*([^\s]*)", status).group(1)
/home/liudonghua/peda/peda.py:3531: SyntaxWarning: invalid escape sequence '\s'
uid = re.search("Uid:\s*([^\n]*)", status).group(1)
/home/liudonghua/peda/peda.py:3533: SyntaxWarning: invalid escape sequence '\s'
gid = re.search("Gid:\s*([^\n]*)", status).group(1)
/home/liudonghua/peda/peda.py:4125: SyntaxWarning: invalid escape sequence '\s'
p = re.compile(".*?:\s*[^ ]*\s*([^,]*),(.*)")
Traceback (most recent call last):
File "/home/liudonghua/peda/peda.py", line 30, in <module>
from six.moves import range
ModuleNotFoundError: No module named 'six.moves'
Reading symbols from ./stack_overflow_32...
(gdb) exit
┌──(liudonghua㉿DESKTOP-9DGFF40)-[~/ctf]
└─$
┌──(liudonghua㉿DESKTOP-9DGFF40)-[~/ctf]
└─$ export PYTHONWARNINGS="ignore"
┌──(liudonghua㉿DESKTOP-9DGFF40)-[~/ctf]
└─$ gdb ./stack_overflow_32
GNU gdb (Debian 13.2-1+b2) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Traceback (most recent call last):
File "/home/liudonghua/peda/peda.py", line 30, in <module>
from six.moves import range
ModuleNotFoundError: No module named 'six.moves'
Reading symbols from ./stack_overflow_32...
(gdb) |
And for Details
|
oh,yes,it's working for me。Thanks |
There's a SyntaxWarning since Python 3.12 using peda.py at GDB startup. This was introduced here when the DeprecationWarning was upgraded to SyntaxWarning.
It should be fixed by using raw string literals (r"...").
The text was updated successfully, but these errors were encountered: