Skip to content
/ pyasm Public

A bytecode-engineering library for python 3.11

Notifications You must be signed in to change notification settings

0x3C50/pyasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyAsm

A bytecode-engineering library for python 3.11.

Installing

This project does not have a pip package (yet). To install it, the assembler.py file needs to be copied into the project it's used in.

Usage

This library (obviously) requires a lot of knowledge about python's bytecode syntax. If you're unsure about certain things, you can use python's compile combined with dis to figure certain things out. Here's an example:

import dis
def dump(source):
    compiled = compile(source, "", "exec")
    dis.dis(compiled)
dump("print(123)")

The examples.py file contains examples on how to use the library. The documentation in the library itself also contains some useful help.

Documentation

Documentation on the specific instructions can be found at the dis python docs.

If you wonder how specific python snippets look like in bytecode, refer to usage

Notes

  • The resulting assembly generated by this project needs to be run with python 3.11. No version below 3.11 will be able to parse the bytecode generated with this libary, due to pretty significant changes to the format.

About

A bytecode-engineering library for python 3.11

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages