Skip to main content

Python bindings for the xex2 crate: parse, inspect, and patch Xbox 360 XEX2 executables.

Project description

xex2 (Python)

Python bindings for the xex2 crate via diplomat + nanobind. Parse Xbox 360 XEX2 executables and extract the inner PE from Python.

Build pipeline

The pipeline is intentionally small; everything below the src/xex2.cpp glue file is auto-generated or stock tooling.

┌─────────────────────────────┐
│ crates/xex2-ffi/src/lib.rs  │  #[diplomat::bridge] — hand-written
└────────────┬────────────────┘
             │ diplomat-tool cpp
             ▼
┌─────────────────────────────────────────────┐
│ crates/xex2-ffi/bindings/cpp/*.hpp          │  auto-generated C++
│ (Xex2.hpp, Xex2Bytes.hpp, Xex2Error.hpp,    │  (gitignored)
│  diplomat_runtime.hpp, ...)                 │
└────────────┬────────────────────────────────┘
             │ #include
             ▼
┌─────────────────────────────┐
│ bindings/python/src/xex2.cpp│  nanobind glue — hand-written
└────────────┬────────────────┘
             │ nanobind + scikit-build-core
             ▼
┌─────────────────────────────┐
│ xex2.cpython-<ver>-<abi>.so │  final Python extension module
└─────────────────────────────┘

Install

From PyPI (once published):

pip install xex2
# or
uv add xex2

Pre-built wheels cover CPython 3.10–3.14 on Linux (manylinux_2_28 x86_64), macOS (arm64 + x86_64), and Windows x86_64. The extension is statically linked to libxex2_ffi.a, so wheels have no dependency on a separately installed native library.

Building from source

Source builds need the full Rust workspace available; they're only intended for local development.

# From the workspace root:
cargo build -p xex2-ffi --release
diplomat-tool cpp crates/xex2-ffi/bindings/cpp \
    --entry crates/xex2-ffi/src/lib.rs

# Then:
cd bindings/python
uv pip install -e . --no-build-isolation

Use

import xex2

data = open("game.xex", "rb").read()
x = xex2.Xex2.parse(data)

# Always-present fields (from SecurityInfo / ImageInfo / Xex2Header).
print(f"load_address:  {x.load_address:#010x}")
print(f"image_size:    {x.image_size:#x}")
print(f"module_flags:  {x.module_flags:#x}")
print(f"image_flags:   {x.image_flags:#x}")

# Optional-header-backed fields raise RuntimeError when absent —
# `xex2`'s `Option<T>` is propagated as a typed error rather than a
# silent default. Catch or use .get-style wrappers yourself.
try:
    print(f"entry_point:   {x.entry_point:#010x}")
except RuntimeError:
    print("no entry point set")

# ExecutionInfo-derived fields.
for field in ("title_id", "version", "disc_number", "disc_count"):
    try:
        print(f"{field:14s} {getattr(x, field)!r}")
    except RuntimeError:
        pass

# Fixed-size byte fields come back as `bytes`.
print(f"image_hash:    {x.image_hash.hex()}")
print(f"rsa_signature: {len(x.rsa_signature)} bytes")

# Imports / resources are iterable.
for lib in (x.imports()[i] for i in range(len(x.imports()))):
    print(f"import: {lib.name} v{lib.version:#010x} ({len(lib)} records)")

# Modify: strip restrictions, get a re-signed XEX back as bytes.
limits = xex2.Xex2RemoveLimits.all()
open("game-unlocked.xex", "wb").write(x.modify(limits))

# Extract the decrypted / decompressed PE.
open("game.pe", "wb").write(x.extract_basefile())

Surface

  • Always present: load_address, image_size, header_size, page_descriptor_count, info_size, image_flags, import_table_count, export_table_address, game_regions, allowed_media_types, module_flags, data_offset, security_offset, optional_header_count.
  • Optional scalars (raise on absence): entry_point, original_base_address, default_stack_size, default_heap_size, default_fs_cache_size, date_range_not_before, date_range_not_after, bounding_path.
  • ExecutionInfo (raise on absence): title_id, exec_media_id, version, base_version, platform, executable_table, disc_number, disc_count, savegame_id.
  • FileFormatInfo (raise on absence): compression_type, encryption_type, window_size.
  • Fixed-size bytes: image_hash (20), import_table_hash (20), header_hash (20), media_id (16), file_key (16), rsa_signature (256).
  • Collections: imports()Xex2Imports, resources()Xex2Resources. Both support len(), [i], and get(i); OOB indices raise RuntimeError.
  • Operations: extract_basefile()bytes (decrypted/decompressed PE); modify(Xex2RemoveLimits)bytes (re-signed XEX with the requested restrictions stripped).

Tests

cd bindings/python
uv run pytest

Tests that need a real fixture (xex_files/afplayer.xex) skip when the file isn't present so a fresh clone still runs the suite.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

xex2-0.3.0-cp314-cp314-win_amd64.whl (479.2 kB view details)

Uploaded CPython 3.14Windows x86-64

xex2-0.3.0-cp314-cp314-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

xex2-0.3.0-cp314-cp314-macosx_11_0_universal2.whl (1.9 MB view details)

Uploaded CPython 3.14macOS 11.0+ universal2 (ARM64, x86-64)

xex2-0.3.0-cp313-cp313-win_amd64.whl (462.8 kB view details)

Uploaded CPython 3.13Windows x86-64

xex2-0.3.0-cp313-cp313-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

xex2-0.3.0-cp313-cp313-macosx_11_0_universal2.whl (1.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ universal2 (ARM64, x86-64)

xex2-0.3.0-cp312-cp312-win_amd64.whl (462.8 kB view details)

Uploaded CPython 3.12Windows x86-64

xex2-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

xex2-0.3.0-cp312-cp312-macosx_11_0_universal2.whl (1.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ universal2 (ARM64, x86-64)

xex2-0.3.0-cp311-cp311-win_amd64.whl (463.1 kB view details)

Uploaded CPython 3.11Windows x86-64

xex2-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

xex2-0.3.0-cp311-cp311-macosx_11_0_universal2.whl (1.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ universal2 (ARM64, x86-64)

xex2-0.3.0-cp310-cp310-win_amd64.whl (463.3 kB view details)

Uploaded CPython 3.10Windows x86-64

xex2-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

xex2-0.3.0-cp310-cp310-macosx_11_0_universal2.whl (1.9 MB view details)

Uploaded CPython 3.10macOS 11.0+ universal2 (ARM64, x86-64)

File details

Details for the file xex2-0.3.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: xex2-0.3.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 479.2 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xex2-0.3.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 d7cdb7996e8f0f483132fc59686ebb124184db190fa5c756f50318457fbd7c3e
MD5 4c26cbccf15d4db0c068d8b0f1a311df
BLAKE2b-256 560d92776a41c012f027303f2b94abb3abe749e9d2bddf31dc10c0994d6586b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp314-cp314-win_amd64.whl:

Publisher: pypi.yml on landaire/acceleration

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

File details

Details for the file xex2-0.3.0-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for xex2-0.3.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7fde3f9bc43ef82e32371e5b2d698b27a0b85bda967ea79dd7900b84b88b792e
MD5 71baf8d950d5b1ff01f1b5629016849e
BLAKE2b-256 77b9b8c2a60711fc4d76bc41142e8d6c7b14b3a85249cdc7941307d55ac091e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp314-cp314-manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on landaire/acceleration

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

File details

Details for the file xex2-0.3.0-cp314-cp314-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for xex2-0.3.0-cp314-cp314-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 330ad0dea6dfa997d5fdc433f45dd32c520c86ed79fd0ae185da300dac402d4a
MD5 808735a7d6aad01f4454b1c118904aa4
BLAKE2b-256 867edd31a2894a7b59e00ce87fea4850210004ac2fb3873cca483a171d3f80ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp314-cp314-macosx_11_0_universal2.whl:

Publisher: pypi.yml on landaire/acceleration

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

File details

Details for the file xex2-0.3.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: xex2-0.3.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 462.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xex2-0.3.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 04ff3b37660f2223abccb0a9eebfc5a337ba8d56dea98cf53021a4a8cb559a71
MD5 0cb66e53adb42b53ebdea6883160152e
BLAKE2b-256 dc2684b5d1a057d6922eb85dee11e66dc83375069056bc9901e6771e519f6030

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp313-cp313-win_amd64.whl:

Publisher: pypi.yml on landaire/acceleration

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

File details

Details for the file xex2-0.3.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for xex2-0.3.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 17b7b80fe77044e9fb1de52894b1a9582ed6834e036aebc113d7dd9ce84a945d
MD5 3d035033aaf119b2d2f4c4d4d26c8d1d
BLAKE2b-256 95f2ba197097d9f978cdb54365e7a3141383287350b63d76dcd0a5a5585918ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on landaire/acceleration

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

File details

Details for the file xex2-0.3.0-cp313-cp313-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for xex2-0.3.0-cp313-cp313-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 6bbec4dd2732f368c1ca51b2f1bc1d1bf8c973f60db8e672356021d56d3ef35b
MD5 8bd2794ea6154e44d802029f3bb671cf
BLAKE2b-256 5409a3e072ab5253a224dc51551f1b413f38d31b3562f71d2467fef49585d225

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp313-cp313-macosx_11_0_universal2.whl:

Publisher: pypi.yml on landaire/acceleration

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

File details

Details for the file xex2-0.3.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: xex2-0.3.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 462.8 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xex2-0.3.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 03605a33331fcd484dad4e89d26a9e1e28166719457aa0613c117934cfa7599f
MD5 f4d4f6e9f17811b0ec2fe5677cc53e54
BLAKE2b-256 684aa3debef5f4a5e4afd88a81c68dd237a7ef91da39efa04ea34d14b7800ee9

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp312-cp312-win_amd64.whl:

Publisher: pypi.yml on landaire/acceleration

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

File details

Details for the file xex2-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for xex2-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fb94cdb7f616670934140be946314b7623b64e9ea1afa626e15426836a3a695f
MD5 8819da64116a2ea3217fdb34d8931603
BLAKE2b-256 a6b8c047b10808f38f6f08b45049473304acadf0bfbe5618a4b706a5a1719b3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on landaire/acceleration

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

File details

Details for the file xex2-0.3.0-cp312-cp312-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for xex2-0.3.0-cp312-cp312-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 5f9d5cf5167096a8f4fee2d49fc36fba77487cf573d893f7da8eb54d863b0933
MD5 2dfb96488db03f9d0191ce0ba00135dc
BLAKE2b-256 d91741e5613727c8ea488b68db33ab40df2e09ba82f375efb58992b7760d6e5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp312-cp312-macosx_11_0_universal2.whl:

Publisher: pypi.yml on landaire/acceleration

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

File details

Details for the file xex2-0.3.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: xex2-0.3.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 463.1 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xex2-0.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b50bd613563cdee3f9f167f64372043df235a48adaef58ae582f6411cee88860
MD5 ff8c80203706227dd07ec485939769db
BLAKE2b-256 8ea0dd09091003e833623e4813f7ef4501ef2c0add630009111673e17a1c2821

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp311-cp311-win_amd64.whl:

Publisher: pypi.yml on landaire/acceleration

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

File details

Details for the file xex2-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for xex2-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 093b8c35a09ddc472efc358ed749154f42f8730dcaec96473de49fad0e8921eb
MD5 daf9626cd3f35180ce175ea101e0bb53
BLAKE2b-256 f7a4bbda643fa2909d25cf739f11c6f2ed79ede12adbe9687b782e1b72b7e6f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on landaire/acceleration

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

File details

Details for the file xex2-0.3.0-cp311-cp311-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for xex2-0.3.0-cp311-cp311-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 12a51b40ba597449bb8d07f011683a8a58469f94502d74bab920d618cfa9e7cf
MD5 f531e5ab271f0350b2a877f15bd3e3bc
BLAKE2b-256 2a7e91a6bdecd38767046c9d3776a5236793551c18c7aa9831130c7c027ff4c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp311-cp311-macosx_11_0_universal2.whl:

Publisher: pypi.yml on landaire/acceleration

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

File details

Details for the file xex2-0.3.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: xex2-0.3.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 463.3 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xex2-0.3.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c3068de89921fb3bdd2e769598cd1a3b1ad06078a837dee726d9b56f1f2caa01
MD5 06755a7d4a6c2cbeb3b70af3f006c3c5
BLAKE2b-256 4eec25838bc92ad2f25f58a4b243a70232f53308647e424b7c08c428d3a813d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp310-cp310-win_amd64.whl:

Publisher: pypi.yml on landaire/acceleration

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

File details

Details for the file xex2-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for xex2-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3f1d2c2f710dfe7d03f325be1dd2191fceb7a70c858d65a47078934445c30aa8
MD5 9088cc72e9b41504f84a45f7ae7cee11
BLAKE2b-256 a9e0fcf43218fbf44ab500e697cc0a001b14630dbdb33bfe6ced48694f0c5a66

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on landaire/acceleration

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

File details

Details for the file xex2-0.3.0-cp310-cp310-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for xex2-0.3.0-cp310-cp310-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 40aab2b86cc4d8e66f0f6c69fca7b4bbc4793a5776fbb57a05fda99e3a2db362
MD5 5ac8b074711f6bc7db2bfda4a657aec8
BLAKE2b-256 a61704fe7f18686988d198d3d00551063baa3c08a9275f310476c98e1b697581

See more details on using hashes here.

Provenance

The following attestation bundles were made for xex2-0.3.0-cp310-cp310-macosx_11_0_universal2.whl:

Publisher: pypi.yml on landaire/acceleration

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