byt3bl33d3r / CrackMapExec

A swiss army knife for pentesting networks
BSD 2-Clause "Simplified" License
8.46k stars 1.64k forks source link

AttributeError: 'module' object has no attribute 'SSL_ST_INIT' #219

Closed sec0ps closed 6 years ago

sec0ps commented 7 years ago

Steps to reproduce

On Ubuntu 16: pip install crackmapexec

Detailed issue explanation

$ crackmapexec Traceback (most recent call last): File "/usr/local/bin/crackmapexec", line 7, in from cme.crackmapexec import main File "/usr/local/lib/python2.7/dist-packages/cme/crackmapexec.py", line 10, in from cme.connection import Connection File "/usr/local/lib/python2.7/dist-packages/gevent-1.2.2-py2.7-linux-x86_64.egg/gevent/builtins.py", line 93, in import result = _import(*args, kwargs) File "/usr/local/lib/python2.7/dist-packages/cme/connection.py", line 10, in from impacket import tds File "/usr/local/lib/python2.7/dist-packages/gevent-1.2.2-py2.7-linux-x86_64.egg/gevent/builtins.py", line 93, in import result = _import(*args, *kwargs) File "/usr/local/lib/python2.7/dist-packages/impacket/tds.py", line 36, in import OpenSSL File "/usr/local/lib/python2.7/dist-packages/gevent-1.2.2-py2.7-linux-x86_64.egg/gevent/builtins.py", line 93, in import result = _import(args, kwargs) File "/usr/lib/python2.7/dist-packages/OpenSSL/init.py", line 8, in from OpenSSL import rand, crypto, SSL File "/usr/local/lib/python2.7/dist-packages/gevent-1.2.2-py2.7-linux-x86_64.egg/gevent/builtins.py", line 93, in import result = _import(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 118, in SSL_ST_INIT = _lib.SSL_ST_INIT AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

Removed crackmapexec via pip and reinstalled using pipenv

$ sudo apt-get install -y libssl-dev libffi-dev python-dev build-essential build-essential is already the newest version (12.1ubuntu2). libffi-dev is already the newest version (3.2.1-4). python-dev is already the newest version (2.7.11-1). libssl-dev is already the newest version (1.0.2g-1ubuntu4.9). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ sudo pip install --user pipenv Requirement already satisfied: pipenv in /home/user/.local/lib/python2.7/site-packages Requirement already satisfied: pip>=9.0.1 in /usr/local/lib/python2.7/dist-packages (from pipenv) Requirement already satisfied: virtualenv in /home/user/.local/lib/python2.7/site-packages (from pipenv) Requirement already satisfied: requests>2.18.0 in /usr/local/lib/python2.7/dist-packages (from pipenv) Requirement already satisfied: flake8>=3.0.0 in /home/user/.local/lib/python2.7/site-packages (from pipenv) Requirement already satisfied: pew>=0.1.26 in /home/user/.local/lib/python2.7/site-packages (from pipenv) Requirement already satisfied: urllib3>=1.21.1 in /usr/local/lib/python2.7/dist-packages (from pipenv) Requirement already satisfied: idna<2.6,>=2.5 in /usr/local/lib/python2.7/dist-packages (from requests>2.18.0->pipenv) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/dist-packages (from requests>2.18.0->pipenv) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/dist-packages (from requests>2.18.0->pipenv) Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in /home/user/.local/lib/python2.7/site-packages (from flake8>=3.0.0->pipenv) Requirement already satisfied: enum34; python_version < "3.4" in /usr/lib/python2.7/dist-packages (from flake8>=3.0.0->pipenv) Requirement already satisfied: configparser; python_version < "3.2" in /home/user/.local/lib/python2.7/site-packages (from flake8>=3.0.0->pipenv) Requirement already satisfied: pycodestyle<2.4.0,>=2.0.0 in /home/user/.local/lib/python2.7/site-packages (from flake8>=3.0.0->pipenv) Requirement already satisfied: pyflakes<1.7.0,>=1.5.0 in /home/user/.local/lib/python2.7/site-packages (from flake8>=3.0.0->pipenv) Requirement already satisfied: pathlib; python_version == "2.7" in /home/user/.local/lib/python2.7/site-packages (from pew>=0.1.26->pipenv) Requirement already satisfied: virtualenv-clone>=0.2.5 in /home/user/.local/lib/python2.7/site-packages (from pew>=0.1.26->pipenv) Requirement already satisfied: shutilwhich; python_version == "2.7" in /home/user/.local/lib/python2.7/site-packages (from pew>=0.1.26->pipenv) Requirement already satisfied: backports.shutil-get-terminal-size; python_version == "2.7" in /home/user/.local/lib/python2.7/site-packages (from pew>=0.1.26->pipenv) Requirement already satisfied: setuptools>=17.1 in /usr/lib/python2.7/dist-packages (from pew>=0.1.26->pipenv)

$ cd CrackMapExec && pipenv install Traceback (most recent call last): File "/home/user/.local/bin/pipenv", line 7, in from pipenv import cli File "/home/user/.local/lib/python2.7/site-packages/pipenv/init.py", line 17, in from .cli import cli File "/home/user/.local/lib/python2.7/site-packages/pipenv/cli.py", line 21, in import requests File "/usr/local/lib/python2.7/dist-packages/requests/init.py", line 84, in from urllib3.contrib import pyopenssl File "/usr/local/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 46, in import OpenSSL.SSL File "/usr/lib/python2.7/dist-packages/OpenSSL/init.py", line 8, in from OpenSSL import rand, crypto, SSL File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 118, in SSL_ST_INIT = _lib.SSL_ST_INIT AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

sec0ps commented 7 years ago

Turned out to be a version issue with pyOpenSSL. Removed and reinstall, fixed SSL issue.

pip uninstall pyOpenSSL && pip install pyOpenSSL

$ cme -v 3.1.5 - 'Smidge'

byt3bl33d3r commented 6 years ago

Glad you got it working :)

vhosakot commented 6 years ago

I saw the AttributeError: 'module' object has no attribute 'SSL_ST_INIT' error too and sudo pip install pyOpenSSL==16.2.0 resolved it for me!

shawnbrito commented 6 years ago

I had the same issue, and nothing worked for me except physically deleting these folders.. I got the tip from https://stackoverflow.com/questions/45188413/python-pip-install-is-failing-with-attributeerror-module-object-has-no-att

rm -rf /usr/lib/python2.7/dist-packages/OpenSSL rm -rf /usr/lib/python2.7/dist-packages/pyOpenSSL-0.15.1.egg-info sudo pip install pyopenssl

This worked!!!