Skip to main content

Sogen Windows user-space emulator bindings

Project description


Sogen is a high-performance Windows user space emulator that operates at syscall level, providing full control over process execution through comprehensive hooking capabilities.

Perfect for security research, malware analysis, and DRM research where fine-grained control over process execution is required.

Built in C++ and powered by the backend of your choice:

Try it out: sogen.dev


[!WARNING]
Caution is advised when analyzing malware in Sogen, as host isolation might not be perfect.
To mitigate potential risk, use the web version to benefit from the additional safety provided by your browser's sandbox.

Key Features

  • 🔄 Syscall-Level Emulation
    • Instead of reimplementing Windows APIs, the emulator operates at the syscall level, allowing it to leverage existing system DLLs
  • 📝 Advanced Memory Management
    • Supports Windows-specific memory types including reserved, committed, built on top of Unicorn's memory management
  • 📦 Complete PE Loading
    • Handles executable and DLL loading with proper memory mapping, relocations, and TLS
  • Exception Handling
    • Implements Windows structured exception handling (SEH) with proper exception dispatcher and unwinding support
  • 🧵 Threading Support
    • Provides a scheduled (round-robin) threading model
  • 💾 State Management
    • Supports both full state serialization and fast in-memory snapshots
  • 💻 Debugging Interface
    • Implements GDB serial protocol for integration with common debugging tools (IDA Pro, GDB, LLDB, VS Code, ...)

Preview

Preview

YouTube Overview

YouTube Video

Click here for the slides.

Python Bindings

Install with:

pip install sogen

Example:

import sogen

emu = sogen.create_application("c:/test-sample.exe", None, emulation_root="./root")


def on_module_load(module):
    if module.name.lower() == "test-sample.exe":
        emu.hooks.memory_execution_at(module.entry_point, lambda address: print(f"hit entry point: 0x{address:x}"))

emu.callbacks.on_module_load = on_module_load
emu.start()
print(emu.process.exit_status)

See examples/python/README.md for a slightly larger example.

Quick Start (Windows + Visual Studio)

[!TIP]
Checkout the Wiki for more details on how to build & run the emulator on Windows, Linux, macOS, ...

1. Checkout the code:

git clone --recurse-submodules https://github.com/momo5502/sogen.git

2. Run the following command in an x64 Development Command Prompt in the cloned directory:

cmake --preset=vs2022

3. Build the solution that was generated at build/vs2022/emulator.sln

4. Create a registry dump by running the grab-registry.bat as administrator and place it in the artifacts folder next to the analyzer.exe

5. Run the program of your choice:

analyzer.exe C:\example.exe

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sogen-0.0.1.dev3455.tar.gz (20.9 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

sogen-0.0.1.dev3455-cp312-cp312-win_amd64.whl (4.4 MB view details)

Uploaded CPython 3.12Windows x86-64

sogen-0.0.1.dev3455-cp312-cp312-manylinux_2_39_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

sogen-0.0.1.dev3455-cp312-cp312-macosx_15_0_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.12macOS 15.0+ x86-64

sogen-0.0.1.dev3455-cp312-cp312-macosx_15_0_arm64.whl (5.1 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

File details

Details for the file sogen-0.0.1.dev3455.tar.gz.

File metadata

  • Download URL: sogen-0.0.1.dev3455.tar.gz
  • Upload date:
  • Size: 20.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sogen-0.0.1.dev3455.tar.gz
Algorithm Hash digest
SHA256 d05d7499937f37c74da82c036ff5139b95bc9971024af73ca6f01c43d4d7684c
MD5 d168807ca4bda433465309814596dbf5
BLAKE2b-256 70504c20d792dcc98ba56671b0efae9a4147867d3f5805a20e527466534346c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for sogen-0.0.1.dev3455.tar.gz:

Publisher: build-push.yml on momo5502/sogen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sogen-0.0.1.dev3455-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for sogen-0.0.1.dev3455-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 88f5cf440893b3125f89c28d2fd9bb26f2fb53738ed53369624df7765be9a3ff
MD5 ff3d3c8cb4e4e1abe815a133208368eb
BLAKE2b-256 d7c9dede721ef6263c1573077d2e88ad906ba89096932981105cecaf32799dbc

See more details on using hashes here.

Provenance

The following attestation bundles were made for sogen-0.0.1.dev3455-cp312-cp312-win_amd64.whl:

Publisher: build-push.yml on momo5502/sogen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sogen-0.0.1.dev3455-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for sogen-0.0.1.dev3455-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 7af2722dc54e558262a4d3f7c3dabdd3bbfde934e5b65e73c0651611eebd0ed3
MD5 d5d38c616868286570144131315efafb
BLAKE2b-256 0dbb3fac65a3032c166b48ec490ebff554d179b36ab61f28cd4083d288f291fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for sogen-0.0.1.dev3455-cp312-cp312-manylinux_2_39_x86_64.whl:

Publisher: build-push.yml on momo5502/sogen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sogen-0.0.1.dev3455-cp312-cp312-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for sogen-0.0.1.dev3455-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 41d9a0e80a2937539e68d9b7e6b6ef48f1cd7f7b56cac323bb18cd8a65fc5491
MD5 eb9e78efeec98ef647c0dc969445598d
BLAKE2b-256 426e62952cd0f7a0a4c1cffcb7e5bdbe0b03df7abf36c250e68725692a3c78f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for sogen-0.0.1.dev3455-cp312-cp312-macosx_15_0_x86_64.whl:

Publisher: build-push.yml on momo5502/sogen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sogen-0.0.1.dev3455-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for sogen-0.0.1.dev3455-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 1de301afb1d8c8b8204a04aea0b91bbe2b7874d3eb1e122f2752aaf2ab628757
MD5 8ca8341325419d0ad679dbaad061f6cb
BLAKE2b-256 50addf72796d262dd94c5d667704a915d7ed2b0b98bed948948381e1423f7758

See more details on using hashes here.

Provenance

The following attestation bundles were made for sogen-0.0.1.dev3455-cp312-cp312-macosx_15_0_arm64.whl:

Publisher: build-push.yml on momo5502/sogen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page