impacket-examples-windows icon indicating copy to clipboard operation
impacket-examples-windows copied to clipboard

Error: pkg_resources.DistributionNotFound: The 'impacket' distribution was not found and is required by the application

Open nullcult opened this issue 5 years ago • 1 comments

Trying to follow your guide on compiling the binaries and am constantly getting the error below when i run the complied binary. I've searched everywhere but I can't find any hints. What could I be doing wrong?

Traceback (most recent call last):
  File "wmiexec.py", line 32, in <module>
  File "c:\users\root\appdata\local\temp\pip-install-bmnnbc\pyinstaller\PyInstaller\loader\pyimod03_importers.py", line 391, in load_module
  File "site-packages\impacket-0.9.22.dev1+20200327.103853.7e50589-py2.7.egg\impacket\version.py", line 11, in <module>
  File "site-packages\pkg_resources\__init__.py", line 481, in get_distribution
  File "site-packages\pkg_resources\__init__.py", line 357, in get_provider
  File "site-packages\pkg_resources\__init__.py", line 900, in require
  File "site-packages\pkg_resources\__init__.py", line 786, in resolve
pkg_resources.DistributionNotFound: The 'impacket' distribution was not found and is required by the application
[3336] Failed to execute script wmiexec

nullcult avatar Apr 13 '20 07:04 nullcult

I have never had this bug before as this get_distribution code is quite recent.

It seems to be an common issue related to PyInstaller not copying metadata before packaging, you can fix it by creating a specific hook for impacket, like documented here and here.

maaaaz avatar Apr 13 '20 10:04 maaaaz