Skip to content

Commit

Permalink
Update requirements.txt
Browse files Browse the repository at this point in the history
FIX: ValueError: unsupported hash type MD4
  • Loading branch information
p4yl0ad authored Mar 27, 2024
1 parent 80fcc13 commit 3a4e7a6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ldap3
sectools>=1.4.3
pycryptodome==3.20.0

1 comment on commit 3a4e7a6

@p4yl0ad
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor change based on ldap3, practically a non issue

(.venv) 11:10:47-user@computer:/opt/LDAPmonitor/python$ python3 pyLDAPmonitor.py --dc-ip 192.168.154.20 --kdcHost dc01.contoso.local -d contoso.local -u domainadmin -p Password123! 
[+]======================================================
[+]    LDAP live monitor v1.3        @podalirius_        
[+]======================================================

[>] Trying to connect to 192.168.154.20 ...
Traceback (most recent call last):
  File "/opt/LDAPmonitor/python/.venv/lib/python3.11/site-packages/ldap3/utils/ntlm.py", line 500, in ntowf_v2
    from Crypto.Hash import MD4  # try with the Crypto library if present
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'Crypto'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/LDAPmonitor/python/pyLDAPmonitor.py", line 339, in <module>
    raise e
  File "/opt/LDAPmonitor/python/pyLDAPmonitor.py", line 305, in <module>
    ldap_server, ldap_session = init_ldap_session(
                                ^^^^^^^^^^^^^^^^^^
  File "/opt/LDAPmonitor/python/.venv/lib/python3.11/site-packages/sectools/windows/ldap.py", line 239, in init_ldap_session
    return __init_ldap_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/LDAPmonitor/python/.venv/lib/python3.11/site-packages/sectools/windows/ldap.py", line 194, in __init_ldap_connection
    ldap_session = ldap3.Connection(
                   ^^^^^^^^^^^^^^^^^
  File "/opt/LDAPmonitor/python/.venv/lib/python3.11/site-packages/ldap3/core/connection.py", line 363, in __init__
    self._do_auto_bind()
  File "/opt/LDAPmonitor/python/.venv/lib/python3.11/site-packages/ldap3/core/connection.py", line 389, in _do_auto_bind
    self.bind(read_server_info=True)
  File "/opt/LDAPmonitor/python/.venv/lib/python3.11/site-packages/ldap3/core/connection.py", line 628, in bind
    response = self.do_ntlm_bind(controls)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/LDAPmonitor/python/.venv/lib/python3.11/site-packages/ldap3/core/connection.py", line 1394, in do_ntlm_bind
    request = bind_operation(self.version, 'SICILY_RESPONSE_NTLM', ntlm_client,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/LDAPmonitor/python/.venv/lib/python3.11/site-packages/ldap3/operation/bind.py", line 81, in bind_operation
    server_creds = name.create_authenticate_message()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/LDAPmonitor/python/.venv/lib/python3.11/site-packages/ldap3/utils/ntlm.py", line 379, in create_authenticate_message
    nt_challenge_response = self.compute_nt_response()
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/LDAPmonitor/python/.venv/lib/python3.11/site-packages/ldap3/utils/ntlm.py", line 485, in compute_nt_response
    response_key_nt = self.ntowf_v2()
                      ^^^^^^^^^^^^^^^
  File "/opt/LDAPmonitor/python/.venv/lib/python3.11/site-packages/ldap3/utils/ntlm.py", line 503, in ntowf_v2
    raise e  # raise original exception
    ^^^^^^^
  File "/opt/LDAPmonitor/python/.venv/lib/python3.11/site-packages/ldap3/utils/ntlm.py", line 497, in ntowf_v2
    password_digest = hashlib.new('MD4', self._password.encode('utf-16-le')).digest()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/hashlib.py", line 166, in __hash_new
    return __get_builtin_constructor(name)(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type MD4
(.venv) 11:10:51-user@computer:/opt/LDAPmonitor/python$ pip install pycryptodome
Collecting pycryptodome
  Downloading pycryptodome-3.20.0-cp35-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 3.2 MB/s eta 0:00:00
Installing collected packages: pycryptodome
Successfully installed pycryptodome-3.20.0
(.venv) 11:11:10-user@computer:/opt/LDAPmonitor/python$ python3 pyLDAPmonitor.py --dc-ip 192.168.154.20 --kdcHost dc01.contoso.local -d contoso.local -u domainadmin -p Password123! 
[+]======================================================
[+]    LDAP live monitor v1.3        @podalirius_        
[+]======================================================

[>] Trying to connect to 192.168.154.20 ...
[>] Listening for LDAP changes ...
[2024-03-27 11:11:43] CN=HealthMailbox54857b40c8f64df8b6f9df058346e6bc,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=contoso,DC=local
 | Attribute "lastLogon" changed from '2024-03-27 11:10:30.559156+00:00' to '2024-03-27 11:11:39.115274+00:00'
 | Attribute "logonCount" changed from '1198' to '1200'
[...REDACTED FOR BREVITY...]

Please sign in to comment.