Giter VIP home page Giter VIP logo

payasm's Introduction

payasm

Travis

A sweet little python assembler which assembles back output from dis to python bytecode.

What it can do?

payASM can assemble your disassembled python code into CPython's bytecode implementation. So, you can write the assembled bytecode as a pyc file and execute it with a Python interpreter.

Currently the test suite contains a simple Hello World! program and an Armstrong number generator program. More test cases with complex disassemblies are welcome.

This project is a work-in-progress. So, there is a huge number of limitations.

Limitations

  • Currently works only with Python 2. (Although extending it to Python3 is trivial)
  • No support for lambdas
  • No *args and **kwargs support

Contributions

Contributions are welcome ๐Ÿ˜„

Will add the next features to be implemented in issues soon.

payasm's People

Contributors

rkrp avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

payasm's Issues

Reconstruct entire pyc

As of now, assembling the output from dis, only yields a code object which is then directly fed to eval to check for functional correctness. This will not be able to reconstruct back the executable pyc file. Extending this to produce an executable pyc output is necessary to complete #2

Bug with installation

python setup.py build: gives error: file '/home/crank/payasm/bin/payasm' does not exist

running install
running bdist_egg
running egg_info
creating payasm.egg-info
writing payasm.egg-info/PKG-INFO
writing top-level names to payasm.egg-info/top_level.txt
writing dependency_links to payasm.egg-info/dependency_links.txt
writing manifest file 'payasm.egg-info/SOURCES.txt'
reading manifest file 'payasm.egg-info/SOURCES.txt'
writing manifest file 'payasm.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/payasm
copying build/lib.linux-x86_64-2.7/payasm/payasm.py -> build/bdist.linux-x86_64/egg/payasm
copying build/lib.linux-x86_64-2.7/payasm/__init__.py -> build/bdist.linux-x86_64/egg/payasm
byte-compiling build/bdist.linux-x86_64/egg/payasm/payasm.py to payasm.pyc
byte-compiling build/bdist.linux-x86_64/egg/payasm/__init__.py to __init__.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts
running install_scripts
running build_scripts
error: file '/home/crank/payasm/bin/payasm' does not exist

Line Number Support

Currently, the assembly will not populate co_lnotab which contains information on line number to bytecode mapping. Without this, the assembly will be successful and will return a functional python byte-compiled executable. But, the resulting pyc will not contain the line number information and so any stack traces on uncaught exceptions will not yield very useful information. Also, decompilation back to original Python source with tools like Uncompyle or Unpyc will not be possible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.