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.dev3476.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.dev3476-cp312-cp312-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.12Windows x86-64

sogen-0.0.1.dev3476-cp312-cp312-manylinux_2_39_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

sogen-0.0.1.dev3476-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.dev3476-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.dev3476.tar.gz.

File metadata

  • Download URL: sogen-0.0.1.dev3476.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.dev3476.tar.gz
Algorithm Hash digest
SHA256 95e7f1478ff39419c25e0a06f0700d20f53ae681c466f9b4e3d44afb2f3dc21f
MD5 7b3966e3c1f7b9966bdb96c8d7f3d611
BLAKE2b-256 a954054cfd188d2dc0cb7aa9200c9cf163629ffa5608cdc8ed8d61bcc5ece51f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sogen-0.0.1.dev3476-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5bdd29d1f0327d04c617dd73979909f1b32d9e3160e5393cd71d6d3027f0cb02
MD5 006c901c4d8b492ec81b1e3f03adece2
BLAKE2b-256 d9e9eecb5f54e41358f8b1515617f526f09f8ab8ad453ab19883de34daa5b56c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sogen-0.0.1.dev3476-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 de9c398122611ea1bbebe0ad36897d8d31dbd07b1fa02b805745a9d14bea79ff
MD5 add7703ef45c6f20664c8e71341b7d26
BLAKE2b-256 0dae1140ec936b5d37a92bed5b3ba07942a6b3244903e9b2310b67a5b154788a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sogen-0.0.1.dev3476-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 c329c1525f83ba1630c165c689393b99d879a05497b72c02b08e75ac800c6806
MD5 13057a5842dd108234dc58ff259bb656
BLAKE2b-256 6f5fd10cd6e33adac3a8c4fc0980b1d723a77f1277556cfd9c90db83b98b6201

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sogen-0.0.1.dev3476-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 1248014414a7ae3a6a2a411ef1c6582a6af27b4158a5d2fcf507a1e96424b52b
MD5 be020735bc7cb6c02d916e388413506e
BLAKE2b-256 dce64eac7c1b2321a0ae47d0829a60586988ff79f54e60f39c31c6717108c561

See more details on using hashes here.

Provenance

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