Package: pyflowdroid
PyFlowDroidPython wrappers forFlowDroidApk analyzer. This project was built with two goals in mind:Automate the creation of a FlowDroid environment out-of-the-boxAllow the usage of FlowDroid from Python code1. Installation1.1 PrerequisitesMake sure you have:A working version ofjavain the PATH of your environment.A working version ofpythonin the PATH
of your environment.A working version ofgitin the PATH of your
environment.1.2 Installing pyFlowDroidYou can get it from pypi usingpip:$ pip install pyflowdroidThen, you need to run an additional command to make pyflowdroid download and
install FlowDroid and the required resources to use it:$ python -m pyflowdroid install2. Using pyflowdroid as a Python libraryYou can use this script as a guide for downloading and analyzing apk files
with pyflowdroid:importpyflowdroid# Path to a folder where the apks are storedapkfolder="./apks"# If you need test apks, you can dowload the desired amount# from a given provider into a destination folderpyflowdroid.fetch(10,'cubapk.com',apkfolder)# Analyze all the apks in a folderapk_count,leaks_count,leaky_apps=pyflowdroid.analyze(apkfolder)# Analyze a single apkflowdroid_logs=pyflowdroid.analyze_apk('./apks/test.apk')3. Using pyflowdroid as a command line toolThe 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.apkSimilarly, 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:cubapk.comTo fetch apks from a provider, just run:$ python -m pyflowdroid download amount path/to/store/apks/ provider_nameFor instance, to download 10 apk files from cubapk.com, run:$ python -m pyflowdroid download 10 ./myapks/ cubapk.com4. Contributing to pyflowdroidIf you want to add any features to pyflowdroid you will need to get a
development enviroment.4.1 Fetching the project source codeYou can clone the github repository by executing:$ git clone https://github.com/gvieralopez/pyFlowDroid
$ cd pyFlowDroid4.2 Installing pyFlowDroid dependenciesYou can install them withpoetryby executing:$ poetry shell
$ poetry install
$ poetry build4.3 Download FlowDroid and its dependenciesThis step will download and install FlowDroid. After doing this you can use
FlowDroid with or without pyFlowDroid wrappers.
Simply run:$ python -m pyflowdroid install4.4 Making your changes appear in the projectJust make a Pull Request.4.5 Quality Assurance:Run tests:$ pytestType checking:$ mypyCode style:$ flake84.6 Pending featuresImprove cli interface with hints on the parametersImprove cli interface with parameters all supported API functionsRecognize in runtime when Flowdroid and depencies were not installedAdd new apk providersWrite pytest unit testsWrite documentation