Skip to main content

Overview

This guide will help you get Sogen up and running quickly. We’ll build the emulator, set up the required registry files, and run your first emulated program.
This quick start focuses on Windows with Visual Studio. For other platforms, see the Installation guide.

Prerequisites

  • Windows operating system
  • Visual Studio 2022 (with C++ development tools)
  • Git
  • Administrator privileges (for registry dump)

Step 1: Clone the Repository

First, clone Sogen with all its submodules:
Make sure to use --recurse-submodules as Sogen depends on several external libraries.

Step 2: Generate the Visual Studio Solution

Open an x64 Development Command Prompt and run:
This generates a Visual Studio solution at build/vs2022/emulator.sln.
The preset vs2022 is configured for Visual Studio 2022. The build system will automatically download and configure dependencies.

Step 3: Build the Project

You can build either from the command line or Visual Studio:
The compiled binaries will be in build/vs2022/artifacts/ (or build/release/artifacts/ for command line builds).

Step 4: Create Registry Dump

Sogen needs access to Windows registry data to emulate programs correctly.
1

Run as Administrator

Right-click on Command Prompt and select “Run as administrator”
2

Navigate to Sogen Directory

3

Execute Registry Dump Script

This creates a registry folder with the following files:
  • SYSTEM
  • SECURITY
  • SOFTWARE
  • HARDWARE
  • SAM
  • NTUSER.DAT
4

Move Registry Folder

Copy the registry folder to the artifacts directory:
The grab-registry.bat script requires administrator privileges to access system registry hives.

Step 5: Run Your First Program

Now you’re ready to emulate a Windows program!

Using the Test Sample

Sogen includes a test sample that validates the emulator:
You should see output similar to:

Running Your Own Program

To emulate your own Windows executable:

With Arguments

Pass arguments to the emulated program:

Common Options

Here are some useful command-line options:

Understanding the Output

By default, Sogen displays:
  1. Emulator backend: Which CPU emulation engine is being used (Unicorn or Icicle)
  2. Execution logs: System calls, API calls, and other notable events
  3. Exit status: The program’s exit code (0 = success)

Example Output Analysis

This shows:
  • The emulator backend in use
  • Which modules (EXE and DLLs) were loaded and their base addresses
  • Thread creation
  • Successful termination (status 0)

Debugging with GDB

Sogen supports the GDB remote protocol, enabling debugging with popular tools:
1

Start Sogen in Debug Mode

The emulator will wait for a debugger to connect.
2

Connect with Your Debugger

3

Debug as Normal

Set breakpoints, step through code, inspect memory, and use all standard debugging features.

What’s Emulated?

Sogen emulates a comprehensive Windows environment including:
  • File System: Virtual file system with path mapping
  • Registry: Full registry access from dumped hives
  • Threading: Multi-threading with synchronization primitives
  • Exceptions: SEH (Structured Exception Handling)
  • Memory: Virtual memory allocation and protection
  • Networking: Socket operations (UDP/TCP)
  • Time: System time and timers
  • User Interface: Basic window messaging (HWND_MESSAGE)

Next Steps

Installation Guide

Learn how to build Sogen on Linux, macOS, and other platforms

Advanced Usage

Explore advanced features like state snapshots, Tenet tracing, and custom hooks

Troubleshooting

”Registry not found” Error

Make sure the registry folder is in the same directory as analyzer.exe, or specify its path:

“Failed to load module” Error

Ensure the program is a valid 64-bit Windows PE executable. Sogen currently focuses on x64 emulation.

Crashes or Unexpected Behavior

Try running with verbose logging to see what’s happening:
If you encounter bugs, please report them on GitHub Issues.