25-3/12/1

This commit is contained in:
Hamza-Ayed
2025-03-12 15:17:51 +03:00
parent df2bbd4604
commit a1dc06015a
29 changed files with 432 additions and 128 deletions

View File

@@ -2,3 +2,9 @@
0 2548 1741692159093118647 CMakeFiles/native-lib.dir/native-lib.cpp.o efdcdef8a37e462e
2552 2768 1741692159310721445 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/arm64-v8a/libnative-lib.so b017f868109e9254
70 986 1741697159421953177 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/arm64-v8a/libnative-lib.so b017f868109e9254
6 1598 1741699635386681829 CMakeFiles/native-lib.dir/native-lib.cpp.o efdcdef8a37e462e
1598 2001 1741699635788197885 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/arm64-v8a/libnative-lib.so b017f868109e9254
7 1167 1741700212142952360 CMakeFiles/native-lib.dir/native-lib.cpp.o efdcdef8a37e462e
1167 1354 1741700212331088034 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/arm64-v8a/libnative-lib.so b017f868109e9254
6 3241 1741775920614434716 CMakeFiles/native-lib.dir/native-lib.cpp.o efdcdef8a37e462e
3241 3938 1741775921311701710 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/arm64-v8a/libnative-lib.so b017f868109e9254

View File

