1.可以更新内存的Code
//change so memory data int test[]={0xE3A0045D,0xE2800973,0xE2800E87,0xE2800005}; int *temp=(int *)(baseA+0xe22e90); size_t pagesize = sysconf(_SC_PAGESIZE); // Calculate start and end addresses for the write. uintptr_t start = (uintptr_t) temp ; uintptr_t end = start + 1024; // Calculate start of page for mprotect. uintptr_t pagestart = start & -pagesize; if( !mprotect((void *) pagestart, end - pagestart,PROT_READ | PROT_WRITE | PROT_EXEC) ) { for(int i=0; i<4; i++){ temp[i]=test[i]; // LogD("my_<%s>, data = %x",__FUNCTION__, temp[i]); } } #define GETLR(store_lr) \ __asm__ __volatile__( \ "mov %0, lr\n\t" \ : "=r"(store_lr) \ ) unsigned lr; GETLR(lr); const-string v0, "hook_log" invoke-static {v0, p0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I void keepSoData(){ FILE *pFile=fopen(SoPath,"r"); //获取文件的指针 if(pFile==NULL){ __android_log_print(ANDROID_LOG_INFO, "native_hook__dump", "SoPath is null"); return ; } char *pBuf; //定义文件指针 fseek(pFile,0,SEEK_END); //把指针移动到文件的结尾 ,获取文件长度 int len=ftell(pFile); //获取文件长度 pBuf=(char *)malloc(len+1); //new char[len+1]; //定义数组长度 memset(pBuf,0,len+1); rewind(pFile); //把指针移动到文件开头 因为我们一开始把指针移动到结尾,如果不移动回来 会出错 fread(pBuf,len,1,pFile); //读文件 pBuf[len]=0; //把读到的文件最后一位 写为0 要不然系统会一直寻找到0后才结束 //显示读到的数据 fclose(pFile); // 关闭文件 FILE *fp; // 定义一个文件指针fp fp = fopen("/sdcard/dump_xqm.so", "wb"); // 以二进制可写方式打开stu.dat文件 if(fp==NULL){ __android_log_print(ANDROID_LOG_INFO, "native_hook__dump", "SoPath is null"); return; } int i=0; fwrite (pBuf , sizeof(char), len, fp); fclose (fp); free(pBuf); } public static void test(){ Exception e = new Exception("this is a log"); StackTraceElement[] elements=e.getStackTrace(); StringBuilder sb=new StringBuilder(); for(int i=0; i
2.AndroidStudio 多渠道配置
apply plugin: 'com.android.application' android { signingConfigs { SignConfig { keyAlias 'iplay' keyPassword 'passwd11' storeFile file('release.keystore') storePassword 'passwd11' } } compileSdkVersion 23 buildToolsVersion '26.0.2' defaultConfig { applicationId "com.gameassist.plugin.wedo1.DeathMoto4" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0.1" } buildTypes { release { minifyEnabled true proguardFiles 'proguard-rules.pro' signingConfig signingConfigs.SignConfig manifestPlaceholders = [mylabel: "暴力摩托4-release"] } debug { manifestPlaceholders = [mylabel: "暴力摩托4-debug"] } } flavorDimensions "default" productFlavors { disheng { applicationId "com.gameassist.plugin.wedo1.DeathMoto4.disheng" dimension "default" } } android.applicationVariants.all { variant -> variant.outputs.all { outputFileName = "plugins-${variant.flavorName}-${variant.buildType.name}-v${variant.versionCode}-暴力摩托4.apk".toLowerCase() } } } repositories { flatDir { dirs 'libs' } } dependencies { compile project(':jni') provided files('libs/pluginInterface.jar') compile(name: 'frank-c-release', ext: 'aar') // compile 'com.yyhd.mini.program.frank:franksdk:1.0.2' }