All Projects → rocky → python-xdis

rocky / python-xdis

Licence: GPL-2.0 License
Python cross-version bytecode library and disassembler

Programming Languages

python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language
shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to python-xdis

sleigh
Unofficial CMake build for Ghidra SLEIGH
Stars: ✭ 54 (-63.51%)
Mutual labels:  disassembler
semblance
Disassembler for Windows executables. Supports 16-bit NE (New Executable), MZ (DOS), and PE (Portable Executable, i.e. Win32) files.
Stars: ✭ 110 (-25.68%)
Mutual labels:  disassembler
pyc2bytecode
A Python Bytecode Disassembler helping reverse engineers in dissecting Python binaries by disassembling and analyzing the compiled python byte-code(.pyc) files across all python versions (including Python 3.10.*)
Stars: ✭ 70 (-52.7%)
Mutual labels:  disassembler
java-class-tools
Read and write java class files in Node.js or in the browser.
Stars: ✭ 27 (-81.76%)
Mutual labels:  disassembler
ethdasm
Tool for auditing Ethereum contracts
Stars: ✭ 52 (-64.86%)
Mutual labels:  disassembler
ded
DOS Executable disassembler
Stars: ✭ 27 (-81.76%)
Mutual labels:  disassembler
Capstone.NET
.NET Core and .NET Framework binding for the Capstone Disassembly Framework
Stars: ✭ 108 (-27.03%)
Mutual labels:  disassembler
ethereum-dasm
An ethereum evm bytecode disassembler and static/dynamic analysis tool
Stars: ✭ 121 (-18.24%)
Mutual labels:  disassembler
faucon
NVIDIA Falcon Microprocessor Suite
Stars: ✭ 28 (-81.08%)
Mutual labels:  disassembler
fadec
A fast and lightweight decoder for x86 and x86-64 and encoder for x86-64.
Stars: ✭ 44 (-70.27%)
Mutual labels:  disassembler
agsutils
contains utils for AGS: game extractor, repacker, disassembler and assembler
Stars: ✭ 30 (-79.73%)
Mutual labels:  disassembler
gas
A tool that transforms functions from object files into Go assembly. This repository has migrated to https://gitlab.com/opennota/gas
Stars: ✭ 18 (-87.84%)
Mutual labels:  disassembler
pac-man-emulator
🕹 An emulator for the Pac-Man arcade machine (Zilog Z80 CPU) for Win/Mac/*nix and Xbox One.
Stars: ✭ 20 (-86.49%)
Mutual labels:  disassembler
juniEmu
Emulator interface for ARM 32-bit
Stars: ✭ 32 (-78.38%)
Mutual labels:  disassembler
Dynzasm
X86/X64/ARM/MIPS Assembler/Disassembler/Decomposer Library
Stars: ✭ 21 (-85.81%)
Mutual labels:  disassembler
gdt helper
Ghidra Data Type (GDT) Helper
Stars: ✭ 24 (-83.78%)
Mutual labels:  disassembler
fasmi
F# -> ASM disassembler
Stars: ✭ 168 (+13.51%)
Mutual labels:  disassembler
rair-core
RAIR: RAdare In Rust
Stars: ✭ 63 (-57.43%)
Mutual labels:  disassembler
go6502
6502 CPU emulator, assembler and disassembler written in Go
Stars: ✭ 31 (-79.05%)
Mutual labels:  disassembler
BEFA-Library
High-level library for executable binary file analysis
Stars: ✭ 14 (-90.54%)
Mutual labels:  disassembler

TravisCI CircleCI PyPI Installs Latest Version Supported Python Versions

packagestatus

xdis

A Cross-Python bytecode disassembler, bytecode/wordcode and magic-number manipulation library/package.

Introduction

The Python dis module allows you to disassemble bytecode from the same version of Python that you are running on. But what about bytecode from different versions?

That's what this package is for. It can "marshal load" Python bytecodes from different versions of Python. The command-line routine pydisasm will show disassembly output using the most modern Python disassembly conventions.

Also, if you need to modify and write bytecode, the routines here can be of help. There are routines to pack and unpack the read-only tuples in Python's Code type. For interoperability between Python 2 and 3 we provide our own versions of the Code type, and we provide routines to reduce the tedium in writing a bytecode file.

This package also has an extensive knowledge of Python bytecode magic numbers, including Pypy and others, and how to translate from sys.sys_info major, minor, and release numbers to the corresponding magic value.

So If you want to write a cross-version assembler, or a bytecode-level optimizer this package may also be useful. In addition to the kinds of instruction categorization that dis` offers, we have additional categories for things that would be useful in such a bytecode optimizer.

The programs here accept bytecodes from Python version 1.0 to 3.10 or so. The code requires Python 2.4 or later and has been tested on Python running lots of Python versions.

When installing, except for the most recent versions of Python, use the Python egg or wheel that matches that version, e.g. xdis-6.0.2-py3.3.egg, xdis-6.0.2-py33-none-any.whl. Of course for versions that pre-date wheel's, like Python 2.6, you will have to use eggs.

To install older versions for from source in git use the branch python-2.4-to-2.7 for Python versions from 2.4 to 2.7, python-3.1-to-3.2 for Python versions from 3.1 to 3.2, python-3.3-to-3.5 for Python versions from 3.3 to 3.5. The master branch handles Python 3.6 and later.

Installation

The standard Python routine:

$ pip install -e .
$ pip install -r requirements-dev.txt

A GNU makefile is also provided so make install (possibly as root or sudo) will do the steps above.

Testing

$ make check

A GNU makefile has been added to smooth over setting running the right command, and running tests from fastest to slowest.

If you have remake installed, you can see the list of all tasks including tests via remake --tasks.

Usage

Run

$ ./bin/pydisasm -h

for usage help.

As a drop-in replacement for dis

xdis also provides some support as a drop in replacement for the the Python library dis module. This is may be desirable when you want to use the improved API from Python 3.4 or later from an earlier Python version.

For example:

>>> # works in Python 2 and 3
>>> import xdis.std as dis
>>> [x.opname for x in dis.Bytecode('a = 10')]
['LOAD_CONST', 'STORE_NAME', 'LOAD_CONST', 'RETURN_VALUE']

There may some small differences in output produced for formatted disassembly or how we show compiler flags. We expect you'll find the xdis output more informative though.

See Also

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].