darvincisec / DetectFrida

Detect Frida for Android
MIT License
665 stars 138 forks source link

Build is Successful but while trying to install the APK in device. Build is failing with error #30

Closed erpriyeshpanchal closed 1 year ago

erpriyeshpanchal commented 1 year ago

Build command failed. Error while executing process C:\Users\Priyesh\AppData\Local\Android\Sdk\cmake\3.22.1\bin\ninja.exe with arguments {-C C:\Users\Priyesh\Downloads\DetectFrida-master\app.cxx\Debug\4y238423\armeabi-v7a native-lib} ninja: Entering directory `C:\Users\Priyesh\Downloads\DetectFrida-master\app.cxx\Debug\4y238423\armeabi-v7a' [1/2] Building C object CMakeFiles/native-lib.dir/native-lib.c.o [2/2] Linking C shared library C:\Users\Priyesh\Downloads\DetectFrida-master\app\build\intermediates\cxx\Debug\4y238423\obj\armeabi-v7a\libnative-lib.so FAILED: C:/Users/Priyesh/Downloads/DetectFrida-master/app/build/intermediates/cxx/Debug/4y238423/obj/armeabi-v7a/libnative-lib.so cmd.exe /C "cd . && C:\Users\Priyesh\AppData\Local\Android\Sdk\ndk\25.1.8937393\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe --target=armv7-none-linux-androideabi19 --sysroot=C:/Users/Priyesh/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -fno-limit-debug-info -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--gc-sections -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libnative-lib.so -o C:\Users\Priyesh\Downloads\DetectFrida-master\app\build\intermediates\cxx\Debug\4y238423\obj\armeabi-v7a\libnative-lib.so CMakeFiles/native-lib.dir/native-lib.c.o C:/Users/Priyesh/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/arm-linux-androideabi/19/liblog.so -latomic -lm && cmd.exe /C "cd /D C:\Users\Priyesh\Downloads\DetectFrida-master\app.cxx\Debug\4y238423\armeabi-v7a && C:\Users\Priyesh\AppData\Local\Android\Sdk\ndk\25.1.8937393\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-strip -R .comment -g -S -d --strip-unneeded C:/Users/Priyesh/Downloads/DetectFrida-master/app/src/main/c/../../../build/intermediates/cmake/Debug/obj/armeabi-v7a/libnative-lib.so"" 'C:\Users\Priyesh\AppData\Local\Android\Sdk\ndk\25.1.8937393\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-strip' is not recognized as an internal or external command, operable program or batch file. ninja: build stopped: subcommand failed.

erpriyeshpanchal commented 1 year ago

@darvincisec can you please help me out ?

darvincisec commented 1 year ago

Hi, In ndk 25.x, the strip command is llvm-strip..Try to find the path for llvm-strip in your ndk path and use it in the place of below path 'C:\Users\Priyesh\AppData\Local\Android\Sdk\ndk\25.1.8937393\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-strip' Other option is use older ndk versions as used in this project

erpriyeshpanchal commented 1 year ago

@darvincisec I tried replacing C:\Users\Priyesh\AppData\Local\Android\Sdk\ndk\25.1.8937393\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-strip with C:\Users\Priyesh\AppData\Local\Android\Sdk\ndk\25.1.8937393\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm-strip but still i am getting error while installing apk, can you please let me know the ndk version which you have used in this project as it is no where mentioned in project

erpriyeshpanchal commented 1 year ago

Build command failed. Error while executing process C:\Users\Priyesh\AppData\Local\Android\Sdk\cmake\3.22.1\bin\ninja.exe with arguments {-C C:\Users\Priyesh\Downloads\DetectFrida-master\app.cxx\Debug\4y238423\armeabi-v7a native-lib} ninja: Entering directory `C:\Users\Priyesh\Downloads\DetectFrida-master\app.cxx\Debug\4y238423\armeabi-v7a' [1/2] Building C object CMakeFiles/native-lib.dir/native-lib.c.o FAILED: CMakeFiles/native-lib.dir/native-lib.c.o C:\Users\Priyesh\Downloads\DetectFrida-master\app\src\main\c..........\o-llvm-binary\ollvm-tll\build\bin_Darwin\clang --target=armv7-none-linux-androideabi19 --sysroot=C:/Users/Priyesh/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot -D_32_BIT -Dnative_lib_EXPORTS -IC:/Users/Priyesh/Downloads/DetectFrida-master/app/src/main/c/arch/armeabi-v7a -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -mllvm -sub -mllvm -bcf -mllvm -fla -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/native-lib.dir/native-lib.c.o -MF CMakeFiles\native-lib.dir\native-lib.c.o.d -o CMakeFiles/native-lib.dir/native-lib.c.o -c C:/Users/Priyesh/Downloads/DetectFrida-master/app/src/main/c/native-lib.c CreateProcess failed: The system cannot find the file specified. ninja: build stopped: subcommand failed.

New Error

darvincisec commented 1 year ago

Hi @erpriyeshpanchal, Obfuscated builds cannot be built on windows machine. Follow the comments in CMakeList file to generate non-obfuscated builds. I used ndk version 20.1.5948944

erpriyeshpanchal commented 1 year ago

@darvincisec Thanks a lot for the help the issue is resolved and able to install the APK in mobile. Can you update the code with the latest ndk version and latest cmake version ? Also can we create a callback from C to Android when Frida is detected ?

darvincisec commented 1 year ago

Sure I will update. If not done in the next 1 week, pls raise a separate issue. I will close this issue for now.