9 unstable releases (3 breaking)

0.4.0 Aug 12, 2021
0.3.1 Aug 10, 2021
0.3.0 Dec 27, 2020
0.2.2 Dec 19, 2020
0.1.2 Dec 12, 2020

#965 in Programming languages

37 downloads per month
Used in unfuck

MIT license

36KB
822 lines

crates.io

pydis

A Rust crate for disassembling Python 2.7 bytecode

Example Usage

use pydis::prelude::*;
use pydis::opcode::py27::Standard;

fn disassemble(bytecode: &[u8]) {
    let mut rdr = std::io::Cursor::new(bytecode);
    // Decode using the standard Python 2.7 opcode table.
    // A custom opcode table can be passed by calling `decode::<OpcodeTable, _>(source)`
    while let Ok(instr) = decode_py27::<Standard, _>(&mut rdr) {
        println!("{:#?}", instr);
    }
}

Dependencies

~1.5MB
~40K SLoC