Skip to content

Instantly share code, notes, and snippets.

@maxvonhippel
Created April 27, 2018 02:04
Show Gist options
  • Save maxvonhippel/9df5d30beca2dea0a92ddac30b59e436 to your computer and use it in GitHub Desktop.
Save maxvonhippel/9df5d30beca2dea0a92ddac30b59e436 to your computer and use it in GitHub Desktop.
Getting started with MaMaDroid on Mac OS
# Clone MamaDroid
git clone https://bitbucket.org/gianluca_students/mamadroid_code.git mamadroid
# Get some malware to look at
git clone https://github.com/ashishb/android-malware.git malware
# Export variables
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/
export JRE_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/bin
export PATH=$JAVA_HOME:$JRE_HOME:$PATH
# Base dir variable for convenience
basedir=$(echo $(pwd)/mamadroid)
cd mamadroid
mv soot_jars soot
cd soot
# axml-2.0.jar
wget https://github.com/secure-software-engineering/soot-infoflow-android/raw/develop/lib/axml-2.0.jar
# slf4j-api-1.7.5.jar
wget https://github.com/secure-software-engineering/soot-infoflow-android/raw/b436c512431d875a0bb3c53ea55bbdb137c0aab0/lib/slf4j-api-1.7.5.jar
# slf4j-simple-1.7.5.jar
wget https://github.com/secure-software-engineering/soot-infoflow-android/raw/b436c512431d875a0bb3c53ea55bbdb137c0aab0/lib/slf4j-simple-1.7.5.jar
# soot-infoflow-android.jar should already be in there
# soot-infoflow.jar should already be in there
# soot-trunk.jar should already be in there
# SourcesAndSinks.txt
wget https://raw.githubusercontent.com/secure-software-engineering/soot-infoflow-android/develop/SourcesAndSinks.txt
# AndroidCallbacks.txt
wget https://raw.githubusercontent.com/0-14N/soot-infoflow-android/master/AndroidCallbacks.txt
# EasyTaintWrapperSource.txt
wget https://raw.githubusercontent.com/secure-software-engineering/soot-infoflow/develop/EasyTaintWrapperSource.txt
# Export classpath for java
export CLASSPATH="$basedir/.:$basedir/soot/soot-trunk.jar:$basedir/soot/soot-infoflow.jar:$basedir/soot/soot-infoflow-android.jar:$basedir/soot/slf4j-simple-1.7.5.jar:$basedir/soot/slf4j-api-1.7.5.jar:$basedir/soot/axml-2.0.jar:$basedir/soot/sootclasses-trunk-jar-with-dependencies.jar"
cd ..
# Compile Appgraph
javac -cp $CLASSPATH Appgraph.java
export ANDORID_JARS=$HOME/Library/Android/sdk/platforms
# Get DroidBench
cd ..
git clone https://github.com/secure-software-engineering/DroidBench.git
cd mamadroid
# Add DroidBench path
export DROIDBENCH=$HOME/DroidBench
# Now we try it on an app
badapp=../android-malware/Android.Malware.at_plapk.a/com.fdhgkjhrtjkjbx.model.apk
python2 mamadroid.py -f $badapp -d $ANDORID_JARS
# A ton of stuff gets output
less com.fdhgkjhrtjkjbx.model.txt
# ^^ Presumably this file is what I will be able to do something interesting with using MaMaDroid once I learn how it works
@maxvonhippel
Copy link
Author

If any of you find the solutions to these problems feel free to share them here.

@maxvonhippel
Copy link
Author

@PegX I am sure I never used any database in MaMaDroid, I probably only ever ran the code I wrote in this gist, ie., python2 mamadroid.py -f $badapp -d $ANDORID_JARS ... sorry!

@PegX
Copy link

PegX commented Jun 22, 2020

@PegX I am sure I never used any database in MaMaDroid, I probably only ever ran the code I wrote in this gist, ie., python2 mamadroid.py -f $badapp -d $ANDORID_JARS ... sorry!

Hi Max. No worries. Thanks for your reply. Actually I checked the code and find out some tips. Thanks again.

@maxvonhippel
Copy link
Author

Sure! Glad this helped!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment