-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.sh
68 lines (47 loc) · 1.24 KB
/
main.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
(cd /home/androidusr; nohup /home/androidusr/docker-android/mixins/scripts/run.sh &)
function wait_for_device() {
echo "Waiting for device..."
adb wait-for-device
while [ "$(adb get-state)" == "offline" ]; do
sleep 1
done
};
function setup_device() {
echo "Setting up device..."
adb root
sleep 5
adb shell avbctl disable-verification
adb disable-verity
adb reboot
};
function init_device() {
echo "Initializing device..."
adb root
sleep 5
adb remount
adb install challenge.apk
package_name='com.kuro.intention'
adb push flag.txt /data/data/$package_name/files/flag.txt
app_uid=$(adb shell dumpsys package $package_name | grep userId= | cut -d "=" -f 2)
adb shell chown -R $app_uid:$app_uid /data/data/$package_name/files
adb shell rm -f /system/xbin/su
adb reboot
};
adb start-server
wait_for_device
setup_device
wait_for_device
init_device
wait_for_device
while true; do
result=$(adb shell getprop sys.boot_completed 2>&1)
if [ "$result" == "1" ]; then
break
fi
sleep 1
done
adb shell pm grant com.android.chrome android.permission.READ_EXTERNAL_STORAGE
adb shell pm grant com.android.chrome android.permission.WRITE_EXTERNAL_STORAGE
cd ./ws-scrcpy
npm start