What's a good C decompiler? [closed] - c

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
I am searching for a decompiler for a C program. The binary is a 32-bit x86 Linux executable. Objdump works fine, so basically I am searching for something which attempts to reconstruct the C source from the asm source.

Seconding Hex-rays, but if you can't justify that cost, Boomerang might work.

If you have money to spare, Hex-Rays Decompiler could be worth your while. :-)

As much as IDA can be helpful it cost quite a lot of money.
Not sure about your specific use case but Plasma seems like it would do the trick "Plasma is an interactive disassembler for x86/ARM/MIPS. It can generate indented pseudo-code with colored syntax."
If you are looking for something more similar to IDA I heavily recommend Radare2. There's also ODA the online dissembler in case you don't feel like installing anything.
A new addition is Binary Ninja and although it's not even close to the capabilities of IDA or Radare yet, it's a cheap and good utility for starters.
Update:
Since this comment the NSA have released Ghidra which is completely open source and free. It is a full pledges RE framework with high end decompiler.

For binary decompiling, I have bought a personal license of Hopper https://www.hopperapp.com .
The advantages are:
has an intuitive and well thought graphical interface;
runs in MacOS and Linux;
provides a reasonable C-like decompiler output;
decompiles 32-bit and 64-bit binaries;
supports Mach-O binaries (Mac and iOS), PE32/32+/64 Windows binaries and ELF binaries;
has very regular free updates;
the license price at around 100 USD cannot be beaten.
IMO, the ratio cost/quality beats fairly easily IDA/Hex-rays, and it leaves in the dust the other commercial (or free) decompilers.
Additionally, you can try it out or use the demo version to get a feel of it and decompile (very) small executables for free.
From now on (March/2019), as an alternative, you also have Ghidra from NSA. Ghidra runs on Linux, Mac and Windows as long as JDK 11 is installed. It is presented "as a free tool comparable to X/Rays".
Ghidra feels more powerful, however Hopper still seems more intuitive.
See also: PepperMalware Blog - Quick Analysis of a Trickbot Sample with NSA's Ghidra SRE Framework

