Setting up Cywin to compile C++ Exploits in Windows!! (Downloads + Tutorial)

4 01 2007

Setting up to compile C++ on Windows [via]

I alsways see people on forums asking how to compile this exploit and then a resounding response of flames from old skool hackers. Well, its not that simple anymore, Microsoft has made it so that Vistual Studio will only compile .exe’s (executable files) if you have the $$$ to pay for the full price product. Also, DevC++ is no help either, in fact none of the Windows GUI freeware for compiling code is of much use anymore, at least not to me. This command line approach to compiling code with cygwin is just so much simpler. Read on

All credit goes to for this great little tutorial.

How you set up to compile C++ programs depends on whether you are using Windows or Linux/Unix. This page describes the approach to use if you have a Windows machine. If you have a Linux/Unix machine, read this page instead.

There are many free C++ compilers that can be used with Windows. I am most familiar with Cygwin, available at These instructions assume you plan to download this compiler, but it applies to many other compilers with small detail changes.

Download Cygwin, which is a self-extracting compressed file. Execute the file, follow the provided instructions, and the program will install itself.

Once you have installed the program, you should be able to execute it from a DOS window. Open a DOS window and type “g++ -v” to establish that the program has been installed and can be executed.

When I compile I use a batch file named gccp.bat with this content:

@echo off
echo compiling C++ using -ansi -pedantic-errors -Wall
g++ -ansi -pedantic-errors -Wall %1 %2 %3

If you want this batch file, simply copy it from this page and save it on your system in a file named gccp.bat. The file shold be located in a directory that is part of your path satement.

This batch file sets up the most strict ANSI standard compliance level, making it necessary for the programmer to pay attention to many compatibility and style issues. There are even some incompatibilities within Cygwin’s own library routines, so this batch file may not always result in a successful compile even if your program is flawless. But in general, it is a good idea to establish high standards as a student, to become accustomed to good programming style.

Note: You may not need to have such strict settings for compiling exploits, but it is nice to have good clean code. Read on…

If the Cygwin compiler is executed directly, without using the batch file, its behavior is more relaxed. This may sometimes be necessary.

Set up a convenient data directory in which to place your programs. Create a file named temp.cpp with this content:

#include <iostream>

using namespace std;

int main()
	cout << "Hello World!" << endl;
	return 0;

Again, you should be able to simply copy this little program from this page, and use a text editor to save it as “temp.cpp.”

Open a DOS window, change to the directory in which temp.cpp is located, and type this:

gccp temp.cpp

If you have not made any errors, the program will compile uneventfully, and a program file named “a.exe” will be created in the same directory.

Type “a” and press Enter. The program should run, and print “Hello world!” on the display.

This series of actions confirms that you have acquired a C++ compiler and it is working properly. [END]

He has a code cleaner that seems like a pretty nice piece of software called Arachnophilia , haven’t used it yet but if his codeing is as clean as his tutorials it should work pretty well.

Now go out there and compile some exploits you skids you!! 😉



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: