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

Uploaded CPython 3.12Windows x86-64

sogen-0.0.1.dev3483-cp312-cp312-manylinux_2_39_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

sogen-0.0.1.dev3483-cp312-cp312-macosx_15_0_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.12macOS 15.0+ x86-64

sogen-0.0.1.dev3483-cp312-cp312-macosx_15_0_arm64.whl (4.7 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

File details

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

File metadata

  • Download URL: sogen-0.0.1.dev3483.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.dev3483.tar.gz
Algorithm Hash digest
SHA256 32eed6d72315777194666115ede0fdfa0e8ad86cba282146cd716d41ca210ecc
MD5 20e0dab77e5be160b502e0edb12a7fa9
BLAKE2b-256 263931b75d6e27ac2394f6adaefb1c926f99ad4bb37229cf8c9a93d807889401

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sogen-0.0.1.dev3483-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1a3db0cac373fe3862326ca080d55a62b0bddec09177380fcb021dd5a915d4a6
MD5 fa5baa96595b6e1ad5d5588e48385ebf
BLAKE2b-256 5d7885ccf343e3c74bc8cd8284978ab27a519f09d9adcb7df496ae0245d973bf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sogen-0.0.1.dev3483-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 ccedc54f944fb194c0ea57ab3eb70cceb283212fa07988e3511e58f071016678
MD5 26fc687b29199d62bf3e48dc10409d65
BLAKE2b-256 02749f03a00f82e9848acf24e277ba432c2672ea0e7b87db826843bf3a6d0884

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sogen-0.0.1.dev3483-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 3b50aea90395d54aa8c6344e2f490ff42c40553757b2548428d092a17d07bf00
MD5 c4300b2ff182f925e3365b168ccc99df
BLAKE2b-256 8e60f7f343bd14668d302e4b572bd40802a898b93fe7ba07e78e00e228074224

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sogen-0.0.1.dev3483-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 c5de7903b173ded7a4bdb7b695eb9d8bae8af2cbc69ea88cba1bac552b6477c5
MD5 9442f71b350aaa3c4f6ee0a713aa2ef6
BLAKE2b-256 87b9f85aeb029b2e1183c7f4854348d72997f15c73c7768cf0ff6072064da161

See more details on using hashes here.

Provenance

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