Coder Social home page Coder Social logo

fish-lll / pypcode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from angr/pypcode

0.0 0.0 0.0 3.27 MB

Python bindings to Ghidra's SLEIGH library for disassembly and lifting to p-code IR

License: Other

Shell 0.03% C++ 80.58% Python 8.51% C 0.44% Assembly 4.00% Makefile 0.82% CMake 0.12% Yacc 4.26% Lex 1.24%

pypcode's Introduction

pypcode

pypi Build Status

Machine code disassembly and IR translation library for Python using the excellent SLEIGH library from the Ghidra framework.

This library was created primarily for use with angr, which provides analyses and symbolic execution of p-code.

Quick Start

This package can be installed on Linux, macOS, and Windows platforms for recent (3.6+) versions of both CPython and PyPy. Wheels are provided for several configurations. You can install the latest release from PyPI using pip:

pip3 install pypcode

You can also install the very latest development version from this repository using pip:

pip3 install --user git+https://github.com/angr/pypcode

You can now invoke the pypcode module from command line to translate supported machine code to P-code from command line. Run python -m pypcode --help for usage information. See module source (__main__.py) for examples of using pypcode as a library.

Example

$ python -m pypcode -b x86:LE:64:default test-x64.bin
--------------------------------------------------------------------------------
00000000/2: XOR EAX,EAX
--------------------------------------------------------------------------------
  0: CF = 0x0
  1: OF = 0x0
  2: EAX = EAX ^ EAX
  3: RAX = zext(EAX)
  4: SF = EAX s< 0x0
  5: ZF = EAX == 0x0
  6: unique[0x2580:4] = EAX & 0xff
  7: unique[0x2590:1] = popcount(unique[0x2580:4])
  8: unique[0x25a0:1] = unique[0x2590:1] & 0x1
  9: PF = unique[0x25a0:1] == 0x0

--------------------------------------------------------------------------------
00000002/2: CMP ESI,EAX
--------------------------------------------------------------------------------
  0: CF = ESI < EAX
  1: OF = sborrow(ESI, EAX)
  2: unique[0x5180:4] = ESI - EAX
  3: SF = unique[0x5180:4] s< 0x0
  4: ZF = unique[0x5180:4] == 0x0
  5: unique[0x2580:4] = unique[0x5180:4] & 0xff
  6: unique[0x2590:1] = popcount(unique[0x2580:4])
  7: unique[0x25a0:1] = unique[0x2590:1] & 0x1
  8: PF = unique[0x25a0:1] == 0x0

--------------------------------------------------------------------------------
00000004/2: JBE 0x17
--------------------------------------------------------------------------------
  0: unique[0x18f0:1] = CF || ZF
  1: if (unique[0x18f0:1]) goto ram[0x17:8]

pypcode's People

Contributors

fantasquex avatar mborgerson avatar nabar33 avatar

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.