diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..39fb081 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/ccplus.xml b/.idea/copyright/ccplus.xml new file mode 100644 index 0000000..154db3d --- /dev/null +++ b/.idea/copyright/ccplus.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..168c960 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..3741162 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Android + + + Android > Lint > Correctness + + + Java + + + Java language level migration aidsJava + + + + + Android + + + + + + + + + + + + + + + + + + + + + + $USER_HOME$/.subversion + + + + + + ccplus + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..b4cf82b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..726992a --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ + +library目录下有反调试,防so注入等代码,修改jni代码后,运行rebuild project即可重新生成so + +inject目录下有so注入例子 + + +### Inject说明 + +1. 真机先进行root + +2. android6.0/7.0禁掉Selinux + + adb shell setenforce 0 + +3. local.properties配置好NDK目录 + +4. cd 进入 inject目录,执行 ndk-build 命令 + +5. 将so和可执行文件inject导入真机,执行 inject + + adb root + adb remount + adb push libs/armeabi-v7a/libqever.so /data/local/tmp + adb push libs/armeabi-v7a/inject /data/local/tmp + adb shell + cd /data/local/tmp + ./inject ... ... ... + + + +# Thanks + +https://github.com/fourbrother/android_anti_debug + +https://bbs.pediy.com/thread-194080.htm + diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..0021a2b --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,41 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion Integer.parseInt(rootProject.android_compileSdkVersion) + buildToolsVersion rootProject.android_buildToolsVersion + defaultConfig { + applicationId "com.wiseyq.sojni" + minSdkVersion Integer.parseInt(rootProject.android_minSdkVersion) + targetSdkVersion Integer.parseInt(rootProject.android_targetSdkVersion) + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + + ndk { + moduleName "ccprotect" + ldLibs "log", "z", "m" + abiFilters "armeabi", "armeabi-v7a", "x86" + } + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + + sourceSets { + main { + jniLibs.srcDirs = ['libs'] + assets.srcDirs = ['assets'] + } + } + +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile "com.android.support:appcompat-v7:${android_support_libs}" + compile 'com.jaredrummler:android-processes:1.0.9' + compile project(':library') +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..1c90e63 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/luffyjet/Documents/android-sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..3ca2d4b --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/wiseyq/sojni/MainActivity.java b/app/src/main/java/com/wiseyq/sojni/MainActivity.java new file mode 100644 index 0000000..3cdb63b --- /dev/null +++ b/app/src/main/java/com/wiseyq/sojni/MainActivity.java @@ -0,0 +1,62 @@ +package com.wiseyq.sojni; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.util.Log; +import android.view.View; + +import com.wiseyq.safe.CCProctect; + +import java.io.File; +import java.util.HashSet; + +public class MainActivity extends AppCompatActivity { + private static final String TAG = "MainActivity"; + + //加载so库 + static { + System.loadLibrary("ccprotect"); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); +// List list = AndroidProcesses.getRunningProcesses(); +// for (AndroidProcess androidProcess :list){ +// Log.i(TAG, "androidProcess: "+androidProcess.name + " pid:" + androidProcess.pid); +// } + + Log.i(TAG, "my pid:" + android.os.Process.myPid()); + + findViewById(R.id.findbtn).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + HashSet hashSet = CCProctect.getSoList(android.os.Process.myPid(),getPackageName()); + Log.i(TAG, "onClick: "); + for (String s:hashSet){ + Log.i(TAG, "so path: "+s); + } + } + }); + + + findViewById(R.id.deleteBtn).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.i(TAG, "onClick: delete"); + CCProctect.uninstall("/data/local/tmp/libqever.so"); + } + }); + + + try { + File file = new File("/data/local/tmp/libqever.so"); + if (file.exists()){ + Log.i(TAG, "libqever: "+file.length()); + } + }catch (Exception e){ + e.printStackTrace(); + } + } +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..e2b6837 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,36 @@ + + + +