MinGW is a collection of windows development tools including compilers such as GCC and G++.
Using both MiniGW and Wine it is possible to compile windows code thus creating a portable executable (pe) which can be later run on a victim's machine. I'm going to show you one way to install MinGW on Kali.
Requirements:
Wine
Kali (obviously) Running with a GUI.
Note: Wine should be already installed on your version of Kali. If not, you can install it using
sudo apt-get install wine
EDIT: You may need to install the i386 version of wine using the following commands:
dpkg --add-architecture i386
apt-get update
apt-get install wine-bin:i386
Step 1: Get the Installer from SourceForge
You can go to SourceForge to download the installer.
Step 2: Run the Installer with Wine
There are a couple ways to do this:
- In a terminal use wine /path/to/file/mingw-get-setup.exe
- Double-Click on the file in the GUI.
Select "Run with GUI" option.
Note that you must have the GUI up in order to get the installer to run properly. You can run it in a terminal however it draws a GUI box for installation.
Step 3: Select mingw32-Base
When the window appears, make sure to select mingw32-base. This is required to continue and make things work properly.
Select Installation and click Update Catalogue.
The Final Step: Adding the Proper DLLs
You want to get the right DLLs to be able to compile properly. You can find them here: Go Jhonny!
Unzip them into your Windows directory in wine. Its location should be /root/.wine/drive_c/windows
Great! Now you can use gcc.exe!
syntax:
cd /root/.wine/drive_c/MinGW/bin
wine gcc.exe -o file.exe sourcefile.c
This tutorial was created as a side Tut for "Creating a (Almost) Fully Undetectable EXE using Kali and GCC"
Thanks to Go Jhonny! for the original tutorial.
8 Responses
Good post, Alex. Thanks!
Thank you OTW, I really hope to become a valuable member to this community!
Welcome to Null Byte, Alex!
I'm already using this one for compiling for windows in Linux, very useful informations.
Thanks Ciuffy,
Let me know if you have any advice on improving this tutorial.
When i click the link I only reach blog.gojhonny.com And even if I click on the link there i cant seem to download it it just keeps redirecting me to blog.gojhonny.com Please Help
-KraDox
It seems to be working properly now.
Please help..
cd /root/.wine/drive_c/MinGW/bin
wine gcc.exe -o file.exe sourcefile.c
after this command.. having this error
"gcc.exe: error: sourcefile.c: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated."
When i go to the link to get the dll files it gives me a 404, any other way to get the dlls?
Share Your Thoughts