ShawnDEvans / smbmap

SMBMap is a handy SMB enumeration tool
GNU General Public License v3.0
1.76k stars 343 forks source link

Fix/stringbinding usage #104

Open Ladeia opened 3 months ago

Ladeia commented 3 months ago

fix stringbinding command on smbmap.py file

SukiCZ commented 2 months ago

When I upgrade smbmap from apt I get a warning

  /usr/lib/python3/dist-packages/smbmap/smbmap.py:441: SyntaxWarning: invalid escape sequence '\p'
  stringbinding = 'ncacn_np:%s[\pipe\svcctl]' % remoteName

When I create a python script

# /tmp/foo.py
stringbinding = 'ncacn_np:%s[\pipe\svcctl]' % 'remoteName'

and check it with python3 -Wd /tmp/foo.py I'm able to reproduce the SyntaxWarning

/tmp/foo.py:2: SyntaxWarning: invalid escape sequence '\p'
  stringbinding = 'ncacn_np:%s[\pipe\svcctl]' % 'remoteName'

I think that might be the motivation of this change, however it changes the meaning of that string.

To resolve this, I would suggest to use raw-string (with r prefix) and change the line to

stringbinding = r'ncacn_np:%s[\pipe\svcctl]' % remoteName

Note: I'm not a contributor, I just want my apt upgrade to be happy :blush:

Ladeia commented 2 months ago

Thanks @SukiCZ. I applied your suggestion in PR.