How do people reverse-engineer compiled applications to get the source code?

317 views

I know the long answer to this question would probably be the equivalent of a college course, but can you summarise how tech people do this?

If you open game.exe with a text editor you’re just going to get what looks like a scrambled mess of characters, so how would one convert this into readable source code?

In: 5

12 Answers

Anonymous 0 Comments

What you get if you open it with Notepad is just the ASCII representation of the bytes of machine code. In the same way that opening a picture file with Notepad will just look like mangled garbage, so will an application.

However, there is still a pattern to that machine code. If you write and compile the same code, you get the same machine code out of it. It is possible to do this process backwards (decompiling). However, there are some things that don’t get preserved.

For example, if I write code that says something like `var numberOfRetries = 5`, that *numberOfRetries* name for my variable isn’t important in the final product, so it gets discarded during compilation (and the compiler just knows to use the actual memory addresses/etc instead). If you run that code through a decompiler, you would just get something like `var a = 5`, and you would have to, through context, figure out what `a` actually does.

So it becomes a puzzle of figuring out what everything means. You have to use contextual clues to figure things out. Sometimes this is relatively easy (for example, if you see `log.debug(“Retries left: {}”, a)`, you might realize that “*a*” represents the number of retries you have left. You build on this knowledge and rebuild all those variable names and you can figure out what’s happening.

You are viewing 1 out of 12 answers, click here to view all answers.