-
Notifications
You must be signed in to change notification settings - Fork 2
Decompiler
License
arjunsingri/relipmoc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
relipmoC is an assembly to C translator. Its a naive decompiler which cannot yet handle programs containing pointers, structures and goto statements that cannot be converted into equivalent for and while loops. REQUIREMENTS Any version of Linux supporting gcc (preferably 3.2.2), g++ (3.2.2 or higher), Flex and Yacc (optional) and the indent (optional) programs. The indent program is used to indent the decompiled C program generated by relipmoC. If its not available then use the --noindent option at the command line and the output will not be indented, and you will find it hard to read the output of relipmoC :-) indent program is provided by GNU. Get it from http://mysite.freeserve.com/indent/indent_2.2.9.tar.gz http://mysite.wanadoo-members.co.uk/indent/indent_2.2.9.tar.gz MAN PAGE We have included a man page for at gives a brief idea about the various options available under relipmoC. The man page is named relipmoC.1 To view the man page say, (from the directory containing the man page) $man ./relipmoC.1 If you are the super-user and if you want to install it so that you can view it from any directory, copy the man page to /usr/share/man/man1 then just say, $man relipmoC COMPILING THE PROJECT If lex and yacc are available then just say (in the directory containing the source of relipmoC), $make otherwise use the following command to compile, $make -f noLexYacc.mak The makefile has been written assuming that the compilation is being done by the super user. Modify it if required. After compiling, an executable file named "relipmoC" will be obtained, which is the assembly to C translator. If there are any problems while compiling please write to us. Anyway, we have provided a statically linked executable named relipmoC_static This can be used for decompilation and you can do away with compiling the project. HOW TO DECOMPILE? To decompile an assembly program hello.s $relipmoC hello.s By default the decompiled hello.s program will be stored in the file hello.s.c i.e., program_name.s.c in general. The decompiled source will have just one header file named ourHeader.h This "includes" any system header files that might have been used. If you have used a header file not included in ourHeader.h then you can modify ourHeader.h accordingly. The file ourHeader.h can either be included in the directory, /usr/include/ provided that this in the "PATH" environment variable. OR you can modify "PATH" to include the current directory. HOW TO OBTAIN THE ASSEMBLY PROGRAM OF A C PROGRAM? To get the assembly program of a C program named hello.c $cc hello.c -S By default the assembly program will be stored in the file hello.s The gcc compiler performs some optimizations, in such cases relipmoC may fail. In such cases you can turn off the optimizations by, $cc hello.c -S -O0 relipmoC assumes that the assembly program being decompiled has been obtained by compiling a C program by gcc3.2.2 compiler. You may think that this is very restrictive but its not. Look at it this way, a compiler is written for a specific programming language. So you cannot use a C compiler to compile a PASCAL program. The reason is that the compiler assumes the input to be in a particular format and this format is specified by the language grammar. Similarly, a decompiler is written for an assembly program in a particular format and in the case of relipmoC its the format specified by the gcc3.2.2 compiler. However its not very difficult to port it to other versions of the gcc compiler as most of the instructions are similar across the versions. TEST CASES As we have specified above, we assume that the assembly program to be decompiled has been obtained by compiling a C program using gcc3.2.2 compiler. Anyway, we have provided a few sample programs all compiled using the gcc3.2.2 compiler. These are present in the directory test. The directory src contains the original C code and the directory assembly contains the corresponding assembly programs to be decompiled. You can use these to test relipmoC. DOCUMENTATION The file synopsis.pdf contains a brief description of the concepts used. The detailed description of the decompilation techniques used are found in the file techniques_used.pdf and is about 60 pages in length. We will be happy to receive any suggestions for improvement. We will also be interested in cases where relipmoC fails to decompile. You can contact us at [email protected] [email protected]
About
Decompiler
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published