I didnt seen any windows compiling tutorials like this so i thought i'd write one and link to some other threads on this site to save a bit of searching
It may be a good idea to evolve this if i think of more to add or someone else does
If anyone has anything to add about this or point out a problem with any of the explanations then feel free to correct me and i will ammend this mini tutorial
BASICS
----------
Most of you know this but some dont so here we go.
What is C and C++
They are programming lanuages, C++ is basically object oriented C (a very generalized comparison)
What is a Compiler
You have some source code, you can read it but your computer cant - it only understands binary. So a compiler translates this source code into machine code (binary) and creates an exe file
COMPILING
--------------
I need a free C compiler
There are many out there and some are down to personal choice
For starters lcc is not too bad and you can download it from www.cs.virginia.edu/~lcc-win32/
Or to compile linux code under windows use cygwin www.cygwin.com (you will need to select the c and gcc packages)
For other compilers and more cygwin info see the link near the end of this post
What are all those #includes .h files and why dont i have them
To save having to write the same code over and over ie: functions to send packets over a network, programmers use headers files (donated by the .h filetype) which already contain the code that does this.
Most standard libraries (libraries are sometimes many .h header files) come with your compiler and are located in it's /includes folder
Also when including files
#include "header.h" - means that header.h is in the same folder as your code
#include "C:\stuff\header.h" - header.h is in the C:\stuff folder
#include <header.h> - header.h is in the /include folder of your compiler which is the most common unless making your own
How do i know if this will compile under linux/cygwin or windows
You can sometimes tell by the header files that are included in the sourcecode
Common Windows includes
#include <winsock.h> - used to access the network
#include <windows.h> - defines windows structures and messages (eg: so we can use a word instead of some hex number for a value)
Common Linux includes
#include <netinet/in.h> - sockets/networking
#include <sys/socket.h> - defines socket structures
I downloaded the required header file but its still says some are missing
Header files can include other header files too so you will have to get them all. Sometimes if you are missing too many headers then you may require a development package eg: openssl which is used for a few crypto programs (eg: rainbowcrack)
For a brief tut on compiling openssl see here http://www.governmentsecurity.org/forum/in...?showtopic=9142
Is this code C or C++
normally the author's comments (if any) at the top of the code will tell you whether its a .c or .cpp filetype
If it is including <iostream.h> and uses commands such as 'cout' and 'cin' then its a C++ filetype
My compiler complains about ws2_32 or i see #pragma comment(lib,"ws2_32") in the code
In your compiler you may have to include the winsock library ws_32.lib for defines and functions in the includes to be recognised by the linker when compiling
its generally located in the lib directory of your compiler but isnt always added by default
you just have to find the part of the config in your compiler where you can add this library to the libraries which it will link to when you compile this code
ie: VC++ has project->settings->link
It still doesnt compile so what do i do
Post the error messages the compiler gives you and what compiler you are using. saying things like "it doesnt compile" or "can u plz compile i got errors" doesnt help you
USING EXPLOITS - Common sense
----------------------------------
What port does this run on / what port do i scan
You have to read through the code to find it
Is this Local or Remote
The author's comments at the top of the sometimes will tell you, but if not then read the security advisory for the exploit.
What does this sploit do
You dont know so you dont need it
For compiling under Linux/cygwin i suggest you read these threads
http://www.governmentsecurity.org/forum/in...?showtopic=6976
http://www.governmentsecurity.org/forum/in...?showtopic=2955
http://www.governmentsecurity.org/forum/in...hp?showtopic=39
http://www.governmentsecurity.org/forum/in...?showtopic=9504
http://www.governmentsecurity.org/forum/in...showtopic=10304
Other Compiling based threads on this site
--------------------------------------------------
Compiling
http://www.governmentsecurity.org/forum/in...?showtopic=2362
http://www.governmentsecurity.org/forum/in...?showtopic=9198
C programming tutorials
http://www.governmentsecurity.org/forum/in...p?showtopic=704
C compilers
http://www.governmentsecurity.org/forum/in...p?showtopic=939
http://www.governmentsecurity.org/forum/in...p?showtopic=706
Online C compiler
http://www.governmentsecurity.org/forum/in...?showtopic=2100
Compiling with .NET
http://www.governmentsecurity.org/forum/in...?showtopic=8084
Header Files (.h)
http://www.qnx.com/developer/docs/momentic...20of%20Contents
http://handhelds.org/download/intimate/release/usr/include/
also google could help you here. search for "index of" headerfile.h
oh and i cant forget good ol www.codelinx.net




