Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@Dhani92

This comment has been minimized.

Copy link

commented Apr 27, 2018

Thanks for sharing this!!

@maxvonhippel

This comment has been minimized.

Copy link
Owner Author

commented Apr 28, 2018

Sure! Hope it helps!

@maxvonhippel

This comment has been minimized.

Copy link
Owner Author

commented Apr 28, 2018

I made another gist for making a figure from MAMADROID's output, you can check it out here

@OxfordNJ

This comment has been minimized.

Copy link

commented May 21, 2018

Hi, do you have any idea on optimizing the MaMaDroid?

@JunTomyang

This comment has been minimized.

Copy link

commented Aug 7, 2018

Hi maxvonhippel,
Thanks for your time and attention. I am setting up MaMadroid project. The formal steps are all executable. When I run the 'line 43' command, there appears an error as:
Exception in thread "main" java.lang.RuntimeException: file '/home/nsclab/Library/Android/sdk/platforms' does not exist!
at soot.Scene.getAndroidAPIVersion(Scene.java:338)
at soot.Scene.getAndroidJarPath(Scene.java:320)
at soot.jimple.infoflow.android.SetupApplication.getClasspath(SetupApplication.java:644)
at soot.jimple.infoflow.android.SetupApplication.initializeSoot(SetupApplication.java:660)
at soot.jimple.infoflow.android.SetupApplication.calculateCallbackMethods(SetupApplication.java:470)
at soot.jimple.infoflow.android.SetupApplication.calculateSourcesSinksEntrypoints(SetupApplication.java:401)
at soot.jimple.infoflow.android.SetupApplication.calculateSourcesSinksEntrypoints(SetupApplication.java:359)
at Appgraph.main(Appgraph.java:40)
Can you give me some advice? How can I install the SDK platforms? Look forward to your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.