@@ -2,28 +2,28 @@ C/C++ Structured Log{
y
w/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/additional_project_files.txtC
A
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  í¶‰ªØ2  ²ñħØ2x
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  Ó‹ÕÏØ2  ²ñħØ2x
v
t/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/android_gradle_build.json  ò¶‰ªØ2á
t/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/android_gradle_build.json  Ó‹ÕÏØ2á
ÌñħØ2}
{
y/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/android_gradle_build_mini.json  ò¶‰ªØ2£ µòħØ2j
y/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/android_gradle_build_mini.json  Ó‹ÕÏØ2£ µòħØ2j
h
f/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/build.ninja  ò¶‰ªØ2­£ ïħØ2n
f/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/build.ninja  Ó‹ÕÏØ2­£ ïħØ2n
l
j/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/build.ninja.txt  ò¶‰ªØ2s
j/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/build.ninja.txt  Ó‹ÕÏØ2s
q
o/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/build_file_index.txt  ò¶‰ªØ2
o/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/build_file_index.txt  Ó‹ÕÏØ2
X ÎòħØ2t
r
r
p/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/compile_commands.json  ÓÕÏØ2<18> ïħØ2x
v
v
t/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/compile_commands.json.bin  ÓÕÏØ2 º ïħØ2~
|
|
z/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/metadata_generation_command.txt  ÓÕÏØ2
ò ÌòħØ2q
o
o
m/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/prefab_config.json  ÓÕÏØ2
 ( ÌòħØ2v
 ( ÌòħØ2v
t
r/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/symbol_folder_index.txt  ò¶‰ªØ2
r/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/arm64-v8a/symbol_folder_index.txt  Ó‹ÕÏØ2

View File

@@ -2,3 +2,9 @@
1 3827 1741692322937201263 CMakeFiles/native-lib.dir/native-lib.cpp.o ce69c2df0da52668
3831 4442 1741692323587429632 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/armeabi-v7a/libnative-lib.so cc176b2d17fb8da5
20 464 1741697160303802723 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/armeabi-v7a/libnative-lib.so cc176b2d17fb8da5
5 862 1741699636690484903 CMakeFiles/native-lib.dir/native-lib.cpp.o ce69c2df0da52668
863 952 1741699636780820038 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/armeabi-v7a/libnative-lib.so cc176b2d17fb8da5
3 438 1741700212804418842 CMakeFiles/native-lib.dir/native-lib.cpp.o ce69c2df0da52668
438 506 1741700212874457710 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/armeabi-v7a/libnative-lib.so cc176b2d17fb8da5
5 1138 1741775923695796658 CMakeFiles/native-lib.dir/native-lib.cpp.o ce69c2df0da52668
1138 1250 1741775923808240550 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/armeabi-v7a/libnative-lib.so cc176b2d17fb8da5

View File

@@ -2,28 +2,28 @@ C/C++ Structured Log}
{
y/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/additional_project_files.txtC
A
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  …¿‰ªØ2  óçΧØ2z
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  <EFBFBD>ŒÕÏØ2  óçΧØ2z
x
v/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/android_gradle_build.json  Š¿‰ªØ2é
v/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/android_gradle_build.json  <EFBFBD>ŒÕÏØ2é
͏뤯2
}
{/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/android_gradle_build_mini.json  Š¿‰ªØ2« „éΧØ2l
{/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/android_gradle_build_mini.json  <EFBFBD>ŒÕÏØ2« „éΧØ2l
j
h/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/build.ninja  Š¿‰ªØ2÷£ ØáΧØ2p
h/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/build.ninja  <EFBFBD>ŒÕÏØ2÷£ ØáΧØ2p
n
l/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/build.ninja.txt  Š¿‰ªØ2u
l/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/build.ninja.txt  <EFBFBD>ŒÕÏØ2u
s
q/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/build_file_index.txt  Š¿‰ªØ2
q/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/build_file_index.txt  <EFBFBD>ŒÕÏØ2
X éΧØ2v
t
t
r/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/compile_commands.json  <08>ŒÕÏØ2¸ ÖáΧØ2z
x
x
v/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/compile_commands.json.bin  <08>ŒÕÏØ2 ã ÖáΧØ2€
~
~
|/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/metadata_generation_command.txt  <08>ŒÕÏØ2
ü <20>éΧØ2s
q
q
o/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/prefab_config.json  <08>ŒÕÏØ2
 ( éΧØ2x
 ( éΧØ2x
v
t/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/symbol_folder_index.txt  ‹¿‰ªØ2
t/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/armeabi-v7a/symbol_folder_index.txt  <EFBFBD>ŒÕÏØ2

View File

@@ -2,3 +2,9 @@
1 5382 1741692384009485558 CMakeFiles/native-lib.dir/native-lib.cpp.o 5f170629422bfc98
5385 6175 1741692384809866423 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/x86/libnative-lib.so a0af4ac7f4c5ad9e
34 489 1741697160909172629 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/x86/libnative-lib.so a0af4ac7f4c5ad9e
6 479 1741699637287981749 CMakeFiles/native-lib.dir/native-lib.cpp.o 5f170629422bfc98
479 547 1741699637357134787 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/x86/libnative-lib.so a0af4ac7f4c5ad9e
3 429 1741700213326767093 CMakeFiles/native-lib.dir/native-lib.cpp.o 5f170629422bfc98
429 495 1741700213392850715 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/x86/libnative-lib.so a0af4ac7f4c5ad9e
5 616 1741775926465532997 CMakeFiles/native-lib.dir/native-lib.cpp.o 5f170629422bfc98
616 766 1741775926617612714 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/x86/libnative-lib.so a0af4ac7f4c5ad9e

View File

@@ -2,28 +2,28 @@ C/C++ Structured Logu
s
q/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/additional_project_files.txtC
A
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ËÀ‰ªØ2  á¬Ï§Ø2r
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ¸ŒÕÏØ2  á¬Ï§Ø2r
p
n/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/android_gradle_build.json  ËÀ‰ªØ2É
n/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/android_gradle_build.json  ¸ŒÕÏØ2É
­Ï§Ø2w
u
s/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/android_gradle_build_mini.json  ËÀ‰ªØ2 «­Ï§Ø2d
s/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/android_gradle_build_mini.json  ¸ŒÕÏØ2 «­Ï§Ø2d
b
`/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/build.ninja  ËÀ‰ªØ2ñ¢ ޫϧØ2h
`/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/build.ninja  ¸ŒÕÏØ2ñ¢ ޫϧØ2h
f
d/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/build.ninja.txt  ËÀ‰ªØ2m
d/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/build.ninja.txt  ¸ŒÕÏØ2m
k
i/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/build_file_index.txt  ËÀ‰ªØ2
i/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/build_file_index.txt  ¸ŒÕÏØ2
X ¯­Ï§Ø2n
l
l
j/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/compile_commands.json  ¸ŒÕÏØ2£ ޫϧØ2r
p
p
n/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/compile_commands.json.bin  ¸ŒÕÏØ2 Ç ޫϧØ2x
v
v
t/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/metadata_generation_command.txt  ¸ŒÕÏØ2
Ô ¯­Ï§Ø2k
i
i
g/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/prefab_config.json  ¸ŒÕÏØ2
 ( ¯­Ï§Ø2p
 ( ¯­Ï§Ø2p
n
l/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/symbol_folder_index.txt  ËÀ‰ªØ2
l/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86/symbol_folder_index.txt  ¸ŒÕÏØ2

View File

@@ -2,3 +2,9 @@
0 2001 1741692390230368349 CMakeFiles/native-lib.dir/native-lib.cpp.o 928bd220d18fa07b
2004 2120 1741692390355514735 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/x86_64/libnative-lib.so 8509cac8b5517111
24 297 1741697161349852193 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/x86_64/libnative-lib.so 8509cac8b5517111
6 435 1741699637813176160 CMakeFiles/native-lib.dir/native-lib.cpp.o 928bd220d18fa07b
435 502 1741699637880327268 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/x86_64/libnative-lib.so 8509cac8b5517111
3 430 1741700213841652636 CMakeFiles/native-lib.dir/native-lib.cpp.o 928bd220d18fa07b
430 496 1741700213908704508 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/x86_64/libnative-lib.so 8509cac8b5517111
3 430 1741775927074643204 CMakeFiles/native-lib.dir/native-lib.cpp.o 928bd220d18fa07b
430 585 1741775927230967137 /Users/hamzaaleghwairyeen/development/App/ride 2/build/app/intermediates/cxx/Debug/2c6m2v30/obj/x86_64/libnative-lib.so 8509cac8b5517111

View File

@@ -2,28 +2,28 @@ C/C++ Structured Logx
v
t/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/additional_project_files.txtC
A
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ÎÁ‰ªØ2  µ€Ó§Ø2u
?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ÛŒÕÏØ2  µ€Ó§Ø2u
s
q/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/android_gradle_build.json  ÎÁ‰ªØ2Õ
q/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/android_gradle_build.json  ÛŒÕÏØ2Õ
ô…Ó§Ø2z
x
v/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/android_gradle_build_mini.json  ÎÁ‰ªØ2 ‰†Ó§Ø2g
v/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/android_gradle_build_mini.json  ÛŒÕÏØ2 ‰†Ó§Ø2g
e
c/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/build.ninja  ÎÁ‰ªØ2<18>£ °ÿÒ§Ø2k
c/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/build.ninja  ÛŒÕÏØ2<18>£ °ÿÒ§Ø2k
i
g/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/build.ninja.txt  ÎÁ‰ªØ2p
g/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/build.ninja.txt  ÛŒÕÏØ2p
n
l/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/build_file_index.txt  ÎÁ‰ªØ2
l/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/build_file_index.txt  ÛŒÕÏØ2
X <20>†Ó§Ø2q
o
o
m/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/compile_commands.json  ÛŒÕÏØ2 °ÿÒ§Ø2u
s
s
q/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/compile_commands.json.bin  ÛŒÕÏØ2  °ÿÒ§Ø2{
y
y
w/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/metadata_generation_command.txt  ÛŒÕÏØ2
ã Œ†Ó§Ø2n
l
l
j/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/prefab_config.json  ÛŒÕÏØ2
 ( Π2s
 ( Π2s
q
o/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/symbol_folder_index.txt  ÎÁ‰ªØ2
o/Users/hamzaaleghwairyeen/development/App/ride 2/android/app/.cxx/Debug/2c6m2v30/x86_64/symbol_folder_index.txt  ÛŒÕÏØ2

View File

@@ -1,10 +1,27 @@
#include <jni.h>
#include <string>
#include <fstream>
#include <unistd.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <android/log.h>
#include <pthread.h>
#include <dlfcn.h>
#include <link.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ptrace.h> // Add this line
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_mobileapp_store_ride_RootDetection_isNativeRooted(JNIEnv *env, jobject /* this */) {
#define LOG_TAG "NativeLib"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
// Function to check for common root binaries
bool isRooted() {
std::string paths[] = {
"/system/app/Superuser.apk",
"/system/xbin/su",
@@ -17,9 +34,133 @@ Java_com_mobileapp_store_ride_RootDetection_isNativeRooted(JNIEnv *env, jobject
for (const auto &path : paths) {
std::ifstream file(path);
if (file.good()) {
return JNI_TRUE;
return true;
}
}
return false;
}
// Function to check for the presence of files or directories commonly associated with Frida.
bool checkFridaFiles() {
std::string fridaFiles[] = {
"/data/local/tmp/re.frida.server", //Common Frida server path
"/data/local/tmp/frida-server",
"/usr/lib/libfrida-gadget.so", // Frida gadget (injected library)
"/usr/lib64/libfrida-gadget.so",
"/data/local/re.frida.server",
};
for (const auto &path : fridaFiles) {
if (access(path.c_str(), F_OK) != -1) {
LOGE("Frida file detected: %s", path.c_str());
return true;
}
}
return false;
}
// Checks for open ports commonly used by Frida. This is less reliable, as ports can be changed.
bool checkFridaPorts() {
int sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == -1) {
return false; // Couldn't create socket, not a strong indicator.
}
sockaddr_in sa;
memset(&sa, 0, sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_port = htons(27042); // Default Frida port
inet_pton(AF_INET, "127.0.0.1", &sa.sin_addr);
if (connect(sock, (struct sockaddr *)&sa, sizeof(sa)) != -1) {
LOGE("Frida default port (27042) is open.");
close(sock);
return true;
}
close(sock);
return false;
}
// Check the maps file of the current process for any suspicious entries.
bool checkMaps() {
std::ifstream mapsFile("/proc/self/maps");
std::string line;
if (mapsFile.is_open()) {
while (std::getline(mapsFile, line)) {
// Look for lines that indicate injected libraries, especially Frida.
if (line.find("frida") != std::string::npos ||
line.find("gum-js-") != std::string::npos) { // Gum is Frida's JavaScript engine
LOGE("Suspicious entry in /proc/self/maps: %s", line.c_str());
return true;
}
}
mapsFile.close();
} else
{
LOGE("Could not open /proc/self/maps");
return false;
}
return false;
}
// Check loaded modules.
bool checkLoadedModules() {
bool found = false;
dl_iterate_phdr([](struct dl_phdr_info *info, size_t size, void *data) {
bool *found_ptr = static_cast<bool *>(data);
if (std::string(info->dlpi_name).find("frida") != std::string::npos) {
LOGE("Frida module detected: %s", info->dlpi_name);
*found_ptr = true;
return 1; // Stop iterating
}
return 0; // Continue iterating
}, &found);
return found;
}
// This is a simple ptrace check. More sophisticated checks are possible (and necessary for robust detection).
//bool checkPtrace() {
// // Attempt to ptrace ourselves. If another process is already tracing us, this will fail.
// if (ptrace(PTRACE_TRACEME, 0, 1, 0) < 0) {
// LOGE("ptrace failed. Debugger or tracer detected.");
// return true; // Likely being traced
// }
// // Detach. If attached, need to detach to not interfere.
// ptrace(PTRACE_DETACH, 0, 0, 0);
// return false;
//}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_mobileapp_store_ride_RootDetection_isNativeRooted(JNIEnv *env, jobject /* this */) {
if (isRooted()) {
return JNI_TRUE;
}
if (checkFridaFiles()) {
return JNI_TRUE;
}
if (checkFridaPorts()) {
return JNI_TRUE;
}
if (checkMaps()) {
return JNI_TRUE;
}
if (checkLoadedModules()) {
return JNI_TRUE;
}
// if (checkPtrace()) {
// return JNI_TRUE;
// }
return JNI_FALSE;
}

View File

@@ -12,53 +12,96 @@ import io.flutter.embedding.android.FlutterFragmentActivity
import java.io.File
import java.util.Timer
import kotlin.concurrent.schedule
import io.flutter.embedding.engine.FlutterEngine // Import FlutterEngine
import io.flutter.plugin.common.MethodChannel // Import MethodChannel
import io.flutter.plugin.common.MethodCall // Import MethodCall
import io.flutter.plugin.common.MethodChannel.Result // Import Result
class MainActivity : FlutterFragmentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Log.d("DEBUG", "onCreate executed - Checking root status...")
native()
performSecurityChecks()
checkSafetyNet() // Keep this commented out if you don't need it
}
private lateinit var channel: MethodChannel // Declare a MethodChannel variable
private fun native() {
// Log.d("DEBUG", "Starting native root detection...")
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
try {
val isNativeRooted = RootDetection.isNativeRooted()
if (isNativeRooted) {
showSecurityWarningDialog()
// Initialize the MethodChannel
channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "com.mobileapp.store.ride/security")
// Set a MethodCallHandler to handle method calls from Flutter
channel.setMethodCallHandler { call, result ->
when (call.method) {
"isNativeRooted" -> {
val isCompromised = isDeviceCompromised()
result.success(isCompromised) // Send the result back to Flutter
}
else -> {
result.notImplemented() // Handle unknown method calls
}
}
} catch (e: Exception) {
// Log.e("DEBUG", "Error in native root detection: ${e.message}", e)
}
}
private fun performSecurityChecks() {
val rootBeer = RootBeer(this)
val isRooted = rootBeer.isRooted
if (isRooted) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Perform all checks. The order can matter; you might want to prioritize
// the faster checks first.
if (isDeviceCompromised()) {
showSecurityWarningDialog()
}
}
private fun checkSafetyNet() {
// Log.d("DEBUG", "Starting SafetyNet check...")
SafetyNetCheck.checkSafetyNet(this, getString(R.string.api_key_safety)) { isSafe ->
// Log.d("DEBUG", "SafetyNet check result: $isSafe")
if (!isSafe) {
// Log.d("DEBUG", "Device failed SafetyNet check")
showSecurityWarningDialog()
} else {
// Log.d("DEBUG", "Device passed SafetyNet check")
}
private fun isDeviceCompromised(): Boolean {
return try {
nativeRootCheck() || rootBeerCheck() //|| !safetyNetCheck()
} catch (e: Exception) {
Log.e("DEBUG", "Error during security checks: ${e.message}", e)
true // Consider the device compromised on error
}
}
private fun nativeRootCheck(): Boolean {
Log.d("DEBUG", "Starting native root detection...")
return try {
val isNativeRooted = RootDetection.isNativeRooted()
Log.d("DEBUG", "Native root detection result: $isNativeRooted")
isNativeRooted
} catch (e: Exception) {
Log.e("DEBUG", "Error in native root detection: ${e.message}", e)
true // Consider rooted on exception
}
}
private fun rootBeerCheck(): Boolean {
Log.d("DEBUG", "Starting RootBeer root detection...")
val rootBeer = RootBeer(this)
val isRooted = rootBeer.isRooted
Log.d("DEBUG", "RootBeer detection result: $isRooted")
return isRooted
}
private fun safetyNetCheck(): Boolean {
Log.d("DEBUG", "Starting SafetyNet check...")
var isSafe = false // Initialize a variable to store result
val semaphore = java.util.concurrent.Semaphore(0) // Create a semaphore
SafetyNetCheck.checkSafetyNet(this, getString(R.string.api_key_safety)) { result ->
isSafe = result
Log.d("DEBUG", "SafetyNet check result: $isSafe")
semaphore.release() // Release the semaphore when the callback is executed
}
try {
semaphore.acquire() // Wait for the callback to complete
} catch (e: InterruptedException) {
Log.e("DEBUG", "Interrupted while waiting for SafetyNet check", e)
return false // Or handle as appropriate for your app
}
return isSafe
}
private fun showSecurityWarningDialog() {
var secondsRemaining = 10 // Start at 10 seconds
@@ -77,13 +120,13 @@ class MainActivity : FlutterFragmentActivity() {
layout.addView(progressBar)
val dialog =
AlertDialog.Builder(this)
.setTitle(getString(R.string.security_warning_title)) // Your title
.setView(layout) // Set the custom layout
.setCancelable(
false
) // Prevent dismissing by tapping outside or back button
.create()
AlertDialog.Builder(this)
.setTitle(getString(R.string.security_warning_title)) // Your title
.setView(layout) // Set the custom layout
.setCancelable(
false
) // Prevent dismissing by tapping outside or back button
.create()
dialog.show()
@@ -93,7 +136,7 @@ class MainActivity : FlutterFragmentActivity() {
secondsRemaining--
runOnUiThread { // Update UI on the main thread
progressBar.progress =
secondsRemaining // Set the progress bar to show remaining seconds
secondsRemaining // Set the progress bar to show remaining seconds
if (secondsRemaining <= 0) {
timer.cancel() // Stop the timer
dialog.dismiss() // Dismiss the dialog
@@ -157,4 +200,4 @@ class MainActivity : FlutterFragmentActivity() {
}
return dir?.delete() ?: false
}
}
}