-
Notifications
You must be signed in to change notification settings - Fork 2
/
processApk.sh
52 lines (39 loc) · 1.1 KB
/
processApk.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
47
48
49
50
51
#!/bin/bash
trap "exit" INT
TEST_TIME=20
f=$1
echo $f
apk=$(basename -- "$f")
appId="${apk%.*}"
killwait ()
{
(sleep 1; kill $1) &
wait $1
}
if [ ! -f ./android_log/$appId.chls ]; then
log=./android_log.txt
mitmdump -p 8889 --mode socks5 --showhost -w ./android_log/mitm/$appId.mitm -s ./helpers/har_dump.py --set hardump=./android_log/zhar/$appId.zhar --ssl-insecure &
PID=$!
sleep 2
pkill adb
adb shell input keyevent KEYCODE_HOME
adb shell am start -a android.intent.action.MAIN -c android.intent.category.HOME
echo "-----installing $appId / $bundleId "
echo "-----installing $appId / $bundleId " >> $log
adb install -g $f # grant all permissions
if (( $? != 0 )); then
echo "-----failure installing $appId" >> $log
else
sleep 2
echo "-----starting $appId" >> $log
adb shell monkey -p $appId 1
sleep $TEST_TIME
echo "-----uninstalling testing $appId" >> $log
adb uninstall $appId
sleep 10
fi
killwait $PID
echo "-----end testing $appId" >> $log
else
echo "skipping $appId"
fi