Skip to content

Your First Project

This chapter walks the CodeBrowser window, which the build sandbox — having no display — could not drive. The steps follow Ghidra's own Getting Started document and are marked (documented). Nothing in them is taken on faith, though: the import and analysis they describe were run for real through the headless door, and chapters 5 and 6 quote the results. Treat this chapter as the map of a room whose contents the rest of the guide proves.

Make the project

Start Ghidra and choose File → New Project. A project needs a folder and a name; a non-shared project is the right kind for your own work (shared projects are for Ghidra's multi-user server, a subject this guide doesn't open). The project window that appears is the workbench's lobby: imported programs will be listed here, and double- clicking one opens it in the CodeBrowser.

Import the specimen

Drag gatekeeper from examples/ onto the project window, or use File → Import File. Importing asks the two questions of chapter 2 — format and language — and for an ordinary program Ghidra answers both itself: it recognises the ELF format and the x86-64 language, and the import summary says so. The defaults are right here; chapter 12 is about the imports where they aren't. The result is a copy of the binary inside the project — your file in examples/ is never touched again.

Let it analyse

Opening the program brings the question "Would you like to analyze it now?" — answer yes. Behind that one prompt, the auto-analysis battery runs: dozens of analysers find the entry points, walk the code into functions, name the strings, match known library code, and prepare the decompiler's data. On the build machine the same analysis of this 16 KB specimen took 3 seconds once Ghidra was running (measured by its headless twin; the window shows a progress bar for the same work). A program a thousand times larger can take minutes to hours — scale is real, and chapter 14 doesn't hide it.

You are not obliged to accept the default analyser set. Analysis → Auto Analyze reopens the choices for a program already imported, and a few are worth knowing by name: the Decompiler Parameter ID and Stack analysers feed the decompiler its raw material, and Function ID matches functions against a database of known library code, which is how library routines in a stripped binary sometimes get their names back (chapter 7 returns to this).

The room itself

The CodeBrowser arranges its panes around the work:

  • Listing (centre) — the disassembly, address by address. Chapter 5 lives here.
  • Decompiler (right) — the current function as C. Move the cursor in the Listing and this pane follows. Chapter 6.
  • Symbol Tree (left) — the program's names organised: functions, labels, classes, namespaces. Chapter 7.
  • Defined Strings and Defined Data (from the Window menu) — the text and data the analysers found. Chapter 9 starts from the strings.
  • Bookmarks and the Plate Comments — your own marks on the program. Chapter 8 covers the discipline; the window calls them up from the same Window menu.

Clicking an address or a name anywhere moves every pane to it — the panes are views of one database, and the cursor is shared. Pressing G opens the go-to box for an address or a name.

Check: you are set up when the project lists gatekeeper, the program opens without complaint, the Listing shows assembly rather than raw bytes, and the Symbol Tree's Functions folder contains — among the library machinery — three names of the program's own: scramble, check_code, and main. Those three are the whole story of this specimen, and the next two chapters read them.