hacking contest

hacking exploits security forum
hacking
compliance articles
upgrade backup exec
information security consultant

Full Version: Tut For Compiling Plz
gordan wells
Hi
it would be very useful if someone gives a few tips for compiling,
so when u find a code somewhere, u dont need to ask someone to compile it for ya
I already got a program called dev-c++ but the compilin didnt work very good.
ddrj
Well, since noone else has said anything wink.gif
Get cygwin, for compiling those exploits.
http://www.cygwin.com/
As for tips -> gcc file.c -o file.exe
Be sure to download the libs + devel tools.

-ddrj
vnet576
Is there any way to compile these exploits using windows based software. Becuz I don't really wanna download a linux envirenment like cygwin at the present time at least.
krackatoa
CYGWIN loads on windows XP just fine
vnet576
QUOTE (krackatoa @ Sep 10 2003, 12:11 AM)
CYGWIN loads on windows XP just fine

but its a linux emulation app..don't wanna install something like that. Is there a good windows compiler that does the same thing?
arhamz
says command not found blink.gif
Dillinja
QUOTE (vnet576 @ Sep 10 2003, 01:18 AM)
QUOTE (krackatoa @ Sep 10 2003, 12:11 AM)
CYGWIN loads on windows XP just fine

but its a linux emulation app..don't wanna install something like that. Is there a good windows compiler that does the same thing?

Not really vnet, not unless the code you are compiling is for a win32 environment.

If you tried compiling a code intended for a *nix system, you would get compiling errors, mostly consisting of missing socket header files.

So, as far as I know (someone correct me if Im wrong), for compiling a *nix exploit code on windows, you will need a GCC based compiler with all the correct libarys and header files, and CYGWIN fits this bill perfectly.

There could be others( such as DJGPP, but I havent looked into this (and probably wont be, not since I now do all my programming and compiling on Linux) but I hope this helps somewhat.

I hope you found help too gordan...if you come across any more problems, just ask biggrin.gif
picasso
hey everybody

can you tell me what cygwin version to download?
and what about libs and devel tools??

and where i use this tip,where to use it??

newbie questions

thnx to all

w8itng for answers....smile.gif
Dillinja
QUOTE (picasso @ Sep 10 2003, 12:04 PM)
hey everybody

can you tell me what cygwin version to download?
and what about libs and devel tools??

and where i use this tip,where to use it??

newbie questions

thnx to all

w8itng for answers....smile.gif

I posted a link to a guide about how to chose the correct flags and packages for cygwin in this forum a long while back..cant be arsed looking for a link but its still here and if you use the search function........ dry.gif
silos
Yeah, l use CYGWIN on XP [although l still have problems associating files with it]. lt loads alright.Just search for Cygwin+download on google and choose the win32 option on the site.
I tried installing NMAP but lt tells me l need certain 'LIBS' etc.l tried getting them through the Cygwin setup but didn't seem to be any listed.
vnet576
QUOTE (Dillinja @ Sep 10 2003, 10:15 AM)
QUOTE (vnet576 @ Sep 10 2003, 01:18 AM)
QUOTE (krackatoa @ Sep 10 2003, 12:11 AM)
CYGWIN loads on windows XP just fine

but its a linux emulation app..don't wanna install something like that. Is there a good windows compiler that does the same thing?

Not really vnet, not unless the code you are compiling is for a win32 environment.

If you tried compiling a code intended for a *nix system, you would get compiling errors, mostly consisting of missing socket header files.

So, as far as I know (someone correct me if Im wrong), for compiling a *nix exploit code on windows, you will need a GCC based compiler with all the correct libarys and header files, and CYGWIN fits this bill perfectly.

There could be others( such as DJGPP, but I havent looked into this (and probably wont be, not since I now do all my programming and compiling on Linux) but I hope this helps somewhat.

I hope you found help too gordan...if you come across any more problems, just ask biggrin.gif

I would only compile code for windows systems. Since I don't know linux I don't use linux exploits..only win32 ones. What is a good compilier for compiling windows only exploits on windows systems? smile.gif
scooby
thank gsecur for this.
QUOTE
OK, Ive seen a lot of questions lately about compiling programs in Linux so I decided to write this for you guys. I hope it helps out. Letˇ¦s start out with the basics.

Vocabulary
Source: Youve probably seen this before Download Source In Linux (or unix) you will most likely be dealing with source code. This is actually the raw instructions that are written by the programmer. You can not run these! So dont try . You need to first compile them (well get to that later)

Binaries: Binaries are code that has been compiled. If you are downloading binaries you will need to insure that the binary was compiled on the same distro and chipset you are using. Most Linux users will always say it is better to compile everything from the source. In most cases this is true. But, if you are a beginner try to find binaries:-)

Compiler: This is the actual program that interprets the source into a binary format. Logically, your compiler must be for the language the source was written. The vast majority of the time it will be a C compiler, the most common is gcc.

Files you will need:
A compiler (duh) ok for this tutorial we are going to use gcc.

Redhat 8.0
ftp://rpmfind.net/linux/redhat/8.0/en/os/...-3.2-7.i386.rpm
Source
ftp://rpmfind.net/linux/redhat/8.0/en/os/...c-3.2-7.src.rpm

Mandrake
ftp://rpmfind.net/linux/Mandrake/9.0/i586...2-1mdk.i586.rpm
Source
ftp://rpmfind.net/linux/Mandrake/9.0/SRPM....2-1mdk.src.rpm

Debian
< if you are using Debian you should know how to compile  >

But it's apt-get install gcc if you want it, or select development modules from tasksel.


Some more basics:

Another thing a lot of beginners get confused with is the difference between a script and the source for a program. Scripts like pearl, PHP, ASP, and VBScript are interpreted at runtime. A compiled program is interpreted when you actually compile it, and then simply run. This means respective to their complexity compiled programs run faster than scripts.

Most software for Linux and other open source platforms are distributed as source code, usually a compressed archive commonly known as the tarball. This just means the file is in a compressed format, pretty much the same thing as a ZIP file.

Usually before you compile any programs, you should be logged in is a root user. You can do this by logging in as root or by typing su at the command line.

Another common mistake people make is to not have the required libraries. Libraries are shared code, that a program needs to run. For example: most programs that use extensive references to a certain type of protocol, such as SNMP will use a common library written by another programmer. Always check the readme file to see what libraries a program might need.

OK, the start out with a simple program we could write:


Code:
Int main(){
  Printf(ˇ§Hello, worldˇ¨);
}


All this program does, is print hello world, easy enough, let's save it as test.c. Now to compile it just type:


Code:
  gcc test.c


Now we should have a working binary program called a.out by default. If you want to give it a different name just type:


Code:
gcc test.c -o test1


The will output the file as test1.

Now remember how we talked about libraries, well libraries are included in source by the following:


Code:
#include <SDL/SDL.h>


All includes will be displayed at the top of the source code to be within good programming principles. Now, when we compile our program that contains includes we need to tell GCC where the library is located, so that a permanent link can be made within the program. We do this by the following:


Code:
gcc test.c -o test1 -L/usr/lib -ISDL


OK, here's quick English rundown of what we just did. We told GCC to compile our source test.c and output it as test1 and told it that the library SDL was located in /usr/Lib.

Now I hope this helped you guys out a little bit. The final thing I'm going to cover, is a lot of people see in the install files of a lot of programs that they need to run ./configure. Now when I was just beginning I used to get frustrated, because I would type that at the command line, and I would get file not found. The trouble you're having is you are not in the correct shell of Linux. To fix this just type:


Code:
sh ./configure


OK, that just about wraps it up. I hope I was able to answer most of your questions, if you have any more just ask me. I'll do my best to answer any questions.
Dillinja
QUOTE (vnet576 @ Sep 10 2003, 08:43 PM)

I would only compile code for windows systems. Since I don't know linux I don't use linux exploits..only win32 ones. What is a good compilier for compiling windows only exploits on windows systems? smile.gif

Ahhhhhhhh!! biggrin.gif

Then I would definatly recommend Bloodsheds Dev C++ (http://www.bloodshed.net/devcpp.html)

Ive been using it for a while now and found it very easy to use!

Give it a blast and see what you think! (Its also free btw smile.gif )
vnet576
Thanks dillinja..gonna try this exploit tonight and post my results. wink.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.

 
Invision Power Board © 2001-2005 Invision Power Services, Inc.