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

Python bindings require an emulation root. You can download a ready-made root here, or create your own by following the instructions in the wiki.

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 setup details and a 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.dev3486.tar.gz (21.0 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.dev3486-cp39-cp39-win_amd64.whl (3.7 MB view details)

Uploaded CPython 3.9Windows x86-64

sogen-0.0.1.dev3486-cp39-cp39-manylinux_2_39_x86_64.whl (6.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.39+ x86-64

sogen-0.0.1.dev3486-cp39-cp39-macosx_15_0_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.9macOS 15.0+ x86-64

sogen-0.0.1.dev3486-cp39-cp39-macosx_15_0_arm64.whl (4.7 MB view details)

Uploaded CPython 3.9macOS 15.0+ ARM64

File details

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

File metadata

  • Download URL: sogen-0.0.1.dev3486.tar.gz
  • Upload date:
  • Size: 21.0 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.dev3486.tar.gz
Algorithm Hash digest
SHA256 ff7b06bff9756c0689474da567a6c96463b0344b3858514a646e1658dfad1085
MD5 f46e090eef90c5248b67426d3bcd0e13
BLAKE2b-256 3c189e023b980d2360c228afa1e4c4ed5dcf7b30ec523ea4897f2b7a2a06b0a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for sogen-0.0.1.dev3486.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.dev3486-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for sogen-0.0.1.dev3486-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c546182ac235e3baea519b7a4f538c2a863871ad0d33526fe946e80ef3a45f5d
MD5 10e290f150fae520b545ca33384dc418
BLAKE2b-256 80a14f7ed355acfe8fbaaad128d4c45108e434fab7ccc8eda4ba7f0056d73a05

See more details on using hashes here.

Provenance

The following attestation bundles were made for sogen-0.0.1.dev3486-cp39-cp39-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.dev3486-cp39-cp39-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for sogen-0.0.1.dev3486-cp39-cp39-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 98553da60869faed4a63caca08119bbff86fed65d840986c9508827e6191302f
MD5 f888fb9f61be12caf129a9bd453abe62
BLAKE2b-256 4ac759b627d3e8947675082fa535725227d12038c687ca849fbc75b6ff90322d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sogen-0.0.1.dev3486-cp39-cp39-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.dev3486-cp39-cp39-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for sogen-0.0.1.dev3486-cp39-cp39-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 ffa7af5868ad117b754b1e283c482eab16a34ad1c0426ae27f4d5b833925f0d3
MD5 d32e1b454f4ff1040497fb6fee136f84
BLAKE2b-256 44c07de7587e6802ff2de2926a3d97e788728f92cff99d94f73f2bd417734aa9

See more details on using hashes here.

Provenance

The following attestation bundles were made for sogen-0.0.1.dev3486-cp39-cp39-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.dev3486-cp39-cp39-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for sogen-0.0.1.dev3486-cp39-cp39-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 1833631230e391ca0015ed895ab90d15c6842c3273cf2e314615efc7b34ddd79
MD5 36a4e2d58f058ba3fd7033da1daf091b
BLAKE2b-256 1d2f1da91af031a407a589fddf519332782f6f7dac9ad625b63fdd29e7d8a70d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sogen-0.0.1.dev3486-cp39-cp39-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