byt3bl33d3r / CrackMapExec

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

please migrate away from pycrypto #283

Closed blshkv closed 5 years ago

blshkv commented 5 years ago

the current requirement is to install pycrypto. This library is old and no longer supported. Please migrate to pycryptodomex.

As a temporary solution you can keep the required version under thirdparty directory and make sure it has a priority over systemwide libraries.

byt3bl33d3r commented 5 years ago

Already done (sorta), It's a dependency of impacket not CME and they already switched over to pycryptodomex. When the PY3 re-write drops pycrypto will be long gone

blshkv commented 5 years ago

can you get rid of embedded outdated impacket then? That package drags the whole thing down.

byt3bl33d3r commented 5 years ago

Forgot about that, will do. Thanks!

blshkv commented 5 years ago

FYI, I have removed impacket from the thirdparty directory and tested smb module (it wasn't working with pycryptodome before. Everything seems work fine, thanks for the hint!

P.S. Dont forgot to change the requirements.txt from pycrypto to impacket

whoot commented 5 years ago

I can confirm this! The only parameter working for now is --shares. Everything else just wont return a result. With --verbose I get:

crackmapexec 192.168.178.44 -d . -u Test -p SuperSecur3! --sam --verbose
DEBUG                                          {'domain': '.', 'wdigest': None, 'verbose': True, 'sam': True, 'cred_id': [], 'module_options': [], 'fail_limit': None, 'share': 'C$', 'lusers': False, 'module': None, 'smb_port': 445, 'show_options': False, 'rid_brute': None, 'uac': False, 'ufail_limit': None, 'pass_pol': False, 'regex': None, 'list_modules': False, 'no_output': False, 'pattern': None, 'lsa': False, 'force_ps32': False, 'shares': False, 'content': False, 'server_host': '0.0.0.0', 'wmi': None, 'exclude_dirs': '', 'server_port': None, 'wmi_namespace': '//./root/cimv2', 'gfail_limit': None, 'mssql_query': None, 'username': ['Test'], 'hash': [], 'users': False, 'sessions': False, 'exec_method': None, 'spider': None, 'ps_execute': None, 'threads': 100, 'mssql_port': 1433, 'password': ['SuperSecur3!'], 'mssql': False, 'mssql_auth': 'windows', 'ntds_pwdLastSet': False, 'execute': None, 'target': ['192.168.178.44'], 'ntds_history': False, 'disks': False, 'ntds': None, 'server': 'https', 'depth': 10, 'local_auth': False, 'timeout': 20}
CME          192.168.178.44:445 BLABLA         [*] Windows 10.0 Build 16299 (name:BLABLA) (domain:REDACTED)
DEBUG                                          Your pycrypto doesn't support AES.MODE_CCM. Currently only pycrypto experimental supports this mode.
Download it from https://www.dlitz.net/software/pycrypto
DEBUG                                          Your pycrypto doesn't support AES.MODE_CCM. Currently only pycrypto experimental supports this mode.
Download it from https://www.dlitz.net/software/pycrypto
CME          192.168.178.44:445 BLABLA         [+] .\Test:SuperSecur3! 
[*] KTHXBYE!

Installed it on Kali Linux via apt-get. Any recommendations for a short-time fix?

EDIT: Installed the experimental version of pycrypto (2.7a1). Error message is gone, but i dont get any output:

crackmapexec 192.168.178.44 -d . -u Test -p SuperSecur3! --sam --verbose
DEBUG                                          {'domain': '.', 'wdigest': None, 'verbose': True, 'sam': True, 'cred_id': [], 'module_options': [], 'fail_limit': None, 'share': 'C$', 'lusers': False, 'module': None, 'smb_port': 445, 'show_options': False, 'rid_brute': None, 'uac': False, 'ufail_limit': None, 'pass_pol': False, 'regex': None, 'list_modules': False, 'no_output': False, 'pattern': None, 'lsa': False, 'force_ps32': False, 'shares': False, 'content': False, 'server_host': '0.0.0.0', 'wmi': None, 'exclude_dirs': '', 'server_port': None, 'wmi_namespace': '//./root/cimv2', 'gfail_limit': None, 'mssql_query': None, 'username': ['Test'], 'hash': [], 'users': False, 'sessions': False, 'exec_method': None, 'spider': None, 'ps_execute': None, 'threads': 100, 'mssql_port': 1433, 'password': ['SuperSecur3!'], 'mssql': False, 'mssql_auth': 'windows', 'ntds_pwdLastSet': False, 'execute': None, 'target': ['192.168.178.44'], 'ntds_history': False, 'disks': False, 'ntds': None, 'server': 'https', 'depth': 10, 'local_auth': False, 'timeout': 20}
CME          192.168.178.44:445 BLABLA         [*] Windows 10.0 Build 16299 (name:BLABLA) (domain:REDACTED)
CME          192.168.178.44:445 BLABLA         [+] .\Test:SuperSecur3!

It is also weird, that the user is not recognized as admin, but i have given him admin rights!

blshkv commented 5 years ago

@whoot you need to remove the bundled impacket and install the latest (0.9.18 in Pentoo). It does not require pycrypto and the error message will be gone. However, I'm not sure if cme supports the latest impacket fully, that still need to be tested.

P.S. Feel free to test cme using Pentoo Linux, we have tried to fix this issue over there.

whoot commented 5 years ago

@blshkv did also an upgrade to impacket 0.9.19dev. Error message is gone.

byt3bl33d3r commented 5 years ago

done in 333f1c4e06884e85b2776459963ef85d182aba8e

blshkv commented 5 years ago

I hope you have tested the functionality since @whoot reported that some functions return blank results.

byt3bl33d3r commented 5 years ago

I tested basic functionality and it all seems to be working. If there's something funky feel free to open an issue to track it