ShawnDEvans / smbmap

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

SyntaxWarning: "is not" with a literal. Did you mean "!=?" #61

Open ranguli opened 4 years ago

ranguli commented 4 years ago

Ran into this issue on Kali Linux, running Python 3.8.2. I'm not able to replicate it outside of my Kali Linux VM however.

kali@kali:~$ smbmap -H 10.10.10.3
/usr/lib/python3/dist-packages/impacket/smbserver.py:2465: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if jtr_dump_path is not '':
/usr/lib/python3/dist-packages/impacket/smbserver.py:2501: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if jtr_dump_path is not '':
/usr/lib/python3/dist-packages/impacket/smbserver.py:2843: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if jtr_dump_path is not '':
/usr/lib/python3/dist-packages/impacket/smbserver.py:4417: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if credentials_fname is not "":
/usr/lib/python3/dist-packages/impacket/krb5/kerberosv5.py:169: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if supportedCiphers[0] in (constants.EncryptionTypes.aes128_cts_hmac_sha1_96.value, constants.EncryptionTypes.aes256_cts_hmac_sha1_96.value) and aesKey is '':
/usr/lib/python3/dist-packages/impacket/krb5/kerberosv5.py:302: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if lmhash is b'' and nthash is b'' and (aesKey is b'' or aesKey is None):
/usr/lib/python3/dist-packages/impacket/krb5/kerberosv5.py:302: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if lmhash is b'' and nthash is b'' and (aesKey is b'' or aesKey is None):
/usr/lib/python3/dist-packages/impacket/krb5/kerberosv5.py:302: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if lmhash is b'' and nthash is b'' and (aesKey is b'' or aesKey is None):
/usr/lib/python3/dist-packages/impacket/krb5/kerberosv5.py:579: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if lmhash is b'' and nthash is b'' and (aesKey is b'' or aesKey is None) and TGT is None and TGS is None:
/usr/lib/python3/dist-packages/impacket/krb5/kerberosv5.py:579: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if lmhash is b'' and nthash is b'' and (aesKey is b'' or aesKey is None) and TGT is None and TGS is None:
/usr/lib/python3/dist-packages/impacket/krb5/kerberosv5.py:579: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if lmhash is b'' and nthash is b'' and (aesKey is b'' or aesKey is None) and TGT is None and TGS is None:
/usr/lib/python3/dist-packages/impacket/krb5/kerberosv5.py:607: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if lmhash is b'' and nthash is b'' and (aesKey is b'' or aesKey is None) and TGT is None and TGS is None:
/usr/lib/python3/dist-packages/impacket/krb5/kerberosv5.py:607: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if lmhash is b'' and nthash is b'' and (aesKey is b'' or aesKey is None) and TGT is None and TGS is None:
/usr/lib/python3/dist-packages/impacket/krb5/kerberosv5.py:607: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if lmhash is b'' and nthash is b'' and (aesKey is b'' or aesKey is None) and TGT is None and TGS is None:
/usr/lib/python3/dist-packages/impacket/smbconnection.py:351: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if lmhash is '' and nthash is '' and (aesKey is '' or aesKey is None) and TGT is None and TGS is None:
/usr/lib/python3/dist-packages/impacket/smbconnection.py:351: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if lmhash is '' and nthash is '' and (aesKey is '' or aesKey is None) and TGT is None and TGS is None:
/usr/lib/python3/dist-packages/impacket/smbconnection.py:351: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if lmhash is '' and nthash is '' and (aesKey is '' or aesKey is None) and TGT is None and TGS is None:
/usr/lib/python3/dist-packages/impacket/dcerpc/v5/ndr.py:1336: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.structure is ():
/usr/lib/python3/dist-packages/impacket/dcerpc/v5/ndr.py:1423: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self.structure is ():
/usr/lib/python3/dist-packages/impacket/dcerpc/v5/dcom/wmi.py:2412: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if itemValue is '':
[!] Authentication error on 10.10.10.3

Any ideas what may be causing this?

ShawnDEvans commented 4 years ago

It seems that these are all just syntax warnings, not errors. You may have verbose logging enabled in your Python environment. I would recommend maybe upgrading Impacket. From what I understand versions prior to .9.21 have issues with NULL sessions. It should be easy, zero length string for username and password, but it fails. If you noodle with the the username you can sometimes coax it into working, try a space:

$ smbmap -H 10.10.10.3 -u ' ' -p ' '

It's a frustratingly inconsistent solution, but in doing testing I found that redefining NULL as a space made a difference. Anyways update Impacket, and try using a space as a username. Good luck and lemme know. I'd love to kill this bug.