Making a Windows Executable from Python Code on Kali

Spread the love

So I have seen a couple of Python exploits floating around that are useful for privilege escalation on a Windows box. Often than not I find that the exploited Windows boxes do not have python installed and so the answer is using pyinstaller to make the script an executable. Having to have a Windows VM for this and such, why not use Wine?

Digging around I found a fairly good blog post about getting the environment all setup unfortunately it didn’t quite work for me even with a vanilla Kali linux workstation.

Essentially I followed Milkator’s steps but added pip.exe and from there used pip to install pyinstaller. After that all was golden and things worked like champ.

print "Hello, this is a test!"
git clone
git clone
apt-get install scons
./virtual-wine/vwine-setup venv_wine

# Choose your Windows OS of choice. A number of errors about registry occur
# Get into your virtual wine environment and install Python and PyWin32
. venv_wine/bin/activate
wine msiexec -i python-2.7.8.msi
wine pywin32-218.win32-py2.7.exe

# Download
wine c:/Python27/python.exe
wine c:/Python27/Scripts/pip.exe install pyinstaller
# Now compile your
wine c:/Python27/python.exe pyinstaller/ --onefile


Written by


Technology, Science and Philosophy