-
Notifications
You must be signed in to change notification settings - Fork 0
/
exec.sh
executable file
·46 lines (40 loc) · 1.33 KB
/
exec.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
#preprocessing
adb shell 'ls /data/mini_trace*' | tr -d '\r' | sed -e 's/^\///' | xargs -n1 adb shell rm
pack=$(head -1 Config.txt | awk 'BEGIN {FS=" "} {print $3}')
cp Config.txt EventGenerator/
cp Config.txt Instrumentor/
cp Config.txt VMDriver/
rm EventGenerator/apks/*
rm Instrumentor/apks/*
cp Subject/*.apk EventGenerator/apks/
cp Subject/*.apk Instrumentor/apks/
# activates trace collection
cd android-mt-cmd
python install.py
python minitrace.py enable $pack
# begin event sequence generation
cd ../
cp Subject/*.apk EventGenerator/apks/
cp Config.txt EventGenerator/
cd EventGenerator
timeout 1m java -jar DynamicController.jar
adb shell ps | grep uiautomator | adb shell kill
# stop trace collection and obtain traces
cd ../android-mt-cmd && python minitrace.py disable $pack
cd ../Instrumentor/execution_traces
rm *
adb shell 'ls /data/mini_trace*' | tr -d '\r' | sed -e 's/^\///' | xargs -n1 adb pull
adb shell 'ls /sdcard/mini_trace*' | tr -d '\r' | sed -e 's/^\///' | xargs -n1 adb pull
# analyze traces and instrument apk
log=$(ls *.log)
trace=$(ls *.bin)
cd ../ && java -jar Instrumentor.jar $log $trace
# manifest concurrency bugs
cd analysis_result
cp *.apk ../../VMDriver/subjects/apks/
cp *.txt ../../VMDriver/subjects/suspicious/
cd ../../VMDriver
apk=$(ls subjects/apks/*)
sus=$(ls subjects/suspicious/*)
./run.sh 5 $apk $sus