Building on Windows fails. Can DirtyCowAndroid run on Windows?
Closed this issue · 2 comments
pycabbage commented
Windows10 64bit
C:\Users\cabba\code\DirtyCowAndroid\DirtyCow>ndk-build --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i686-w64-mingw32
then,
git clone git@github.com:Tlgyt/DirtyCowAndroid.git --depth 1
cd DirtyCowAndroid\DirtyCow
make
this error
C:\Users\cabba\code\DirtyCowAndroid\DirtyCow>make
ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk APP_PLATFORM=android-21
make[1]: Entering directory `C:/Users/cabba/code/DirtyCowAndroid/DirtyCow'
[arm64-v8a] Compile : dirtycow <= dirtycow.c
./dirtycow.c:50:36: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
LOGV("[*] madvise = %p %d", addr, size);
~~ ^~~~
%zu
./dirtycow.c:17:70: note: expanded from macro 'LOGV'
#define LOGV(...) { __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
^~~~~~~~~~~
./dirtycow.c:50:36: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
LOGV("[*] madvise = %p %d", addr, size);
~~ ^~~~
%zu
./dirtycow.c:17:91: note: expanded from macro 'LOGV'
#define LOGV(...) { __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
^~~~~~~~~~~
./dirtycow.c:136:75: warning: format specifies type 'long long' but the argument has type 'off_t' (aka 'long') [-Wformat]
LOGV("warning: new file size (%lld) and file old size (%lld) differ\n", st2.st_size, st.st_size);
~~~~ ^~~~~~~~~~~
%ld
./dirtycow.c:17:70: note: expanded from macro 'LOGV'
#define LOGV(...) { __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
^~~~~~~~~~~
./dirtycow.c:136:88: warning: format specifies type 'long long' but the argument has type 'off_t' (aka 'long') [-Wformat]
LOGV("warning: new file size (%lld) and file old size (%lld) differ\n", st2.st_size, st.st_size);
~~~~ ^~~~~~~~~~
%ld
./dirtycow.c:17:70: note: expanded from macro 'LOGV'
#define LOGV(...) { __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
^~~~~~~~~~~
./dirtycow.c:136:75: warning: format specifies type 'long long' but the argument has type 'off_t' (aka 'long') [-Wformat]
LOGV("warning: new file size (%lld) and file old size (%lld) differ\n", st2.st_size, st.st_size);
~~~~ ^~~~~~~~~~~
%ld
./dirtycow.c:17:91: note: expanded from macro 'LOGV'
#define LOGV(...) { __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
^~~~~~~~~~~
./dirtycow.c:136:88: warning: format specifies type 'long long' but the argument has type 'off_t' (aka 'long') [-Wformat]
LOGV("warning: new file size (%lld) and file old size (%lld) differ\n", st2.st_size, st.st_size);
~~~~ ^~~~~~~~~~
%ld
./dirtycow.c:17:91: note: expanded from macro 'LOGV'
#define LOGV(...) { __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
^~~~~~~~~~~
./dirtycow.c:142:21: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
LOGV("size %d\n\n",size);
~~ ^~~~
%zu
./dirtycow.c:17:70: note: expanded from macro 'LOGV'
#define LOGV(...) { __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
^~~~~~~~~~~
./dirtycow.c:142:21: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
LOGV("size %d\n\n",size);
~~ ^~~~
%zu
./dirtycow.c:17:91: note: expanded from macro 'LOGV'
#define LOGV(...) { __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
^~~~~~~~~~~
8 warnings generated.
[arm64-v8a] Executable : dirtycow
[arm64-v8a] Install : dirtycow => libs/arm64-v8a/dirtycow
[arm64-v8a] Compile : run-as <= run-as.c
./run-as.c:12:3: warning: implicitly declaring library function 'memset' with type 'void *(void *, int, unsigned long)' [-Wimplicit-function-declaration]
memset(&capheader, 0, sizeof(capheader));
^
./run-as.c:12:3: note: include the header <string.h> or explicitly provide a declaration for 'memset'
./run-as.c:20:48: warning: implicitly declaring library function 'strerror' with type 'char *(int)' [-Wimplicit-function-declaration]
printf("Could not set capabilities: %s\n", strerror(errno));
^
./run-as.c:20:48: note: include the header <string.h> or explicitly provide a declaration for 'strerror'
./run-as.c:20:57: error: use of undeclared identifier 'errno'
printf("Could not set capabilities: %s\n", strerror(errno));
^
./run-as.c:29:3: warning: implicit declaration of function 'system' is invalid in C99 [-Wimplicit-function-declaration]
system("su");
^
3 warnings and 1 error generated.
make[1]: *** [obj/local/arm64-v8a/objs/run-as/run-as.o] Error 1
make[1]: Leaving directory `C:/Users/cabba/code/DirtyCowAndroid/DirtyCow'
make: *** [build] エラー 2
File structure at this time
C:\Users\cabba\code\DirtyCowAndroid\DirtyCow>tree
フォルダー パスの一覧
ボリューム シリアル番号は 9833-665A です
C:.
├─libs
│ └─arm64-v8a
└─obj
└─local
└─arm64-v8a
└─objs
└─dirtycow
Can DirtyCowAndroid really run on Windows?
pycabbage commented
By the way, "エラー" in the above error statement means "error".
pycabbage commented
sorry i missed Currently Linux Only