What Reverse Engineering Is
When someone writes a program, they write source code — text a human can read, full of meaningful names, comments, and structure. A compiler then translates that text into machine code: long strings of numbers that a processor executes directly. The translation is one-way in practice. The names, the comments, the tidy structure — almost none of it is needed by the processor, so almost none of it survives into the finished program, the binary.
Reverse engineering is reading the binary anyway: working out what a program does when all you have is the machine code. It answers three kinds of question:
- What is in here? Which functions, which text strings, which data — the inventory.
- What does this part do? Following one piece of the program until its job is plain.
- Where does X happen? Finding the code responsible for a behaviour: a check, a network call, a file being written.
People do this for sound reasons. A security researcher audits a program whose vendor makes claims she wants to verify. An engineer keeps a system alive after its source code was lost, or makes two systems talk to each other when only one of them is documented. A firmware tinkerer wants to know what the device on her own network is doing. A student wants to see what a compiler really makes of her code — this guide's specimen is exactly that impulse, aimed at a program written for the purpose.
Two broad methods exist:
- Static analysis — reading the program without running it. Slower to reach some answers, but nothing the program does can hurt you while you read it, because it never runs. This guide is about static analysis, and Ghidra is a static-analysis tool.
- Dynamic analysis — running the program under observation (a debugger, a tracer) and watching what it does. Ghidra ships a debugger too; this guide scopes it out and says so whenever it comes near the border.
Inside static analysis there are two levels of reading, and Ghidra gives you both at once:
- Disassembly translates machine code back into assembly language — one printed instruction per machine instruction. Faithful, exact, and hard work at scale: a small program is thousands of instructions.
- Decompilation goes further and rebuilds an approximation of the original source, in C-like code. It is never the original — the names and comments are gone for good — but it reads at ten times the speed, and for most questions it is where the answer is found.
The safety and legal lines, plainly. Reverse engineering is a normal, lawful part of computing — interoperability, security research, and repair all depend on it — but the details depend on where you live and what licences you agreed to, and this guide is not legal advice. The working rule is simple: analyse software you own, or software you have explicit permission to examine. Two more rules keep you safe rather than sorry:
- Suspect files belong in an isolated lab. If a binary might be malicious, examine it on a machine (or virtual machine) with no network and nothing you value on it. Static analysis never runs the specimen — that is its great safety virtue — but habits formed on friendly files get carried to hostile ones, and the lab habit is the protection.
- Reading is not defeating. This guide teaches you to understand programs. Using that understanding to strip licence checks, lift other people's code, or cheat in systems you don't own is outside its scope and outside the rule above.
Check: the whole subject in one breath — the compiler threw the reading copy away; reverse engineering is rebuilding enough of it to answer your question, from the machine code alone. Ghidra is the bench that work is done on, and the next chapter opens it.