Skip to main content

Compiler for position-independent assembly programs

Project description

int3

Synopsis

int3 is a Python toolkit for writing low-level, position-independent code featuring the following...

A high-level command-line interface for common assembly tasks:

$ echo -n "int3" | int3 assemble -a x86_64 | int3 format
b"\xcc"

A Python interface for writing your own position-independent programs with automatic bad byte avoidance (examples/linux/hello_world.py):

import sys

from int3 import Compiler

cc = Compiler.from_str("linux/x86_64", bad_bytes=b"\n\r")

with cc.def_func.main():
    num_written = cc.sys_write(fd=1, buf=b"Hello, world\n")
    cc.sys_exit(num_written)

sys.stdout.buffer.write(cc.compile())

Support for disassembling them:

$ python3 examples/linux/hello_world.py | python3 -m int3 disassemble | tail -10
0x0078: inc edx
0x007a: inc edx
0x007c: inc edx
0x007e: inc edx
0x0080: mov rax, rdi
0x0083: syscall
0x0085: mov rdi, rax
0x0088: mov eax, 0x3c
0x008d: syscall
0x008f: ret

And executing them:

$ python3 examples/linux/hello_world.py | python3 -m int3 execute ; echo $?
Hello, world
13

Installation

int3 is tested on the latest major version of CPython. You can get the latest release from PyPI with:

pip install int3

Features

  • Write position-independent assembly code in a higher-level Python interface
  • Builtin support for cross-compiling to various architectures
  • Mutate generated machine code to remove bad bytes
  • Command-line interface for common formatting and exploratory reversing tasks

License & Usage

int3 is intended for educational use. int3's unique code is released under the GNU LGPLv3, as per the LICENSE.txt file in the root of this repository. Code belonging to other open source projects is licensed under the respective licenses of those projects.

Project details


Download files

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

Source Distribution

int3-0.0.2.tar.gz (34.9 MB view details)

Uploaded Source

Built Distribution

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

int3-0.0.2-cp313-cp313-manylinux_2_38_x86_64.whl (35.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.38+ x86-64

File details

Details for the file int3-0.0.2.tar.gz.

File metadata

  • Download URL: int3-0.0.2.tar.gz
  • Upload date:
  • Size: 34.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.15

File hashes

Hashes for int3-0.0.2.tar.gz
Algorithm Hash digest
SHA256 12cff32060fb4d3b20e3ace28f68a37f235031e87abf25f38f85a1fe5dc291ef
MD5 67ca94bba50f33f37a6e109d38bdb4cf
BLAKE2b-256 52507025cf9ae43a466fc4aa4b05faa6abadba62eac446c797e102a352cd45ab

See more details on using hashes here.

File details

Details for the file int3-0.0.2-cp313-cp313-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for int3-0.0.2-cp313-cp313-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 c21054a95360c5e142453ab80c5ce59e4260baddb206c1613bb312c470beeb07
MD5 45c0705e623ab00426d6cdc4281cdde7
BLAKE2b-256 2269d2ac2c31612fc91220d2d77c980505d382c136ff274fe12391b283c60a8b

See more details on using hashes here.

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