Git Product home page Git Product logo

pyn's Introduction

pyn

Awesome Python bindings for Pintool. Pyn aims to offer an extremely easy API for quickly writing Pintools.

Pyn features a raw API close to the original Pintool API as well as a more Pythonic API. It's important to understand that Pyn hides various aspects of regular Pintools, allowing one to make full-featured Pintools in just a handful lines of code.

Pintool has several callback functions, e.g., the one registered by calling INS_AddInstrumentFunction. As an example for a normal Pintool, take the following piece of C code.

#include <stdio.h>
#include "pin.H"

void instructions(INS ins, void *v)
{
    printf("-> %s\n", INS_Disassemble(ins).c_str());
}

int main(int argc, char *argv[])
{
    PIN_Init(argc, argv);

    INS_AddInstrumentFunction(&instructions, NULL);

    PIN_StartProgram();
    return 0;
}

This is already a complete Pintool. However, when writing Pintools time after time, each for its own specific purpose, this boilerplate code becomes repetitive. Hence the Pintool from above can be rewritten using Pyn to just the following few lines of code.

def instr(ins):
    print INS_Disassemble(ins)

Or, when using the extended Pythonic API, we do the following. (More on that later.)

def instr2(ins):
    print ins.disasm

Documentation

Currently there is no documentation for Pyn yet, as it's still under heavy development. However, more examples and documentation are planned as development continues and a more well-tested version of Pyn is being released.

Binaries

Given Pintools are fairly annoying to compile by themselves, not even starting about compiling Python with them, I plan on releasing binaries later on. Currently I only have 32-bit Windows binaries as I'm still struggling with linux builds and 64-bit Windows builds, but let's wait and see.

pyn's People

Contributors

jbremer avatar

Watchers

James Cloos avatar AmesianX avatar  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.