ropnop / impacket_static_binaries

Standalone binaries for Linux/Windows of Impacket's examples
Other
702 stars 92 forks source link

Binaries for Windows are not compiled correctly #10

Open 0xShkk opened 3 years ago

0xShkk commented 3 years ago

Hi ropnop,

thank you very much for this awesome work. Unfortunately I have discovered, that the compiled Windows binaries are not working as intended, since the last 4 to 5 releases. I think this is due to the used python version you use to compile the binaries.

This is the output on a Windows system, when running your compiled impacket Windows binaries:

wmiexec_windows.exe Traceback (most recent call last): File "wmiexec.py", line 32, in File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 391, in load_module File "impacket\version.py", line 11, in File "site-packages\pkg_resources__init.py", line 535, in get_distribution File "site-packages\pkg_resources__init.py", line 415, in get_provider File "site-packages\pkg_resources\init__.py", line 943, in require File "site-packages\pkg_resources\init__.py", line 829, in resolve pkg_resources.DistributionNotFound: The 'impacket' distribution was not found and is required by the application [3576] Failed to execute script wmiexec

I have compiled the most actual impacket build (v0.9.22.dev1+20200804.145312.110b886c) myself via PyInstaller and explicitely using Python3 as follows:

python3 -O -m PyInstaller --clean --onefile wmiexec.py

Did this on a Windows OS natively with installed Python and impacket distribution. You have to add a hook for PyInstaller still, if you compile this way. The hook must contain the following:

from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata('impacket')

When compiled via the method described above, all binaries seem to work well.