⚡Megatron LLM Hub
←Back to search
Website

Hi im trying to bypass MonopolyGo im trying to play it on Vphone OS, i tried something like this : But i keep fail Anyone could help? or...

Hi im trying to bypass MonopolyGo im trying to play it on Vphone OS, i tried something like this : But i keep fail Anyone could help? or give me some advice Thankyou <3 Code: #include <jni.h> #include <android/log.h> #include <pthread.h> #include <unistd.h> #include <dlfcn.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <stdarg.h> #include <stdint.h> #include <stdbool.h> #include <signal.h> #include <ucontext.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/mman.h> #include <fcntl.h> #include <dirent.h> #include <errno.h> #include <netdb.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include "shadowhook.h" #include "xdl.h" // ==== FLAGS ==== #define ENABLE_SIGNAL_HANDLER 1 #define ENABLE_JNI_BUILD_SPOOF 1 #define ENABLE_MSAA_FIX 1 #define ENABLE_INTEGRITY_GETTERS 1 #define ENABLE_INTEGRITY_REPORT 1 #define ENABLE_ON_ISEMU_LISTENER 1 #define ENABLE_AUTH_HOOKS 1 // ==== NAMESPACE (dari dump.cs) ==== #define NS_EMU_DETECTOR "Playgami.Core.NativeInfo" #define NS_INTEGRITY "WithBuddies.Client.Integrity" #define NS_INTEGRITY_RESP "WithBuddies.Common" #define NS_AUTH "Tophat.Client.WithBuddies.Auth" #define NS_ISEMU_PROVIDER "Playgami.Core.Providers.Android" #define NS_ON_ISEMU_LISTENER "Playgami.Core.Providers.Native.Android" #define LOG_PATH "/data/local/tmp/env_spoof.log" static int g_sdk_int = 0 ; static int g_is_android7 = 0 ; static int g_is_virtual_master = 0 ; static void log_to_file ( const char * fmt , ...) { char b [ 1024 ]; va_list a ; va_start ( a , fmt ); vsnprintf ( b , sizeof ( b ), fmt , a ); va_end ( a ); __android_log_print ( ANDROID_LOG_DEBUG , "MonopolyBypass" , "%s" , b ); int fd = open ( LOG_PATH , O_WRONLY | O_CREAT | O_APPEND , 0666 ); if ( fd >= 0 ) { write ( fd , b , strlen ( b )); write ( fd , "\n" , 1 ); close ( fd ); } typedef int (* __system_property_get_t )( const char *, char *); static __system_property_get_t orig___system_property_get = NULL ; static void detect_environment ( void ) { char buf [ 92 ] = { 0 }; if ( orig___system_property_get ) orig___system_property_get ( "ro.build.version.sdk" , buf ); g_sdk_int = atoi ( buf ); g_is_android7 = ( g_sdk_int == 24 || g_sdk_int == 25 ); memset ( buf , 0 , sizeof ( buf )); if ( orig___system_property_get ) orig___system_property_get ( "ro.build.flavor" , buf ); if ( strstr ( buf , "vphone" ) || strstr ( buf , "titan" ) || strstr ( buf , "VirtualMaster" )) g_is_virtual_master = 1 ; log_to_file ( "[DETECT] SDK=%d android7=%d vphone=%d" , g_sdk_int , g_is_android7 , g_is_virtual_master ); } // ==== PROPERTY SPOOF ==== static int my___system_property_get ( const char * name , char * value ) { if ( strncmp ( name , "qemu." , 5 ) == 0 || strstr ( name , "ro.kernel.qemu" )) { value [ 0 ]= '\0' ; return 0 ; } if (! strcmp ( name , "ro.build.version.sdk" )) { sprintf ( value , "%d" , g_sdk_int ? g_sdk_int : 24 ); return strlen ( value ); } if (! strcmp ( name , "ro.build.version.release" )) { strcpy ( value , g_is_android7 ? "7.0" : "11" ); return strlen ( value ); } if (! strcmp ( name , "ro.product.model" )) { strcpy ( value , g_is_android7 ? "SM-G955F" : "SM-G998B" ); return strlen ( value ); } if (! strcmp ( name , "ro.product.brand" )) { strcpy ( value , "samsung" ); return 7 ; } if (! strcmp ( name , "ro.product.manufacturer" )) { strcpy ( value , "samsung" ); return 7 ; } if (! strcmp ( name , "ro.hardware" )) { strcpy ( value , g_sdk_int < 28 ? "exynos8895" : "exynos2100" ); return strlen ( value ); } if (! strcmp ( name , "ro.boot.hardware" )) { strcpy ( value , g_sdk_int < 28 ? "exynos8895" : "exynos2100" ); return strlen ( value ); } if (! strcmp ( name , "ro.build.tags" )) { strcpy ( value , "release-keys" ); return 12 ; } if (! strcmp ( name , "ro.build.type" )) { strcpy ( value , "user" ); return 4 ; } if (! strcmp ( name , "ro.debuggable" )) { strcpy ( value , "0" ); return 1 ; } if (! strcmp ( name , "ro.secure" )) { strcpy ( value , "1" ); return 1 ; } if (! strcmp ( name , "ro.product.cpu.abilist" )) { strcpy ( value , "arm64-v8a,armeabi-v7a,armeabi" ); return strlen ( value ); } if (! strcmp ( name , "ro.product.cpu.abilist64" )) { strcpy ( value , "arm64-v8a" ); return 10 ; } if (! strcmp ( name , "ro.product.cpu.abilist32" )) { strcpy ( value , "armeabi-v7a,armeabi" ); return 19 ; } if (! strcmp ( name , "ro.product.cpu.abi" )) { strcpy ( value , "arm64-v8a" ); return 10 ; } return orig___system_property_get ( name , value ); } // ==== LIBC HOOKS ==== typedef FILE * (* fopen_t )( const char *, const char *); static fopen_t orig_fopen = NULL , orig_fopen64 = NULL ; typedef int (* access_t )( const char *, int ); static access_t orig_access = NULL ; typedef int (* open_t )( const char *, int , ...); static open_t orig_open = NULL ; typedef int (* openat_t )( int , const char *, int , ...); static openat_t orig_openat = NULL ; typedef int (* stat_t )( const char *, struct stat *); static stat_t orig_stat = NULL , orig_lstat = NULL ; typedef DIR * (* opendir_t )( const char *); static opendir_t orig_opendir = NULL ; typedef struct dirent * (* readdir_t )( DIR *); static readdir_t orig_readdir = NULL ; typedef int (* execve_t )( const char *, char * const [], char * const []); static execve_t orig_execve = NULL ; typedef void * (* eglGetProcAddress_t )( const char *); static eglGetProcAddress_t orig_eglGetProcAddress = NULL ; typedef const uint8_t * (* glGetString_t )( uint32_t ); static glGetString_t orig_glGetString = NULL ; static const char * get_persona_cpu_part ( void ) { if ( g_sdk_int < 28 ) return "0xd03" ; if ( g_sdk_int < 30 ) return "0xd40" ; if ( g_sdk_int < 33 ) return "0xd44" ; return "0x001" ; } static const char * get_persona_hw ( void ) { if ( g_sdk_int < 28 ) return "Hardware\t: Samsung Exynos8895\n" ; if ( g_sdk_int < 30 ) return "Hardware\t: Samsung Exynos9820\n" ; if ( g_sdk_int < 33 ) return "Hardware\t: Samsung Exynos2100\n" ; return "Hardware\t: Qualcomm SM8550\n" ; } static const char * get_persona_kernel ( void ) { if ( g_sdk_int < 28 ) return "Linux version 4.4.111-14315810-abNU61 (build-user@build-host) (Android (4691093) clang version 6.0.2) #1 SMP PREEMPT Thu Nov 22 12:00:00 UTC 2018\n" ; if ( g_sdk_int < 30 ) return "Linux version 4.14.113-22104117 (build-user@build-host) #1 SMP PREEMPT Mon Jun 15 12:00:00 UTC 2020\n" ; if ( g_sdk_int < 33 ) return "Linux version 5.4.129-android12-9 (build-user@build-host) #1 SMP PREEMPT Thu Mar 10 12:00:00 UTC 2022\n" ; return "Linux version 5.15.78-android13-8 (build-user@build-host) #1 SMP PREEMPT Thu Sep 28 12:00:00 UTC 2023\n" ; } typedef struct { char * buf ; size_t len ; size_t pos ; } maps_cookie_t ; static int maps_cookie_read ( void * c , char * b , int s ) { maps_cookie_t * k = ( maps_cookie_t *) c ; size_t av = k -> len - k -> pos , n = ( size_t ) s < av ? ( size_t ) s : av ; if (! n ) return 0 ; memcpy ( b , k -> buf + k -> pos , n ); k -> pos += n ; return ( int ) n ; } static int maps_cookie_close ( void * c ) { maps_cookie_t * k =( maps_cookie_t *) c ; free ( k -> buf ); free ( k ); return 0 ; } static FILE * my_fopen_common ( const char * path , const char * mode , fopen_t orig ) { if ( path && strstr ( path , "/proc/cpuinfo" )) { char f [ 1024 ]; snprintf ( f , sizeof ( f ), "processor\t: 0\nBogoMIPS\t: 38.40\nFeatures\t: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp\nCPU implementer\t: 0x41\nCPU architecture: 8\nCPU variant\t: 0x1\nCPU part\t: %s\nCPU revision\t: 1\n%s" , get_persona_cpu_part (), get_persona_hw ()); return fmemopen ( strdup ( f ), strlen ( f ), "r" ); } if ( path && strstr ( path , "/proc/version" )) { const char * f = get_persona_kernel (); return fmemopen (( void *) f , strlen ( f ), "r" ); } if ( path && strstr ( path , "/proc/self/maps" )) { FILE * o = orig ( path , mode ); if (! o ) return NULL ; char * b = NULL ; size_t sz = 0 ; FILE * out = open_memstream (& b , & sz ); if (! out ) { fclose ( o ); return NULL ; } char l [ 1024 ]; while ( fgets ( l , sizeof ( l ), o )) { if ( strstr ( l , "libenv_spoof" )|| strstr ( l , "libshadowhook" )|| strstr ( l , "libmys_payload" )|| strstr ( l , "mys_injector" )|| strstr ( l , "libbgo_mod" )|| strstr ( l , "libdobby" )|| strstr ( l , "libbgo_64" )|| strstr ( l , "libbgo_32" )|| strstr ( l , "vphone" )|| strstr ( l , "titan" )) continue ; fputs ( l , out ); } fclose ( o ); fclose ( out ); maps_cookie_t * ctx = ( maps_cookie_t *) calloc ( 1 , sizeof ( maps_cookie_t )); if (! ctx ) { free ( b ); return NULL ; } ctx -> buf = b ; ctx -> len = sz ; return funopen ( ctx , maps_cookie_read , NULL , NULL , maps_cookie_close ); } return orig ( path , mode ); } static FILE * my_fopen ( const char * p , const char * m ) { return my_fopen_common ( p , m , orig_fopen ); } static FILE * my_fopen64 ( const char * p , const char * m ) { return my_fopen_common ( p , m , orig_fopen64 ? orig_fopen64 : orig_fopen ); } static bool is_hidden_path ( const char * p ) { if (! p ) return false ; static const char * N [] = { "libenv_spoof" , "libmys_payload" , "mys_injector" , "libshadowhook" , "libxdl" , "libdobby" , "libbgo_mod" , "com.vphonegaga" , "vphonegaga.titan" , "/goldfish_sync" , "/qemu_pipe" , "/system/bin/su" , "/system/xbin/su" , "/sbin/su" , "/system/xbin/daemonsu" , "/system/app/Superuser.apk" , "/system/app/SuperSU.apk" , "/data/adb/magisk" , "/sbin/.magisk" , "frida-server" , "frida-helper" , NULL }; for ( int i = 0 ; N [ i ]; i ++) if ( strstr ( p , N [ i ])) return true ; return false ; } static int my_access ( const char * p , int m ) { if ( is_hidden_path ( p )) { errno = ENOENT ; return - 1 ; } return orig_access ( p , m ); } static int my_open ( const char * p , int f , ...) { if ( is_hidden_path ( p )) { errno = ENOENT ; return - 1 ; } va_list ap ; va_start ( ap , f ); mode_t m = ( f & O_CREAT ) ? ( mode_t ) va_arg ( ap , int ) : 0 ; va_end ( ap ); return orig_open ( p , f , m ); } static int my_openat ( int d , const char * p , int f , ...) { if ( is_hidden_path ( p )) { errno = ENOENT ; return - 1 ; } va_list ap ; va_start ( ap , f ); mode_t m = ( f & O_CREAT ) ? ( mode_t ) va_arg ( ap , int ) : 0 ; va_end ( ap ); return orig_openat ( d , p , f , m ); } static int my_stat ( const char * p , struct stat * b ) { if ( is_hidden_path ( p )) { errno = ENOENT ; return - 1 ; } return orig_stat ( p , b ); } static int my_lstat ( const char * p , struct stat * b ) { if ( is_hidden_path ( p )) { errno = ENOENT ; return - 1 ; } return orig_lstat ( p , b ); } static DIR * my_opendir ( const char * n ) { if ( is_hidden_path ( n )) { errno = ENOENT ; return NULL ; } return orig_opendir ( n ); } static struct dirent * my_readdir ( DIR * d ) { struct dirent * e ; while (( e = orig_readdir ( d ))) { if ( is_hidden_path ( e -> d_name )) continue ; if (! strcmp ( e -> d_name , "su" )||! strcmp ( e -> d_name , "magisk" )||! strcmp ( e -> d_name , "frida-server" )) continue ; return e ; } return NULL ; } static int my_execve ( const char * fn , char * const a [], char * const e []) { if ( is_hidden_path ( fn )) { errno = ENOENT ; return - 1 ; } return orig_execve ( fn , a , e ); } const uint8_t * my_glGetString ( uint32_t n ) { if ( n == 0x1F00 ) return ( const uint8_t *) "ARM" ; if ( n == 0x1F01 ) return ( const uint8_t *) "Mali-G71" ; if ( n == 0x1F02 ) return ( const uint8_t *) "OpenGL ES 3.2 v1.r14p0" ; return orig_glGetString ? orig_glGetString ( n ) : NULL ; } void * my_eglGetProcAddress ( const char * p ) { return orig_eglGetProcAddress ? orig_eglGetProcAddress ( p ) : NULL ; } // ==== SIGNAL HANDLER ==== #if ENABLE_SIGNAL_HANDLER static struct sigaction g_old_sa [ 5 ]; static int g_old_sig [ 5 ]; static int g_old_n = 0 ; static void my_sig ( int sig , siginfo_t * info , void * uc ) { #if defined(__aarch64__) ucontext_t * u = ( ucontext_t *) uc ; if ( sig == SIGBUS ) { log_to_file ( "[SIG] SIGBUS skip @ pc=%p" , ( void *) u -> uc_mcontext . pc ); u -> uc_mcontext . pc += 4 ; return ; } #endif for ( int i = 0 ; i < g_old_n ; i ++) { if ( g_old_sig [ i ] == sig ) { if ( g_old_sa [ i ]. sa_flags & SA_SIGINFO ) { if ( g_old_sa [ i ]. sa_sigaction ) g_old_sa [ i ]. sa_sigaction ( sig , info , uc ); } else if ( g_old_sa [ i ]. sa_handler != SIG_DFL && g_old_sa [ i ]. sa_handler != SIG_IGN ) g_old_sa [ i ]. sa_handler ( sig ); return ; } signal ( sig , SIG_DFL ); raise ( sig ); } static void install_sig ( void ) { static char alt [ SIGSTKSZ * 4 ]; stack_t ss = { 0 }; ss . ss_sp = alt ; ss . ss_size = sizeof ( alt ); sigaltstack (& ss , NULL ); struct sigaction sa = { 0 }; sa . sa_sigaction = my_sig ; sa . sa_flags = SA_SIGINFO | SA_ONSTACK ; sigemptyset (& sa . sa_mask ); int s [] = { SIGSEGV , SIGBUS , SIGABRT , SIGILL , SIGFPE }; g_old_n = 0 ; for ( int i = 0 ; i < 5 ; i ++) if ( sigaction ( s [ i ], & sa , & g_old_sa [ g_old_n ]) == 0 ) g_old_sig [ g_old_n ++] = s [ i ]; log_to_file ( "[SIG] handlers installed (%d)" , g_old_n ); } #endif // ==== JNI BUILD SPOOF ==== typedef jint (* JNI_GetCreatedJavaVMs_t )( JavaVM **, jsize , jsize *); static JavaVM * get_vm ( void ) { static JNI_GetCreatedJavaVMs_t p = NULL ; if (! p ) p = ( JNI_GetCreatedJavaVMs_t ) dlsym ( RTLD_DEFAULT , "JNI_GetCreatedJavaVMs" ); if (! p ) return NULL ; JavaVM * vm = NULL ; jsize n = 0 ; p (& vm , 1 , & n ); return n > 0 ? vm : NULL ; } #if ENABLE_JNI_BUILD_SPOOF static void spoof_build ( JNIEnv * env ) { if (! env ) return ; #define SS ( cls , f , v ) do { jclass c = env -> FindClass ( cls ); if ( c ){ jfieldID x = env -> GetStaticFieldID ( c , f , "Ljava/lang/String;" ); if ( x ){ env -> SetStaticObjectField ( c , x , env -> NewStringUTF ( v )); log_to_file ( "[JNI] %s.%s = %s" , cls , f , v ); } env -> DeleteLocalRef ( c ); } while ( 0 ) const char * model = g_is_android7 ? "SM-G955F" : "SM-G998B" ; const char * fp = g_is_android7 ? "samsung/dream2ltexx/dream2lte:7.0/NRD90M/G955FXXU1AQF7:user/release-keys" : "samsung/o1sks/o1s:11/RP1A.200720.012/G998BXXU3AUE1:user/release-keys" ; SS ( "android/os/Build" , "MODEL" , model ); SS ( "android/os/Build" , "MANUFACTURER" , "samsung" ); SS ( "android/os/Build" , "BRAND" , "samsung" ); SS ( "android/os/Build" , "DEVICE" , g_is_android7 ? "dream2lte" : "o1s" ); SS ( "android/os/Build" , "PRODUCT" , g_is_android7 ? "dream2ltexx" : "o1sks" ); SS ( "android/os/Build" , "HARDWARE" , g_is_android7 ? "exynos8895" : "exynos2100" ); SS ( "android/os/Build" , "BOARD" , g_is_android7 ? "universal8895" : "exynos2100" ); SS ( "android/os/Build" , "FINGERPRINT" , fp ); SS ( "android/os/Build" , "DISPLAY" , g_is_android7 ? "NRD90M.G955FXXU1AQF7" : "RP1A.200720.012.G998BXXU3AUE1" ); SS ( "android/os/Build" , "BOOTLOADER" , g_is_android7 ? "G955FXXU1AQF7" : "G998BXXU3AUE1" ); SS ( "android/os/Build" , "SERIAL" , "0000000000000000" ); SS ( "android/os/Build$VERSION" , "RELEASE" , g_is_android7 ? "7.0" : "11" ); SS ( "android/os/Build$VERSION" , "CODENAME" , "REL" ); SS ( "android/os/Build$VERSION" , "SECURITY_PATCH" , g_is_android7 ? "2017-06-01" : "2021-09-01" ); jclass vc = env -> FindClass ( "android/os/Build$VERSION" ); if ( vc ) { jfieldID f = env -> GetStaticFieldID ( vc , "SDK_INT" , "I" ); if ( f ) env -> SetStaticIntField ( vc , f , g_sdk_int ? g_sdk_int : 24 ); env -> DeleteLocalRef ( vc ); } #undef SS } #endif // ==== IL2CPP API ==== typedef struct { void * (* domain_get )( void ); void * (* thread_attach )( void *); void * (* get_corlib )( void ); void * (* class_from_name )( void *, const char *, const char *); const void * (* class_get_method_from_name )( void *, const char *, int ); void * (* domain_get_assemblies )( void *, size_t *); void * (* assembly_get_image )( void *); uint32_t (* method_get_flags )( const void *, uint32_t *); const char * (* image_get_name )( void *); } Il2CppAPI ; static Il2CppAPI g_il2cpp = { 0 }; static void * g_xdl = NULL ; #define M_STATIC 0x0010 static void * r_sym ( const char * n ) { if (! g_xdl ) return NULL ; void * a = xdl_sym ( g_xdl , n , NULL ); if (! a ) a = xdl_dsym ( g_xdl , n , NULL ); return a ; } static int init_il2cpp ( void ) { g_il2cpp . domain_get = ( void *(*)( void )) r_sym ( "il2cpp_domain_get" ); g_il2cpp . thread_attach = ( void *(*)( void *)) r_sym ( "il2cpp_thread_attach" ); g_il2cpp . get_corlib = ( void *(*)( void )) r_sym ( "il2cpp_get_corlib" ); g_il2cpp . class_from_name = ( void *(*)( void *, const char *, const char *)) r_sym ( "il2cpp_class_from_name" ); g_il2cpp . class_get_method_from_name = ( const void *(*)( void *, const char *, int )) r_sym ( "il2cpp_class_get_method_from_name" ); g_il2cpp . domain_get_assemblies = ( void *(*)( void *, size_t *)) r_sym ( "il2cpp_domain_get_assemblies" ); g_il2cpp . assembly_get_image = ( void *(*)( void *)) r_sym ( "il2cpp_assembly_get_image" ); g_il2cpp . method_get_flags = ( uint32_t (*)( const void *, uint32_t *)) r_sym ( "il2cpp_method_get_flags" ); g_il2cpp . image_get_name = ( const char *(*)( void *)) r_sym ( "il2cpp_image_get_name" ); return g_il2cpp . domain_get && g_il2cpp . thread_attach && g_il2cpp . class_from_name && g_il2cpp . class_get_method_from_name && g_il2cpp . domain_get_assemblies && g_il2cpp . assembly_get_image ; } // Exact namespace lookup (no retry, no tebak) static void * find_class_exact ( const char * ns , const char * name ) { if (! g_il2cpp . domain_get ) return NULL ; void * d = g_il2cpp . domain_get (); if (! d ) return NULL ; size_t c = 0 ; void ** a = ( void **) g_il2cpp . domain_get_assemblies ( d , & c ); if (! a ) return NULL ; for ( size_t i = 0 ; i < c ; i ++) { void * img = g_il2cpp . assembly_get_image ( a [ i ]); if (! img ) continue ; void * k = g_il2cpp . class_from_name ( img , ns , name ); if ( k ) return k ; } return NULL ; } // Resolve method, return {ptr, is_static}. No retry - namespace exact. static void * get_method ( const char * ns , const char * cls , const char * m , int argc , int * is_st ) { void * k = find_class_exact ( ns , cls ); if (! k ) { log_to_file ( "[-] %s.%s NOT FOUND" , ns , cls ); return NULL ; } const void * meth = g_il2cpp . class_get_method_from_name ( k , m , argc ); if (! meth ) { log_to_file ( "[-] %s.%s::%s/%d NOT FOUND" , ns , cls , m , argc ); return NULL ; } uint32_t il = 0 ; uint32_t fl = g_il2cpp . method_get_flags ? g_il2cpp . method_get_flags ( meth , & il ) : 0 ; if ( is_st ) * is_st = ( fl & M_STATIC ) ? 1 : 0 ; void * ptr = *( void **) meth ; log_to_file ( "[+] %s.%s::%s/%d ptr=%p static=%d" , ns , cls , m , argc , ptr , ( fl & M_STATIC ) ? 1 : 0 ); return ptr ; } // ==== HOOKS ==== // SINK 1: NotifyAndroidEmulatorResult(bool) - void, 1 arg typedef void (* NotifyEmu_t )( void *, uint8_t , void *); static void * orig_NotifyEmu = NULL ; void hooked_NotifyEmu ( void * self , uint8_t isEmu , void * mi ) { log_to_file ( "[EMU] NotifyAndroidEmulatorResult(arg=%d) -> 0" , isEmu ); if ( orig_NotifyEmu ) (( NotifyEmu_t ) orig_NotifyEmu )( self , 0 , mi ); } // SINK 2: OnIsEmulatorListener.onIsEmulator(bool, string) - void, 2 args typedef void (* OnIsEmu_t )( void *, uint8_t , void *, void *); static void * orig_OnIsEmu = NULL ; void hooked_OnIsEmu ( void * self , uint8_t isEmu , void * errMsg , void * mi ) { log_to_file ( "[EMU] onIsEmulator(arg=%d) -> 0, \"\"" , isEmu ); if ( orig_OnIsEmu ) (( OnIsEmu_t ) orig_OnIsEmu )( self , 0 , NULL , mi ); } // SINK 3: IsEmulatorProvider.get_IsEmulator() - returns bool static void * orig_IsEmuProv = NULL ; uint8_t hooked_IsEmuProv ( void * self , void * mi ) { log_to_file ( "[EMU] IsEmulatorProvider.get_IsEmulator -> 0" ); return 0 ; } // INTEGRITY getters static void * orig_DevTrusted = NULL ; uint8_t hooked_DevTrusted ( void * self , void * mi ) { log_to_file ( "[INT] get_IsDeviceTrusted -> 1" ); return 1 ; } static void * orig_AppTrusted = NULL ; uint8_t hooked_AppTrusted ( void * self , void * mi ) { log_to_file ( "[INT] get_IsAppTrusted -> 1" ); return 1 ; } // INTEGRITY Report() - void, 0 args - no-op SAFE static void * orig_Report = NULL ; void hooked_Report ( void * self , void * mi ) { log_to_file ( "[INT] IntegrityService.Report() suppressed" ); } // INTEGRITY PostReport() - void, 0 args, private static void * orig_PostReport = NULL ; void hooked_PostReport ( void * self , void * mi ) { log_to_file ( "[INT] IntegrityService.PostReport() suppressed" ); } // AUTH OpenSession() - void, 0 args - observe, tetap panggil original typedef void (* OpenSess_t )( void *, void *); static void * orig_OpenSession = NULL ; void hooked_OpenSession ( void * self , void * mi ) { log_to_file ( "[AUTH] OpenSession() dipanggil" ); if ( orig_OpenSession ) (( OpenSess_t ) orig_OpenSession )( self , mi ); } // MSAA Fix static void * orig_GetAA = NULL ; int32_t hooked_GetAA ( void * mi ) { log_to_file ( "[MSAA] get_antiAliasing -> 0" ); return 0 ; } static void * orig_SetAA = NULL ; void hooked_SetAA ( int32_t v , void * mi ) { log_to_file ( "[MSAA] set_antiAliasing(%d) -> 0" , v ); if ( orig_SetAA ) (( void (*)( int32_t , void *)) orig_SetAA )( 0 , mi ); } // ==== MAIN THREAD ==== static void * hook_thread ( void * arg ) { log_to_file ( "[*] Thread start" ); sleep ( 3 ); if ( shadowhook_init ( SHADOWHOOK_MODE_SHARED , false ) != 0 ) { log_to_file ( "[-] SH init fail" ); return NULL ; } log_to_file ( "[+] SH init" ); shadowhook_hook_sym_name ( "libc.so" , "__system_property_get" , ( void *) my___system_property_get , ( void **)& orig___system_property_get ); sleep ( 1 ); detect_environment (); shadowhook_hook_sym_name ( "libc.so" , "fopen" ,( void *) my_fopen ,( void **)& orig_fopen ); shadowhook_hook_sym_name ( "libc.so" , "fopen64" ,( void *) my_fopen64 ,( void **)& orig_fopen64 ); shadowhook_hook_sym_name ( "libc.so" , "access" ,( void *) my_access ,( void **)& orig_access ); shadowhook_hook_sym_name ( "libc.so" , "open" ,( void *) my_open ,( void **)& orig_open ); shadowhook_hook_sym_name ( "libc.so" , "openat" ,( void *) my_openat ,( void **)& orig_openat ); shadowhook_hook_sym_name ( "libc.so" , "stat" ,( void *) my_stat ,( void **)& orig_stat ); shadowhook_hook_sym_name ( "libc.so" , "lstat" ,( void *) my_lstat ,( void **)& orig_lstat ); shadowhook_hook_sym_name ( "libc.so" , "opendir" ,( void *) my_opendir ,( void **)& orig_opendir ); shadowhook_hook_sym_name ( "libc.so" , "readdir" ,( void *) my_readdir ,( void **)& orig_readdir ); shadowhook_hook_sym_name ( "libc.so" , "execve" ,( void *) my_execve ,( void **)& orig_execve ); void * e = dlopen ( "libEGL.so" , RTLD_NOW ); if ( e ) { void * p = dlsym ( e , "eglGetProcAddress" ); if ( p ) shadowhook_hook_func_addr ( p , ( void *) my_eglGetProcAddress , ( void **)& orig_eglGetProcAddress ); } void * g = dlopen ( "libGLESv2.so" , RTLD_NOW ); if ( g ) { void * p = dlsym ( g , "glGetString" ); if ( p ) shadowhook_hook_func_addr ( p , ( void *) my_glGetString , ( void **)& orig_glGetString ); } log_to_file ( "[*] Wait il2cpp..." ); int w = 0 ; while (! g_xdl ) { sleep ( 1 ); w ++; g_xdl = xdl_open ( "libil2cpp.so" , XDL_DEFAULT ); if ( w % 10 == 0 && ! g_xdl ) log_to_file ( "[*] %ds" , w ); } log_to_file ( "[+] il2cpp @ %ds" , w ); if (! init_il2cpp ()) return NULL ; void * dom = g_il2cpp . domain_get (); if ( dom ) g_il2cpp . thread_attach ( dom ); // SINK 1: NotifyAndroidEmulatorResult void * p = get_method ( NS_EMU_DETECTOR , "AndroidEmulatorDetector" , "NotifyAndroidEmulatorResult" , 1 , NULL ); if ( p ) { void * s = shadowhook_hook_func_addr ( p , ( void *) hooked_NotifyEmu , & orig_NotifyEmu ); log_to_file ( "%s SINK1 @ %p" , s ? "[+]" : "[-]" , p ); } #if ENABLE_ON_ISEMU_LISTENER // SINK 2: OnIsEmulatorListener.onIsEmulator p = get_method ( NS_ON_ISEMU_LISTENER , "OnIsEmulatorListener" , "onIsEmulator" , 2 , NULL ); if ( p ) { void * s = shadowhook_hook_func_addr ( p , ( void *) hooked_OnIsEmu , & orig_OnIsEmu ); log_to_file ( "%s SINK2 @ %p" , s ? "[+]" : "[-]" , p ); } #endif // SINK 3: IsEmulatorProvider.get_IsEmulator p = get_method ( NS_ISEMU_PROVIDER , "IsEmulatorProvider" , "get_IsEmulator" , 0 , NULL ); if ( p ) { void * s = shadowhook_hook_func_addr ( p , ( void *) hooked_IsEmuProv , & orig_IsEmuProv ); log_to_file ( "%s SINK3 @ %p" , s ? "[+]" : "[-]" , p ); } #if ENABLE_INTEGRITY_GETTERS p = get_method ( NS_INTEGRITY_RESP , "IntegrityReportResponse" , "get_IsDeviceTrusted" , 0 , NULL ); if ( p ) { void * s = shadowhook_hook_func_addr ( p , ( void *) hooked_DevTrusted , & orig_DevTrusted ); log_to_file ( "%s DevTrusted @ %p" , s ? "[+]" : "[-]" , p ); } p = get_method ( NS_INTEGRITY_RESP , "IntegrityReportResponse" , "get_IsAppTrusted" , 0 , NULL ); if ( p ) { void * s = shadowhook_hook_func_addr ( p , ( void *) hooked_AppTrusted , & orig_AppTrusted ); log_to_file ( "%s AppTrusted @ %p" , s ? "[+]" : "[-]" , p ); } #endif #if ENABLE_INTEGRITY_REPORT p = get_method ( NS_INTEGRITY , "IntegrityService" , "Report" , 0 , NULL ); if ( p ) { void * s = shadowhook_hook_func_addr ( p , ( void *) hooked_Report , & orig_Report ); log_to_file ( "%s Report @ %p" , s ? "[+]" : "[-]" , p ); } p = get_method ( NS_INTEGRITY , "IntegrityService" , "PostReport" , 0 , NULL ); if ( p ) { void * s = shadowhook_hook_func_addr ( p , ( void *) hooked_PostReport , & orig_PostReport ); log_to_file ( "%s PostReport @ %p" , s ? "[+]" : "[-]" , p ); } #endif #if ENABLE_AUTH_HOOKS p = get_method ( NS_AUTH , "AuthService" , "OpenSession" , 0 , NULL ); if ( p ) { void * s = shadowhook_hook_func_addr ( p , ( void *) hooked_OpenSession , & orig_OpenSession ); log_to_file ( "%s OpenSession @ %p" , s ? "[+]" : "[-]" , p ); } #endif #if ENABLE_MSAA_FIX p = get_method ( "UnityEngine" , "QualitySettings" , "get_antiAliasing" , 0 , NULL ); if ( p ) { void * s = shadowhook_hook_func_addr ( p , ( void *) hooked_GetAA , & orig_GetAA ); log_to_file ( "%s get_antiAliasing @ %p" , s ? "[+]" : "[-]" , p ); } p = get_method ( "UnityEngine" , "QualitySettings" , "set_antiAliasing" , 1 , NULL ); if ( p ) { void * s = shadowhook_hook_func_addr ( p , ( void *) hooked_SetAA , & orig_SetAA ); log_to_file ( "%s set_antiAliasing @ %p" , s ? "[+]" : "[-]" , p ); } #endif log_to_file ( "[+] DONE (SDK=%d a7=%d vphone=%d)" , g_sdk_int , g_is_android7 , g_is_virtual_master ); return NULL ; } __attribute__ (( constructor )) void on_load () { log_to_file ( "[*] CONSTRUCTOR" ); #if ENABLE_SIGNAL_HANDLER install_sig (); #endif JavaVM * vm = NULL ; for ( int i = 0 ; i < 50 && ! vm ; i ++) { vm = get_vm (); if (! vm ) usleep ( 100000 ); } #if ENABLE_JNI_BUILD_SPOOF if ( vm ) { JNIEnv * env = NULL ; bool det = false ; if ( vm -> GetEnv (( void **)& env , JNI_VERSION_1_6 ) != JNI_OK ) { if ( vm -> AttachCurrentThread (& env , NULL ) == JNI_OK ) det = true ; } if ( env ) spoof_build ( env ); if ( det ) vm -> DetachCurrentThread (); } #endif pthread_t t ; pthread_create (& t , NULL , hook_thread , NULL ); } JNIEXPORT jint JNICALL JNI_OnLoad ( JavaVM * vm , void * reserved ) { log_to_file ( "[*] JNI_OnLoad" ); return JNI_VERSION_1_6 ; }