Python wrapper to use FlowDroid APK analyzer.
Project description
PyFlowDroid
Python wrappers for FlowDroid Apk analyzer. This project was built with two goals in mind:
- Automate the creation of a FlowDroid environment out-of-the-box
- Allow the usage of FlowDroid from Python code
Installation
Prerequisites
Make sure you have:
- A working version of java in the PATH of your environment.
- A working version of python in the PATH of your environment.
- A working version of git in the PATH of your environment.
Installing pyFlowDroid dependencies
You can install it with pip by:
$ pip install pyflowdroid
Download FlowDroid and its dependencies
This step will download and install FlowDroid and the required resources to use it:
$ python -m pyflowdroid install
Usage
There are two ways in which you can use pyflowdroid: As a command line tool or as a Python library.
Using pyflowdroid from the command line
The main advantage of using pyflowdroid as a command line tool over using FlowDroid directly is the automatic gathering of resources required to execute the flow analysis. pyflowdroid comes bundled with all the required resources to allow a quick analysis of apk files.
To analyze an .apk file with the default pyflowdroid setup, just run:
$ python -m pyflowdroid analyze path/to/file.apk
Similarly, you can perform a flow analysis on all the apks inside a folder:
$ python -m pyflowdroid analyze path/to/folder/
This should store raw FlowDroid logs for each analyzed apk and then show a general report like the following:
################################################################################
# PYFLOWDROID REPORT #
################################################################################
Analized: 5
Leaks found: 2
Leaky apps:
- 'path/to/folder/app1.apk'
- 'path/to/folder/app3.apk'
If you want to get some test apks, pyflowdroid includes a download function to fetch apks from a given provider. Current available providers are:
To fetch apks from a provider, just run:
$ python -m pyflowdroid download amount path/to/store/apks/ provider_name
For instance, to download 10 apk files from cubapk.com, run:
$ python -m pyflowdroid download 10 ./myapks/ cubapk.com
Using pyflowdroid as a Python library
[Comming Soon]
Contributing to pyflowdroid
If you want to add any features to pyflowdroid you will need to get a development enviroment.
Fetching the project source code
You can clone the github repository by executing:
$ git clone https://github.com/gvieralopez/pyFlowDroid
$ cd pyFlowDroid
Installing pyFlowDroid dependencies
You can install them with poetry by executing:
$ poetry shell
$ poetry install
$ poetry build
Download FlowDroid and its dependencies
This step will download and install FlowDroid. After doing this you can use FlowDroid with or without pyFlowDroid wrappers. Simply run:
$ python -m pyflowdroid install
Making your changes appear in the project
Just make a Pull Request.
Run tests:
$ pytest
Type checking:
$ mypy
Code style:
$ flake8
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pyflowdroid-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70089189f3dc86e80790f4bde3b71d8b7d937e3c6975970a04c388f703766e10 |
|
MD5 | cd58408495b57a4616f5890cd23fdce0 |
|
BLAKE2b-256 | 32e929183959f44528b95e4e1cfc17695e0d391159ce2f255189f83477431c77 |