Usable Software Reverse Engineering tools needed! [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 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.

Related

drawing circle, line, arc etc. using 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 last year.
Improve this question
So our teacher taught us to draw circles lines using c in turboc++, and my issue is, this compiler sucks, so I wanted to use some normal compiler or code editor, and I googled it, but those programs on websites which I found, use graphics.h for drawing circle, but my compiler is showing an error named no such file or directory. The same issue is seen when I use an online compiler.
So plz someone guide me where can I find some good material related to basic computer graphics whose c code does not need turboc++. It can be a book or website or videos on youtube.
Thanks in advance.
There is no standard graphics library in C. It's all third party. So you will never be able to write graphics code that's completely portable.
If you're using Linux, it's possible to use libgraph to enable the use of graphics.h. I found a question on askubuntu that covers this: How do I use graphics.h in Ubuntu?
If you're using Windows, it seems to be possible to use WinBGIm to use graphics.h. Geeks for geeks has instructions for how to use it with CodeBlocks https://www.geeksforgeeks.org/include-graphics-h-codeblocks/
I do not know how good these two options are, but they might be worth trying out. That will at least remove the Turbo dependency.

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.

C syntax parser [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
Are there any libs out there that can parse C syntax?
For example I would like to write my own code/scripts that will analyze c files given the c syntax. Number of "if" statements per function/file, lines of comments per lines of code in a function and so on.....
I have no problem writing all this custom code just wanted to make the job easier if there was already some lib that I can use to jump start instead of starting with the parser.
Thanks!
Besides the clang suggestion already made, consider pycparser and Boost.Wave.
Although they are more targeted at semantical analyses rather than syntactical ones, you might be interested in CIL and Frama-C, which is based on it (both in OCaml). Another tool (OCaml and Python bindings) of interest is Coccinelle.
Personally, I would look first for an existing tool to do what you want. This sounds like an awful lot of work and there are a lot of good free tools out there for code metrics (did you look on SourceForge?).
If you insist on going ahead with your project, you might google for Lex/Yacc grammars for C.
However, I switched from Lex/Yacc a few years ago to Antlr. I particularly like the way it allows you visually step through your parsing.
A great tool, and free. There is a complete grammar for C available too, so you can modify that to suit your needs.
Hope this helps. Good Luck
you might also consider trying a code coverage tool. although code coverage is meant to show you how much percent of the source code is executed but some of them also show how many conditional statements or loops it encountered whilst doing code coverage. One example that I can share based on my experience is windriver workbench code coverage tool

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

What's a good C decompiler? [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 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.

Resources