Giter Club home page Giter Club logo

baredroid's Introduction

BareDroid

BareDroid allows for bare-metal analysis on Android devices. See the paper here

Folders

backup: used to create a backup of the device. It is a bash script which stores a copy of:

  • userdata
  • system
  • boot in the store partition (partition number 30). This is needed only when you want to setup a new device.

restore: used to restore a previous backup. It is a bash script which restore a) system, b) userdata and c) userdatanew partition.

backup_and_restore: used to create a backup and restore it. It is a merge of the previous scripts.

setup_device:

  • setup: used to setup a device. Basically, this script creates the new partitions;

update: contains the python scripts used to manage the infrastructure.

  • adb.py: provides APIs used to send command through adb shell;
  • device.py: contains information about the update_manager associated to the device (deprecated, not used in the next version);
  • analysis.py: it bridges the gap between the infrastructure and the experiments. For a detailed description see below;
  • util.py: provides utilities (deprecated);
  • manager.py: manages the command line interface;
  • updtae_manager.py: it is the core of the infrastructure. It is a separate process which manages the update and analysis process;
  • update_manager_device.py: represents a separate process used to update the device during the analysis;
  • update_manager_recovery.py: represents a separate process used to update the device during the reboot. it is used to perform a relabel of the userdata partition ( SELinux :) );

update/config: contains cfg and info files used to setup the python scripts.

  • config.cfg: contains the information about where to save the logs, and which scripts use to perform the analysis
  • devices.info: contains general information about the devices (e.g., user, AndroidId)

How to backup

  1. connect the device
  2. run the "./script" file (the script reboots the device in recovery mode and run the script)
  3. reboot the device

How to restore

  1. connect the device
  2. run the "./script" file (the script reboots the device in recovery mode and run the script)
  3. reboot the device

Analysis script

The goal of this script is to provide a wrapper between the experiment and the infrastructure, SetupAndStart is the main method and the only one called by the infrastructure (i.e., update_manager.py line 178). It setups the environment for the experiment (e.g., adb root) and run the experiment. If you want to use your code in an experiment you need to:

  1. modify the config.cfg file. In the stanza 'Project' put the absolute path to the code that you want to use;
  2. create an python script containing the class used in the stanza 'class' of the config.cfg file;
  3. define a 'run' method in the config.cfg file. This is the method used by the wrapper to start the experiment.

how to add a new device to the infrastructure

  1. see 'setup_device';
  2. run the backup and restore scripts;
  3. add info to the 'update/config/device.info' file (e.g., AndroidId); [mandatory]

general consideration:

  1. device -> Settings -> Storage -> USB computer connection -> disable MTP
  2. device -> Security -> Screen lock -> None
  3. be sure you can install untrusted app (i.e., from outside the market)

How to run an experiment

Architectural overview:

alt tag

  1. to run an experiment you need to include the absolute path of the folder containing the samples to analyze;
  2. run the manager start script against the folder containing the apps to analyze;

example

./start_baredroid path/to/folder/containing/samples
  1. the script will prompt a command line interface which allows the user to interact with the infrastructure (e.g., start experiment);
  2. select option '2' to run the experiment;
  3. when the experiment is finished click on 'q';
  4. the results are stored in the 'update/experiment' folder.

email: [email protected]

baredroid's People

Contributors

smutti avatar

Watchers

 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.