byt3bl33d3r / CrackMapExec

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

Missing hidden import for impacket.ldap in the spec file #475

Closed Qazeer closed 2 years ago

Qazeer commented 3 years ago

The PythonInstaller spec file crackmapexec.spec is missing an hidden import for impacket.ldap.

Compiling a Windows standalone version of cme using the current spec file result in the following error:

image

After adding impacket.ldap.ldap in the spec file hidden imports, the standalone build works properly: image

Quick fix not worthy of a PR imo but I can do one if needed.

mpgn commented 3 years ago

Can you submit a PR ? :)

Qazeer commented 3 years ago

Yes, will do!

I have also noticed that adding the following custom PyInstaller hook for lsassy fixes the error The 'lsassy' distribution was not found and is required by the application (referenced here: #456) whenever building standalone binaries:

# -*- coding:utf-8 -*-

from PyInstaller.utils.hooks import collect_all
datas, binaries, hiddenimports = collect_all("lsassy")

The hookspath argument in the PyInstaller spec file should point to the folder containing the hook file. I have scripted that part here.

If the fix seems ok to you, any preference on how to implement it (a new file in the main folder / a dedicated folder)?