Skip to content

Running on the edge

Daniel Bradberry edited this page Nov 22, 2013 · 14 revisions

If you want to write drozer modules, you may want the latest code. We work on the develop branch on Github, which is often newer than the most recent release.

Preparation

If you want to run drozer from Github, there are a few things that you will have to set up first. In addition to the normal requirements for drozer, you will need to install:

  • GNU Make;
  • the Android SDK (available here); and
  • the Android NDK (available here).

You should also set the following environment variables:

  • add to your PATH /path/to/drozer/bin
  • add to your PYTHONPATH /path/to/drozer/src and /path/to/drozer/test
  • set SDK to /path/to/android-sdk-linux/platforms/android-16/android.jar

You will also need javac (for Java 6) and dx available on your path. dx can be found under platform-tools/ in the Android SDK.

Java Version

To compile Java sources for Android, you will need jdk6 installed and configured as the default version for javac. If you use jdk7, the generated class files will not be compatible with the Android dx tool.

Getting the Code

drozer is made up from a few repositories on Github.

drozer Server and Console

To run the drozer Server and Console, you only need the drozer repository:

git clone https://github.com/mwrlabs/drozer

cd drozer && git submodule init && git submodule update

drozer Agent

To build the drozer Agent from source you need a few repositories:

git clone https://github.com/mwrlabs/drozer-agent
git clone https://github.com/mwrlabs/jdiesel
git clone https://github.com/mwrlabs/mwr-android
git clone https://github.com/mwrlabs/mwr-tls

cd jdiesel && git submodule init && git submodule update

You can import these projects into the Eclipse IDE (take care not to change the folder names), or use the ant build system to compile the APK file:

ant debug

Starting drozer

Once you have set up your environment, you should be able to start drozer using the normal command:

drozer console connect

Note: the behaviour is undefined if you have drozer installed on your system from a distribution. You may want to adjust your PYTHONPATH to exclude installed drozer or use virtualenv to create an isolated environment.

Building APKs

Some drozer commands deliver an APK file to the Agent. These are built from the various Java source files in the src/drozer/modules/ tree.

A Makefile is provided to automate building of these sources. To invoke it, run the apks target from the drozer root directory:

make apks

This should be run every time you make a change to a Java file or if you have just started using the development version and these APK files have not yet been generated.

Building Native Libraries

Some drozer commands use a small piece of Native code, to get lower level access to the underlying system than Java allows. These are typically provided with a C/C++ implementation in the src/drozer/modules/ tree.

A Makefile is provided to automate building of these sources. To invoke it, run the native-libraries target from the drozer root directory:

make native-libraries

This should be run every time you make a change to a native file or if you have just started using the development version and these native sources have not yet been compiled.