Skip to content
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

invalid escape sequence & six.moves not found fixed #179

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

punixcorn
Copy link

@punixcorn punixcorn commented Jul 4, 2024

issue #177 fixes applied

1. fix SyntaxWarning

adding r to the strings or replace b'...' with r'...' , based on the warning
eg

 p = re.compile(r"(.*)\[(.*)\]") # DWORD PTR [esi+eax*1]

to make it raw string, pull request #178 fixes this.


2. fix six.moves not found

using

pip install six # old 
sudo apt install python3-six # debian
sudo pacman -S python-six # arch linux
sudo dnf install python3-six

and remove the six.py in the lib/
so it uses the global ones and not the local one found in lib

@punixcorn punixcorn changed the title SyntaxWarning: invalid escape sequence #177 fixed SyntaxWarning: invalid escape sequence fixed Jul 4, 2024
@punixcorn punixcorn changed the title SyntaxWarning: invalid escape sequence fixed invalid escape sequence & six.moves not found fixed Jul 4, 2024
@jimdiroffii
Copy link

Hey @punixcorn, thanks for working on a fix for the reported issue. I had the same problem with six and invalid escape sequence when I tried to load up gdb today. I cloned your fork, which allowed gdb-peda to launch, but I still had a few invalid escape sequence errors. I couldn't open an issue on your fork, so i thought I would just drop this here.

$ gdb vuln                                       
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/ishmael/repos/peda/lib/utils.py:526: SyntaxWarning: invalid escape sequence '\s'
  m = re.search(".*(0x[^ ]*).*:\s*([^ ]*)", line)
/home/ishmael/repos/peda/lib/utils.py:543: SyntaxWarning: invalid escape sequence '\s'
  addr = re.search("(0x[^\s]*)", prefix)
/home/ishmael/repos/peda/lib/utils.py:592: SyntaxWarning: invalid escape sequence '\('
  charset += ['!"#$%&\()*+,-./:;<=>?@[]^_{|}~'] # string.punctuation
/home/ishmael/repos/peda/lib/nasm.py:85: SyntaxWarning: invalid escape sequence '\s'
  pattern = re.compile("([0-9A-F]{8})\s*([^\s]*)\s*(.*)")
Reading symbols from vuln...
(No debugging symbols found in vuln)
gdb-peda$

Taking your approach, I added r as a prefix to the strings in the four places indicated by the error. This seemed to fix it and no more errors on launch.

utils.py:526
utils.py:543
utils.py:543
nasm.py:85

GNU gdb (Debian 13.2-1+b2) 13.2
Python 3.11.9
Linux kali2024 6.8.11-amd64 #1 SMP PREEMPT_DYNAMIC Kali 6.8.11-1kali2 (2024-05-30) x86_64 GNU/Linux

Thanks!

@punixcorn
Copy link
Author

Hey @jimdiroffii , thanks for calling that out. I don't seem to have any more syntax errors on my end , but I will apply those changes to my fork. I am glad I was of help to you.

in lib/utils.py and lib/nasm.py
@CriimBow
Copy link

Hey @punixcorn, there seems to be a small typo in the README you are trying to merge, for debian it's python-six and not python-siz. Also, it looks like the package is python3-six

@punixcorn
Copy link
Author

@CriimBow i saw these typos, i fixed and applied the changes to my fork but forgot about it here, i will fix that shortly, thanks for calling it out

@L42yH4d3s
Copy link

i got this error and i don't know if i should make it raw string
GNU gdb (Debian 15.1-1) 15.1
Copyright (C) 2024 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/h3d4s/peda/peda.py:2837: SyntaxWarning: invalid escape sequence '\ '
pattern = re.compile(b'|'.join(JMPCALL).replace(b' ', b'\ '))

@punixcorn
Copy link
Author

@L42yH4d3s, yes you should.

        pattern = re.compile(r'|'.join(JMPCALL).replace(r' ', r'\ '))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants