sensepost / UserEnum

Domain user enumeration tool
GNU General Public License v3.0
212 stars 43 forks source link

UserEnum_LDAP.py - ASN Issue #7

Open mlinton opened 5 years ago

mlinton commented 5 years ago

installed the requirements.txt within an virtualenv, when I go to run the UserEnum_LDAP.py I get an error:

File "UserEnum_LDAP.py", line 126, in <module>
    encoded = request_asn.encode('LDAPMessage3',message)
  File "/opt/UserEnum/venv/local/lib/python2.7/site-packages/asn1tools/compiler.py", line 133, in encode
    type_.check_types(data)
  File "/opt/UserEnum/venv/local/lib/python2.7/site-packages/asn1tools/codecs/compiler.py", line 91, in check_types
    return self.type_checker.encode(data)
  File "/opt/UserEnum/venv/local/lib/python2.7/site-packages/asn1tools/codecs/type_checker.py", line 304, in encode
    self._type.encode(data)
  File "/opt/UserEnum/venv/local/lib/python2.7/site-packages/asn1tools/codecs/type_checker.py", line 148, in encode
    member.encode(data[name])
  File "/opt/UserEnum/venv/local/lib/python2.7/site-packages/asn1tools/codecs/type_checker.py", line 148, in encode
    member.encode(data[name])
  File "/opt/UserEnum/venv/local/lib/python2.7/site-packages/asn1tools/codecs/type_checker.py", line 47, in encode
    data))
asn1tools.codecs.EncodeError: protocolOp: typesOnly: Expected data of type bool, but got 0.

Here are the modules installed:

(venv) root@ns7:/opt/UserEnum# pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org -r requirements.txt
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already satisfied: asn1tools in ./venv/lib/python2.7/site-packages (from -r requirements.txt (line 1)) (0.146.3)
Requirement already satisfied: scapy in ./venv/lib/python2.7/site-packages (from -r requirements.txt (line 2)) (2.4.2)
Requirement already satisfied: impacket in ./venv/lib/python2.7/site-packages (from -r requirements.txt (line 3)) (0.9.19)
Requirement already satisfied: diskcache in ./venv/lib/python2.7/site-packages (from asn1tools->-r requirements.txt (line 1)) (3.1.1)
Requirement already satisfied: bitstruct in ./venv/lib/python2.7/site-packages (from asn1tools->-r requirements.txt (line 1)) (7.1.0)
Requirement already satisfied: prompt-toolkit in ./venv/lib/python2.7/site-packages (from asn1tools->-r requirements.txt (line 1)) (2.0.9)
Requirement already satisfied: pyparsing>=2.2.0 in ./venv/lib/python2.7/site-packages (from asn1tools->-r requirements.txt (line 1)) (2.4.0)
Requirement already satisfied: flask>=1.0 in ./venv/lib/python2.7/site-packages (from impacket->-r requirements.txt (line 3)) (1.0.3)
Requirement already satisfied: pyasn1>=0.2.3 in ./venv/lib/python2.7/site-packages (from impacket->-r requirements.txt (line 3)) (0.4.5)
Requirement already satisfied: pycryptodomex in ./venv/lib/python2.7/site-packages (from impacket->-r requirements.txt (line 3)) (3.8.2)
Requirement already satisfied: six in ./venv/lib/python2.7/site-packages (from impacket->-r requirements.txt (line 3)) (1.12.0)
Requirement already satisfied: pyOpenSSL>=0.13.1 in ./venv/lib/python2.7/site-packages (from impacket->-r requirements.txt (line 3)) (19.0.0)
Requirement already satisfied: ldap3==2.5.1 in ./venv/lib/python2.7/site-packages (from impacket->-r requirements.txt (line 3)) (2.5.1)
Requirement already satisfied: ldapdomaindump in ./venv/lib/python2.7/site-packages (from impacket->-r requirements.txt (line 3)) (0.9.1)
Requirement already satisfied: wcwidth in ./venv/lib/python2.7/site-packages (from prompt-toolkit->asn1tools->-r requirements.txt (line 1)) (0.1.7)
Requirement already satisfied: itsdangerous>=0.24 in ./venv/lib/python2.7/site-packages (from flask>=1.0->impacket->-r requirements.txt (line 3)) (1.1.0)
Requirement already satisfied: Jinja2>=2.10 in ./venv/lib/python2.7/site-packages (from flask>=1.0->impacket->-r requirements.txt (line 3)) (2.10.1)
Requirement already satisfied: click>=5.1 in ./venv/lib/python2.7/site-packages (from flask>=1.0->impacket->-r requirements.txt (line 3)) (7.0)
Requirement already satisfied: Werkzeug>=0.14 in ./venv/lib/python2.7/site-packages (from flask>=1.0->impacket->-r requirements.txt (line 3)) (0.15.4)
Requirement already satisfied: cryptography>=2.3 in ./venv/lib/python2.7/site-packages (from pyOpenSSL>=0.13.1->impacket->-r requirements.txt (line 3)) (2.7)
Requirement already satisfied: dnspython in ./venv/lib/python2.7/site-packages (from ldapdomaindump->impacket->-r requirements.txt (line 3)) (1.16.0)
Requirement already satisfied: future in ./venv/lib/python2.7/site-packages (from ldapdomaindump->impacket->-r requirements.txt (line 3)) (0.17.1)
Requirement already satisfied: MarkupSafe>=0.23 in ./venv/lib/python2.7/site-packages (from Jinja2>=2.10->flask>=1.0->impacket->-r requirements.txt (line 3)) (1.1.1)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in ./venv/lib/python2.7/site-packages (from cryptography>=2.3->pyOpenSSL>=0.13.1->impacket->-r requirements.txt (line 3)) (1.12.3)
Requirement already satisfied: ipaddress; python_version < "3" in ./venv/lib/python2.7/site-packages (from cryptography>=2.3->pyOpenSSL>=0.13.1->impacket->-r requirements.txt (line 3)) (1.0.22)
Requirement already satisfied: enum34; python_version < "3" in ./venv/lib/python2.7/site-packages (from cryptography>=2.3->pyOpenSSL>=0.13.1->impacket->-r requirements.txt (line 3)) (1.1.6)
Requirement already satisfied: asn1crypto>=0.21.0 in ./venv/lib/python2.7/site-packages (from cryptography>=2.3->pyOpenSSL>=0.13.1->impacket->-r requirements.txt (line 3)) (0.24.0)
Requirement already satisfied: pycparser in ./venv/lib/python2.7/site-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.3->pyOpenSSL>=0.13.1->impacket->-r requirements.txt (line 3)) (2.19)
reanimat0r commented 5 years ago

