GithubHelp home page GithubHelp logo

kordood / pysoot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from angr/pysoot

0.0 0.0 0.0 122.92 MB

Python bindings for Shimple/Jimple IR from Soot.

Python 99.02% Roff 0.01% PLSQL 0.16% HTML 0.76% Shell 0.06% VBScript 0.01%

pysoot's Introduction

PySoot

pysoot is a lifter from JAR/APK files to a Soot-like Python IR.

The master branch supports Python 3, the py2k branch supports Python2.

Installation

pip install -e .

How to use

from pysoot.lifter import Lifter
input_file = "tests/test_samples/simple1.jar" # the jar/apk you want to analyze
lifter = Lifter(input_file) # the default IR is Shimple, the default input_format is jar
classes = lifter.classes # get the IR of all the classes (as a dict of classes)
print(classes[list(classes.keys())[0]]) # print the IR of one of the translated classes

Many other examples are in tests/test_pysoot.py

lifter.soot_wrapper gives direct access to some Soot functionality. As of now, I added functions from Hierarchy.java, but it is easy (and "almost" automatic) to add others.

Requirements

  • Java. Currently tested using OpenJDK 8 (sudo apt-get install openjdk-8-jdk).

Other components used by pysoot are:

  • Jython. Already included in this repo, it is not neccesary to install it. The embedded version "simulates" a virtualenv with pysoot installed.
  • soot-trunk.jar. This is a slightly modified version of the pre-compiled Soot JAR. At some point, I will upload its source code and the compilation script somewhere. pysoot should also work with a normal version of soot-trunk.jar.

Internals

Components

pysoot works by running Soot (compiled in the embedded soot-trunk.jar) using Jython (embedded) and the code in soot_manager.py

jython_wrapper.py and jython_runner.py establish an IPC bi-directional channel which allows a Python process to call methods of an instance of a class in Jython (data is serialized/deserialized using pickle). jython_wrapper.py runs in Python, while jython_runner.py runs in Jython. In the future we could release this IPC-layer as a separate component.

lifter.py uses this IPC channel to ask Jython to create and serialize the IR.

Classes in pysoot.sootir are used both by the Jython code and the Python one.

Data-Flow Overview

Python --> lifter.py --> jython_wrapper.py --> Jython --> jython_runner.py --> soot_manager.py --> Soot --> Soot IR

Jython --> Soot IR --> classes in pysoot.sootir --> jython_runner.py, pickle --> Python --> jython_wrapper.py, unpickle --> classes in pysoot.sootir --> lifter.py


Pysoot Architecture

pysoot's People

Contributors

antoniobianchi333 avatar conand avatar dipanjan avatar kordood avatar ltfish avatar rhelmot avatar thrsten avatar zhangysh1995 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.