I was trying to build my own malicious file… Since I love python, it was natural for me to go down the python + pyinstaller route. Initially, I coded everything on windows, downloaded and installed PyInstaller [1] on windows, and attempted to use the usual pyinstaller -F my_script.py to build my executable. But then I started running into problems with modules….
The usual pip install module_name was a frustrating experience on windows (oh how I miss linux in times like this…) and I continuously hit the vcvarsall.bat error [2], even after installing Visual Studio express 2008, and the “Microsoft Visual C++ Compiler for Python 2.7”. I also went down the MinGW route [3], only to be frustrated by another missing DLL (“msvcr71.dll is missing”)
Then I remembered that the VEIL framework [4] on my Kali Linux box generates .exe files and is a python framework… and research confirmed it uses PyInstaller in the background to generate these EXEs. Digging into the source code… it uses wine to call the windows version of python, and runs pyinstaller under the wine environment.
So then it was a simple thing to emulate them… like so:
wine32 “C:\\Python27\\python.exe” /usr/share/pyinstaller/pyinstaller.py /tmp_my_script.py
And that was it… everything compiled and ready to roll….
References
[1] http://www.pyinstaller.org/
[2] http://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat
[3] http://ultrainfinitum.blogspot.com/2012/12/python-error-unable-to-find-vcvarsallbat.html