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

Uploaded CPython 3.12Windows x86-64

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

File metadata

  • Download URL: sogen-0.0.1.dev3422.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.dev3422.tar.gz
Algorithm Hash digest
SHA256 23e9b9b7814d01959f6869d780a44999b044ad755258a9339f1c839354625593
MD5 a7817b772cd1d670bc856d0a1450f2c7
BLAKE2b-256 10e74215a0511bd5a5de8b42a541da9f29b806a91115cc589b2cc6a2e228dc63

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sogen-0.0.1.dev3422-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 955083727c9b190e25b74151a6a48d334badf97deb0bbcb97bdb57559fb900ef
MD5 55080ed7a057c6d8bbcaa29d0a3c0d5c
BLAKE2b-256 c2ec92f5c8af6c444465659ebe3e1748e6cda5c9874d88de5b8f27003c7d4f9d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sogen-0.0.1.dev3422-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 dc50fa6c3345b2415315e285850e9f9a8d3c2018ab1219c27afe0d290f714284
MD5 0385210726c70bbfa57b4337f9a07a3a
BLAKE2b-256 407e25b8bc463b8f83c0abac4bfdf692a20d8af38137e18016b63f4f6a6141e5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sogen-0.0.1.dev3422-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 d5be8f2e4b1f2406549452737a1b16c3c79b06921775dbd67f852348c7ac18bc
MD5 9bd6de995d3e363bc83c058deb16a1f7
BLAKE2b-256 0a785005ce66f03a617abe56cdb8893f411cefda3fb2117cd4877ddcf4971448

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sogen-0.0.1.dev3422-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 67e92677f6076687bc443a42eb4d602f71b8cfa76676fd8ff5c0a7f68ac1438f
MD5 44d6d910f2fb3f1b3e41c071b424cd8f
BLAKE2b-256 b0bc62fa928a67b147961b4db5715b363c236bec43c28659eeb3c9ca97f9d0b0

See more details on using hashes here.

Provenance

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