I am getting the same error (not running in virtualenv):


UserEnum LDAP Ping POC - Reino Mostert/SensePost 2018 [*] Starting ... Traceback (most recent call last): File "UserEnum_LDAP.py", line 126, in encoded = requestasn.encode('LDAPMessage3',message) File "C:\Python27\lib\site-packages\asn1tools\compiler.py", line 133, in encode type.check_types(data) File "C:\Python27\lib\site-packages\asn1tools\codecs\compiler.py", line 91, in check_types return self.type_checker.encode(data) File "C:\Python27\lib\site-packages\asn1tools\codecs\type_checker.py", line 304, in encode self._type.encode(data) File "C:\Python27\lib\site-packages\asn1tools\codecs\type_checker.py", line 148, in encode member.encode(data[name]) File "C:\Python27\lib\site-packages\asn1tools\codecs\type_checker.py", line 148, in encode member.encode(data[name]) File "C:\Python27\lib\site-packages\asn1tools\codecs\type_checker.py", line 47, in encode data)) asn1tools.codecs.EncodeError: protocolOp: typesOnly: Expected data of type bool, but got 0.

juliourena commented 5 years ago

I solve the issue by installing asn1tools 0.100.0

root@plaintext:/opt/UserEnum# python UserEnum_LDAP.py 192.168.26.141 test.local userslist.txt                                                                 
UserEnum LDAP Ping POC - Reino Mostert/SensePost 2018                                                                                                            
[*] Starting ...                                                                                                                                                 
Traceback (most recent call last):                                                                                                                               
  File "UserEnum_LDAP.py", line 126, in <module>                                                                                                                 
    encoded = request_asn.encode('LDAPMessage3',message)                                                                                                         
  File "/usr/local/lib/python2.7/dist-packages/asn1tools/compiler.py", line 133, in encode                                                                       
    type_.check_types(data)                                                                                                                                      
  File "/usr/local/lib/python2.7/dist-packages/asn1tools/codecs/compiler.py", line 91, in check_types                                                 
    return self.type_checker.encode(data)                                                                                                                        
  File "/usr/local/lib/python2.7/dist-packages/asn1tools/codecs/type_checker.py", line 249, in encode                                                            
    self._type.encode(data)                                                                                                
  File "/usr/local/lib/python2.7/dist-packages/asn1tools/codecs/type_checker.py", line 146, in encode                                                                           
    member.encode(data[name])                                                                                                                                                   
  File "/usr/local/lib/python2.7/dist-packages/asn1tools/codecs/type_checker.py", line 146, in encode                           
    member.encode(data[name])                                                                                                                                                   
  File "/usr/local/lib/python2.7/dist-packages/asn1tools/codecs/type_checker.py", line 45, in encode                                                                            
    data))                                  
asn1tools.codecs.EncodeError: protocolOp: typesOnly: Expected data of type bool, but got 0.      

root@plaintext:/opt/UserEnum# pip install asn1tools==0.100.0                                                                                                                    
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of p
ip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting asn1tools==0.100.0                                                           
  Downloading https://files.pythonhosted.org/packages/31/69/403217e31261cdbc2ba11520419dbcf6228d5450c8877c1336b80090b9c0/asn1tools-0.100.0-py2.py3-none-any.whl (60kB)
     |████████████████████████████████| 61kB 346kB/s                                    
Requirement already satisfied: bitstruct in /usr/local/lib/python2.7/dist-packages (from asn1tools==0.100.0) (8.0.0)                                                            
Requirement already satisfied: pyparsing>=2.2.0 in /usr/lib/python2.7/dist-packages (from asn1tools==0.100.0) (2.2.0)                                                           
Requirement already satisfied: prompt-toolkit in /usr/local/lib/python2.7/dist-packages (from asn1tools==0.100.0) (2.0.9)                                                       
Requirement already satisfied: six>=1.9.0 in /usr/lib/python2.7/dist-packages (from prompt-toolkit->asn1tools==0.100.0) (1.12.0)                                                
Requirement already satisfied: wcwidth in /usr/local/lib/python2.7/dist-packages (from prompt-toolkit->asn1tools==0.100.0) (0.1.7)                                              
Installing collected packages: asn1tools                                                
  Found existing installation: asn1tools 0.128.0                                        
    Uninstalling asn1tools-0.128.0:                                                     
      Successfully uninstalled asn1tools-0.128.0                                        
Successfully installed asn1tools-0.100.0                  

root@plaintext:/opt/UserEnum# python UserEnum_LDAP.py 192.168.26.141 test.local userslist.txt                                                                                
UserEnum LDAP Ping POC - Reino Mostert/SensePost 2018                                   
[*] Starting ...                            
[+] Administrator exist                                          
[*] Done                                    
pich4ya commented 4 years ago

pip install asn1tools==0.100.0

works!