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

SyntaxWarning: Invalid Escape Sequence #223

Open
Arszilla opened this issue Mar 13, 2024 · 1 comment
Open

SyntaxWarning: Invalid Escape Sequence #223

Arszilla opened this issue Mar 13, 2024 · 1 comment

Comments

@Arszilla
Copy link

Arszilla commented Mar 13, 2024

Hey @Tib3rius,

I have created a provisional Debian package for autorecon - per https://bugs.kali.org/view.php?id=7870. The following files and lines seem to annoy apt, where it displayed a SyntaxWarning highlighting that these lines are using an invalid escape sequence.

  • autorecon/default-plugins/bruteforce-ftp.py:11
  • autorecon/default-plugins/bruteforce-rdp.py:11
  • autorecon/default-plugins/bruteforce-smb.py:11
  • autorecon/default-plugins/enum4linux.py:13
  • autorecon/default-plugins/lookup-sid.py:11
  • autorecon/default-plugins/nbtscan.py:11
  • autorecon/default-plugins/nmap-ftp.py:11
  • autorecon/default-plugins/nmap-mssql.py:11
  • autorecon/default-plugins/nmap-rdp.py:11
  • autorecon/default-plugins/nmap-rmi.py:11
  • autorecon/default-plugins/nmap-smb.py:11
  • autorecon/default-plugins/smb-vuln.py:11
  • autorecon/default-plugins/smbclient.py:11
  • autorecon/default-plugins/smbmap.py:11
  • autorecon/main.py:518
  • autorecon/main.py:1238
  • autorecon/plugins.py:230
  • autorecon/plugins.py:257

Full details below:

/usr/lib/python3/dist-packages/autorecon/default-plugins/bruteforce-ftp.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service_name(['^ftp', '^ftp\-data'])
/usr/lib/python3/dist-packages/autorecon/default-plugins/bruteforce-rdp.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service_name(['^rdp', '^ms\-wbt\-server', '^ms\-term\-serv'])
/usr/lib/python3/dist-packages/autorecon/default-plugins/bruteforce-rdp.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service_name(['^rdp', '^ms\-wbt\-server', '^ms\-term\-serv'])
/usr/lib/python3/dist-packages/autorecon/default-plugins/bruteforce-smb.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service('tcp', 445, '^microsoft\-ds')
/usr/lib/python3/dist-packages/autorecon/default-plugins/enum4linux.py:13: SyntaxWarning: invalid escape sequence '\-'
  self.match_service_name(['^ldap', '^smb', '^microsoft\-ds', '^netbios'])
/usr/lib/python3/dist-packages/autorecon/default-plugins/lookup-sid.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service('tcp', 445, '^microsoft\-ds')
/usr/lib/python3/dist-packages/autorecon/default-plugins/nbtscan.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service_name(['^smb', '^microsoft\-ds', '^netbios'])
/usr/lib/python3/dist-packages/autorecon/default-plugins/nmap-ftp.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service_name(['^ftp', '^ftp\-data'])
/usr/lib/python3/dist-packages/autorecon/default-plugins/nmap-mssql.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service_name(['^mssql', '^ms\-sql'])
/usr/lib/python3/dist-packages/autorecon/default-plugins/nmap-rdp.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service_name(['^rdp', '^ms\-wbt\-server', '^ms\-term\-serv'])
/usr/lib/python3/dist-packages/autorecon/default-plugins/nmap-rdp.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service_name(['^rdp', '^ms\-wbt\-server', '^ms\-term\-serv'])
/usr/lib/python3/dist-packages/autorecon/default-plugins/nmap-rmi.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service_name(['^java\-rmi', '^rmiregistry'])
/usr/lib/python3/dist-packages/autorecon/default-plugins/nmap-smb.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service_name(['^smb', '^microsoft\-ds', '^netbios'])
/usr/lib/python3/dist-packages/autorecon/default-plugins/smb-vuln.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service_name(['^smb', '^microsoft\-ds', '^netbios'])
/usr/lib/python3/dist-packages/autorecon/default-plugins/smbclient.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service_name(['^smb', '^microsoft\-ds', '^netbios'])
/usr/lib/python3/dist-packages/autorecon/default-plugins/smbmap.py:11: SyntaxWarning: invalid escape sequence '\-'
  self.match_service_name(['^smb', '^microsoft\-ds', '^netbios'])
/usr/lib/python3/dist-packages/autorecon/main.py:518: SyntaxWarning: invalid escape sequence '\/'
  match = re.search('(?P<protocol>(tcp|udp))\/(?P<port>\d+)\/(?P<service>[\w\-]+)(\/(?P<secure>secure|insecure))?', forced_service)
/usr/lib/python3/dist-packages/autorecon/main.py:1238: SyntaxWarning: invalid escape sequence '\-'
  match = re.search('^([0-9]+)\-([0-9]+)$', port)
/usr/lib/python3/dist-packages/autorecon/plugins.py:230: SyntaxWarning: invalid escape sequence '\-'
  self.__slug_regex = re.compile('^[a-z0-9\-]+$')
/usr/lib/python3/dist-packages/autorecon/plugins.py:257: SyntaxWarning: invalid escape sequence '\d'
  regex = '^(?P<port>\d+)\/(?P<protocol>(tcp|udp))(.*)open(\s*)(?P<service>[\w\-\/]+)(\s*)(.*)$'

This problem can be fixed by using either:

  1. A raw string (i.e. r'\s+')
  2. Escaping the backslash (i.e. '\\s+')
@Arszilla
Copy link
Author

autorecon has been added to Kali, and Dani has applied a patch to fix this: https://gitlab.com/kalilinux/packages/autorecon/-/commit/0026e00960f7765e1275f450bdafaddb1c186806

I'll leave it open for you to decide on how to address this going forward @Tib3rius :)

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

No branches or pull requests

1 participant