Snowman (http://derevenets.com) looks nice. The generated code is a mess, but works.

Related

Generator of "mind map" from files.c [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I started a while ago to learn the C language, and has spent several hours I search THE miracle software.
I am looking for software that import sources of software in C (files.c) and generates a "mind map" of the code with all files, functions, variables, etc ...
Do you know if it exists? It'll help me a lot to understand the architecture of complex software.
Thank you very much for all your answers.
Take a look at the "call graph". This sort of visualization should get you started.
As the comment suggests, Doxygen is a good open-source tool. Take a look at some output here. Doxygen is straight-forward to configure for call-graph generation under *nix. It's a little more complex for Windows. First, check out this SO post: how to get doxygen to produce call & caller graphs for c functions. Doxygen's HTML output provides a number of nice cross-referencing features (files, variables, structs, etc.) in addition to caller/callee graphs.
On the commercial side, Understand for C/C++ has first-rate visualization features. Google "c call graph diagram" for other commercial and open-source options.
Finally, there are some older SO posts, like this one Tools to get a pictorial function call graph of code. Take a look at it.
Look into the program ctags. It is an indexer of names and functions based on the structure of the programming language.
It is quite mature, and has integration with a number of other tools. I use it with an older (but very nice) text editor called vi, but it can be used independently from the command line.
It does not generate a graphical view of the connections. However, in my estimation there are probably too many connections in most C programs to display visually without creating a large amount of information overload.
This answer differs from Throwback's answer in some interesting ways. A call graph can mean a few things. One thing it can mean is the path a running program took through a section of code, and another is the combination of all paths a running program might take through the code, and another is the combination of all paths in the code (whether they can be reached or not).
Your needs will drive which tool you should use.

Modern Ada to C/C++ translator [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Is there any source-to-source converter (translator) from Ada (95, 2005) to C?
How full they are (can they convert every feature of Ada into gnu c99 + pthreads + POSIX)?
Is it possible to use such ada-to-c translator in critical applications?
PS: Translators to C++ (up to 2003 with gnu extensions) are welcome too.
PPS: when said "gnu c99", it means only that C99 + most gnu extensions are supported, but don't mean the GCC.
I don't know of any open source Ada-to-C translator. The only one I knew of at all was SofCheck's, which was reportedly pretty good.
SofCheck has since been bought by AdaCore, and I did a very brief search of the AdaCore website for the translator, and nothing jumped out. You could ask them at sales#adacore.com, if pursuing a commercial solution is a viable option for you. (At least get a price.)
Unless there is an incredibly strong reason to use Ada for this application (e.g., customer demands it, or you already have a big application coded in Ada that you want to use), it will likely be a lot less painful if you just bite the bullet and code your solution in well-crafted C99 or C++ as you see fit.
If you insist, Sofcheck's translator might be best; they've been working on it a long time.
Failing that, you might(?) build a translator starting with the ASIS output of an Ada compiler. That's likely rather a lot of persnickety work since Ada has pretty precise semantics that you'd better preserve if you want to just carelessly code in Ada, translate and run. It will be even more work if you want the output to be "pretty" for the final customer. (Long term maintenance should be a consideration). I suspect implementing code to simulate Ada's rendezvous might be rather tricky, being both semantically complicated and asynchronous at the same time. The real flaw with this approach is that it is a lot of work; maybe just getting on with your life and coding the application itself in something non-Ada would be less effort.
See my caveats on language translation done poorly and alternative methods.

Usable Software Reverse Engineering tools needed! [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Hey guys, Myself and 2 fellow software engineer students are tasked to reverse engineer the gawk program. We need to create diagrams representing the structure, and answer questions about the program.
http://directory.fsf.org/project/gawk/
We are looking for simple to use reverse engineering tools for C programs. Our instructor has given us the following three tools as examples of what we should use, but we simply are having a huge problem getting them to work. Do you have any alternative solutions, or perhaps some good documentation on one of the following tools to help us out? Thanks!
PBS: http://www.swag.uwaterloo.ca/pbs/
RIGI: http://www.rigi.csc.uvic.ca/Pages/download.html
Shrimp: http://www.thechiselgroup.org/shrimp
This graphic is supposed to help understand a simple C list? http://www.rigi.cs.uvic.ca/downloads/demos/list-d/ls7.html
I strongly suggest ignoring those programs and start reading the code.
Reading the code can be vastly simplified if you have good tools to help; vim with etags and cscope is my preferred tool, with the GNU id utils tools coming in as occasionally handy.
Emacs users will probably stick closely with just etags.
The Eclipse IDE can probably help you navigate through code too. I've never tried it, but enough people love it so I hope it has some nice functionality.
People often find it easy to give exact URLs to locations in Linux source code using the lxr tool, e.g.: http://lxr.linux.no/#linux+v2.6.37.1/security/apparmor/lsm.c#L294 -- this system requires very little on individual client machines, which means you only need to configure it once as a server and all your classmates can benefit from it.
As first, you can use IDA Pro under linux. For more information of reversing tools, see https://www.apriorit.com/dev-blog/366-software-reverse-engineering-tools.
Binutils includes next reversing tools:
file;
nm;
size;
strings;
ldd;
readelf.
Objdump – disassembler. It shows header of a program, sections of file (flag -х). Disassemble file (flag -D). It shows body of sections in hex view (flag -s).
EDB. It is like OllyDbg, but under Linux.
HTE. Сonsole editor with more functions. It can disassemble files, supports cross-reference links, set functions’ name.

Beginners' guide for setting up Emacs with gcc/gdb? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I looked around the GNU emacs material and didn't find anything helpful.
Does anyone know of a good tutorial for setting up emacs, to basically turn it into an IDE? I'm looking for interfacing with gcc/gdb/make, etc...
Like other answers mentioned, M-x compile, M-x gdb will get you going. While debugging, I'd also suggest gdb-many-windows-mode, which makes Emacs look a bit closer to IDE when debugging.
Besides that and to get closer to "IDE-like features", you can look at:
CEDET http://cedet.sourceforge.net/ for code completion and project support. Excellent tutorial at http://xtalk.msk.su/~ott/en/writings/emacs-devenv/EmacsCedet.html .
If you don't mind using non-free software, Xrefactory (http://www.xref.sk/xrefactory/main.html) is probably the best (well, the only) refactoring tool. The C version is free, the C++ is not.
Yuval, you're probably being misled by looking for something about IDEs. All that stuff is automagically built into EMACS except for the CScope-like searching stuff.
M-x compile runs make by default, although I reset it to run Ant in java mode.
M-x gdb runs gdb
C-x ` (Ctrl-X backquote) goes to the next compile error
and so on.
Go dig about in the EMACS Wiki. Lots of good stuff. The Programming Category is where you should look.
Good Article
Look at CScope too... you just have to add two lines to your .emacs to be able to navigate through definitions and references
Even though not directly related to C/C++ i find that using a good color scheme is important. Try:
M-x color-theme-select
and you can browse around a lot of different setups if you do not want to create your own.
If you're working with version control system, you can find useful information in another my article about work with version control systems from emacs

Tools for C code refactoring [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
What tools are there that supports refactoring C code (renaming variables, extracting methods, finding method references, ...)
Preferably for a Linux environment, but Windows tools are ok too.
If there's something available for emacs, even better!
Netbeans 6.7 and above have reasonably decent basic C (and possibly C++, but haven't tried it) refactoring. I use it when doing the JNI part of one of my projects, and stuff like renaming vars, macros, functions, finding usages of a function all work well. Definitely worth a try, to see if it does the rest of what you want, if you're not wedded to emacs yet.
For emacs, there is xrefactory but I haven't tried it myself.
I use Eclipse with CDT as an IDE and find that it works well for refactoring and searching code.
Old, but not bad is cscope and the GUI frontend kscope.
Qt Creator is very fast and useful IDE. It's not only for Qt Framework. You can use it for C and pure C++ projects too. Also it have many refactoring features. It's cross-platform and have vi emulation too. For refactoring features please refer it's documentation.
Slickedit is good at refactoring.
Maybe this previous question could help, at least in speeding up the compile-run cycle.
Fast compiling (or maybe more apt, fast lexical analysis) is one of the things needed to create a system supportive of refactoring.
This article discusses some C++ refactoring tools for Visual Studio.

Resources