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

[bug] Add default to domain variable to fix NoneType exception #14

Merged
merged 1 commit into from
Jun 4, 2024
Merged

[bug] Add default to domain variable to fix NoneType exception #14

merged 1 commit into from
Jun 4, 2024

Conversation

skorov
Copy link
Contributor

@skorov skorov commented Jun 4, 2024

Heyo!

Just a quick fix for a bug when authenticating without providing a domain...

               _          _ _            _
 ___ _ __ ___ | |__   ___| (_) ___ _ __ | |_      _ __   __ _
/ __| '_ ` _ \| '_ \ / __| | |/ _ \ '_ \| __|____| '_ \ / _` |
\__ \ | | | | | |_) | (__| | |  __/ | | | ||_____| | | | (_| |
|___/_| |_| |_|_.__/ \___|_|_|\___|_| |_|\__|    |_| |_|\__, |
    by @podalirius_                             v1.3.1  |___/

Traceback (most recent call last):
  File "/home/a/.local/pipx/venvs/smbclientng/lib/python3.11/site-packages/impacket/ntlm.py", line 576, in getNTLMSSPType1
    domain.encode('utf-16le')
    ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'encode'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/a/.local/bin/smbng", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/a/.local/pipx/venvs/smbclientng/lib/python3.11/site-packages/smbclientng/__main__.py", line 100, in main
    smbSession.init_smb_session()
  File "/home/a/.local/pipx/venvs/smbclientng/lib/python3.11/site-packages/smbclientng/core/SMBSession.py", line 124, in init_smb_session
    self.connected = self.smbClient.login(
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/home/a/.local/pipx/venvs/smbclientng/lib/python3.11/site-packages/impacket/smbconnection.py", line 278, in login
    return self._SMBConnection.login(user, password, domain, lmhash, nthash)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/a/.local/pipx/venvs/smbclientng/lib/python3.11/site-packages/impacket/smb3.py", line 931, in login
    auth = ntlm.getNTLMSSPType1(self._Connection['ClientName'],domain, self._Connection['RequireSigning'])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/a/.local/pipx/venvs/smbclientng/lib/python3.11/site-packages/impacket/ntlm.py", line 578, in getNTLMSSPType1
    domain = domain.decode(encoding)
             ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'decode'

The fix simply adds a default value of . to the domain arg. This is a valid domain that means the target local host's namespace.

Happy hacking! 🙂

@p0dalirius p0dalirius self-assigned this Jun 4, 2024
@p0dalirius p0dalirius added the bug Something isn't working label Jun 4, 2024
@p0dalirius p0dalirius changed the title Add default to domain variable to fix NoneType exception [bug] Add default to domain variable to fix NoneType exception Jun 4, 2024
@p0dalirius
Copy link
Owner

Hi!

Nice find, I did not see that, thank you for the fix!

Merging now.

Best regards,

@p0dalirius p0dalirius merged commit 39a9486 into p0dalirius:main Jun 4, 2024
2 checks passed
p0dalirius pushed a commit that referenced this pull request Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants