├── 006-通过hook重定向native方法 ├── jni │ ├── README.txt │ ├── hello.cpp │ ├── com_demo_MainActivity.h │ ├── Android.mk │ └── hackcodejiagu.cpp ├── obj │ └── local │ │ └── armeabi │ │ ├── libstdc++.a │ │ └── objs-debug │ │ ├── hello │ │ └── hello.o.d │ │ ├── hackcodejiagu │ │ └── hackcodejiagu.o.d │ │ └── demo1 │ │ └── demo1.o.d ├── gen │ ├── R.java.d │ └── com │ │ └── demo │ │ ├── BuildConfig.java │ │ └── R.java ├── bin │ ├── NdkDemo1.ap_ │ ├── classes.dex │ ├── classes.dex.d │ ├── NdkDemo1.ap_.d │ ├── AndroidManifest.xml.d │ ├── NdkDemo1-debug-unaligned.apk.d │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-ldpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ └── drawable-xhdpi │ │ │ └── ic_launcher.png │ ├── proguard.txt │ ├── build.prop │ └── AndroidManifest.xml ├── libs │ └── armeabi │ │ ├── gdbserver │ │ └── gdb.setup ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-ldpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── values │ │ └── strings.xml │ └── layout │ │ └── main.xml ├── local.properties ├── project.properties ├── src │ └── com │ │ └── demo │ │ ├── MainActivity.java │ │ └── ProxyApplication.java ├── AndroidManifest.xml ├── ant.properties ├── proguard-project.txt └── build.xml ├── 003-SectionEncrypt ├── obj │ └── local │ │ └── armeabi │ │ ├── libstdc++.a │ │ └── objs │ │ └── demo │ │ └── demo.o.d ├── README.txt ├── gen │ ├── R.java.d │ └── com │ │ └── demo │ │ ├── BuildConfig.java │ │ └── R.java ├── bin │ ├── classes.dex │ ├── NdkDemo1.ap_ │ ├── classes.dex.d │ ├── NdkDemo1.ap_.d │ ├── AndroidManifest.xml.d │ ├── proguard.txt │ ├── NdkDemo1-debug-unaligned.apk.d │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-ldpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ └── drawable-xhdpi │ │ │ └── ic_launcher.png │ ├── build.prop │ └── AndroidManifest.xml ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-ldpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── values │ │ └── strings.xml │ └── layout │ │ └── main.xml ├── jni │ ├── Android.mk │ ├── com_demo_MainActivity.h │ └── demo.cpp ├── local.properties ├── .classpath ├── project.properties ├── src │ └── com │ │ └── demo │ │ └── MainActivity.java ├── AndroidManifest.xml ├── ant.properties ├── proguard-project.txt ├── .project └── build.xml ├── 004-MethodEncrypt ├── obj │ └── local │ │ └── armeabi │ │ ├── libstdc++.a │ │ └── objs │ │ └── demo │ │ └── demo.o.d ├── README.txt ├── bin │ ├── NdkDemo1.ap_ │ ├── classes.dex │ ├── proguard.txt │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-ldpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ └── drawable-xhdpi │ │ │ └── ic_launcher.png │ ├── AndroidManifest.xml.d │ ├── build.prop │ ├── NdkDemo1-debug-unaligned.apk.d │ ├── AndroidManifest.xml │ ├── classes.dex.d │ └── NdkDemo1.ap_.d ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-ldpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── values │ │ └── strings.xml │ └── layout │ │ └── main.xml ├── gen │ ├── com │ │ └── demo │ │ │ ├── BuildConfig.java │ │ │ └── R.java │ └── R.java.d ├── jni │ ├── Android.mk │ ├── com_demo_MainActivity.h │ └── demo.cpp ├── local.properties ├── .classpath ├── project.properties ├── src │ └── com │ │ └── demo │ │ └── MainActivity.java ├── AndroidManifest.xml ├── ant.properties ├── proguard-project.txt ├── .project └── build.xml ├── 005-Dalvik运行时篡改字节码 ├── obj │ └── local │ │ └── armeabi │ │ └── libstdc++.a ├── gen │ ├── R.java.d │ └── com │ │ └── demo │ │ ├── BuildConfig.java │ │ └── R.java ├── bin │ ├── classes.dex │ ├── NdkDemo1.ap_ │ ├── classes.dex.d │ ├── NdkDemo1.ap_.d │ ├── AndroidManifest.xml.d │ ├── proguard.txt │ ├── NdkDemo1-debug-unaligned.apk.d │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-ldpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ └── drawable-xhdpi │ │ │ └── ic_launcher.png │ ├── build.prop │ └── AndroidManifest.xml ├── libs │ └── armeabi │ │ ├── gdbserver │ │ └── gdb.setup ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-ldpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── values │ │ └── strings.xml │ └── layout │ │ └── main.xml ├── src │ └── com │ │ └── demo │ │ ├── Test.java │ │ └── MainActivity.java ├── jni │ ├── Android.mk │ ├── com_demo_MainActivity.h │ └── mycommon.h ├── local.properties ├── project.properties ├── AndroidManifest.xml ├── ant.properties ├── proguard-project.txt └── build.xml ├── .gitignore ├── 007-动态注册native方法 ├── gen │ ├── R.java.d │ └── com │ │ └── demo │ │ ├── BuildConfig.java │ │ └── R.java ├── bin │ ├── NdkDemo1.ap_ │ ├── classes.dex │ ├── classes.dex.d │ ├── NdkDemo1.ap_.d │ ├── proguard.txt │ ├── AndroidManifest.xml.d │ ├── NdkDemo1-debug-unaligned.apk.d │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-ldpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ └── drawable-xhdpi │ │ │ └── ic_launcher.png │ ├── build.prop │ └── AndroidManifest.xml ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-ldpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── values │ │ └── strings.xml │ └── layout │ │ └── main.xml ├── jni │ ├── Android.mk │ └── demo.c ├── local.properties ├── src │ └── com │ │ └── demo │ │ └── MainActivity.java ├── project.properties ├── AndroidManifest.xml ├── ant.properties ├── proguard-project.txt ├── build.xml └── obj │ └── local │ └── armeabi │ └── objs │ └── demo │ └── demo.o.d ├── 002-DexEncrypt ├── bin │ ├── classes.dex │ ├── resources.ap_ │ ├── res │ │ └── crunch │ │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ │ └── drawable-xxhdpi │ │ │ └── ic_launcher.png │ └── AndroidManifest.xml ├── ic_launcher-web.png ├── assets │ └── Test.modified.encrypted.dex ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── values-v11 │ │ └── styles.xml │ ├── menu │ │ └── main.xml │ ├── values-w820dp │ │ └── dimens.xml │ ├── values-v14 │ │ └── styles.xml │ └── layout │ │ └── activity_main.xml ├── gen │ └── com │ │ └── dexencrypt │ │ ├── BuildConfig.java │ │ └── R.java ├── .classpath ├── src │ └── com │ │ └── dexencrypt │ │ ├── MainActivity.java │ │ ├── Common.java │ │ ├── DESUtils.java │ │ └── Security.java ├── project.properties ├── proguard-project.txt ├── .project └── AndroidManifest.xml ├── 001-HiddenMethod ├── bin │ ├── classes.dex │ ├── resources.ap_ │ ├── res │ │ └── crunch │ │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ │ └── drawable-xxhdpi │ │ │ └── ic_launcher.png │ └── AndroidManifest.xml ├── ic_launcher-web.png ├── assets │ └── Test.modified.dex ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── values-v11 │ │ └── styles.xml │ ├── menu │ │ └── main.xml │ ├── values-w820dp │ │ └── dimens.xml │ ├── values-v14 │ │ └── styles.xml │ └── layout │ │ └── activity_main.xml ├── gen │ └── com │ │ └── hiddenmethod │ │ ├── BuildConfig.java │ │ └── R.java ├── .settings │ └── org.eclipse.jdt.core.prefs ├── .classpath ├── src │ └── com │ │ └── hiddenmethod │ │ ├── MainActivity.java │ │ └── Security.java ├── project.properties ├── proguard-project.txt ├── .project └── AndroidManifest.xml ├── shellTools ├── elf_tools.h ├── makefile ├── elf_parser.h ├── elf_tools.c ├── main.c └── elf_parser.c └── README.md /006-通过hook重定向native方法/jni/README.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /003-SectionEncrypt/obj/local/armeabi/libstdc++.a: -------------------------------------------------------------------------------- 1 | ! 2 | -------------------------------------------------------------------------------- /004-MethodEncrypt/obj/local/armeabi/libstdc++.a: -------------------------------------------------------------------------------- 1 | ! 2 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/obj/local/armeabi/libstdc++.a: -------------------------------------------------------------------------------- 1 | ! 2 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/obj/local/armeabi/libstdc++.a: -------------------------------------------------------------------------------- 1 | ! 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.exe 3 | *.class 4 | *.apk 5 | *.so 6 | DexClassLoader/ 7 | -------------------------------------------------------------------------------- /003-SectionEncrypt/README.txt: -------------------------------------------------------------------------------- 1 | 1.将目标函数放到自定义的.mytext section区域 2 | 2.对.mytext section整体加密解密 -------------------------------------------------------------------------------- /004-MethodEncrypt/README.txt: -------------------------------------------------------------------------------- 1 | 1.将目标函数放到自定义的.mytext section区域 2 | 2.对.mytext section整体加密解密 -------------------------------------------------------------------------------- /007-动态注册native方法/gen/R.java.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/gen/R.java.d -------------------------------------------------------------------------------- /002-DexEncrypt/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/002-DexEncrypt/bin/classes.dex -------------------------------------------------------------------------------- /003-SectionEncrypt/gen/R.java.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/gen/R.java.d -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/gen/R.java.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/gen/R.java.d -------------------------------------------------------------------------------- /001-HiddenMethod/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/001-HiddenMethod/bin/classes.dex -------------------------------------------------------------------------------- /001-HiddenMethod/bin/resources.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/001-HiddenMethod/bin/resources.ap_ -------------------------------------------------------------------------------- /002-DexEncrypt/bin/resources.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/002-DexEncrypt/bin/resources.ap_ -------------------------------------------------------------------------------- /002-DexEncrypt/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/002-DexEncrypt/ic_launcher-web.png -------------------------------------------------------------------------------- /003-SectionEncrypt/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/bin/classes.dex -------------------------------------------------------------------------------- /004-MethodEncrypt/bin/NdkDemo1.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/004-MethodEncrypt/bin/NdkDemo1.ap_ -------------------------------------------------------------------------------- /004-MethodEncrypt/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/004-MethodEncrypt/bin/classes.dex -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/bin/classes.dex -------------------------------------------------------------------------------- /006-通过hook重定向native方法/gen/R.java.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/gen/R.java.d -------------------------------------------------------------------------------- /007-动态注册native方法/bin/NdkDemo1.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/bin/NdkDemo1.ap_ -------------------------------------------------------------------------------- /007-动态注册native方法/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/bin/classes.dex -------------------------------------------------------------------------------- /007-动态注册native方法/bin/classes.dex.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/bin/classes.dex.d -------------------------------------------------------------------------------- /001-HiddenMethod/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/001-HiddenMethod/ic_launcher-web.png -------------------------------------------------------------------------------- /003-SectionEncrypt/bin/NdkDemo1.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/bin/NdkDemo1.ap_ -------------------------------------------------------------------------------- /003-SectionEncrypt/bin/classes.dex.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/bin/classes.dex.d -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/bin/NdkDemo1.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/bin/NdkDemo1.ap_ -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/bin/classes.dex.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/bin/classes.dex.d -------------------------------------------------------------------------------- /007-动态注册native方法/bin/NdkDemo1.ap_.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/bin/NdkDemo1.ap_.d -------------------------------------------------------------------------------- /003-SectionEncrypt/bin/NdkDemo1.ap_.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/bin/NdkDemo1.ap_.d -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/bin/NdkDemo1.ap_.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/bin/NdkDemo1.ap_.d -------------------------------------------------------------------------------- /006-通过hook重定向native方法/bin/NdkDemo1.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/bin/NdkDemo1.ap_ -------------------------------------------------------------------------------- /006-通过hook重定向native方法/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/bin/classes.dex -------------------------------------------------------------------------------- /006-通过hook重定向native方法/bin/classes.dex.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/bin/classes.dex.d -------------------------------------------------------------------------------- /001-HiddenMethod/assets/Test.modified.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/001-HiddenMethod/assets/Test.modified.dex -------------------------------------------------------------------------------- /004-MethodEncrypt/bin/proguard.txt: -------------------------------------------------------------------------------- 1 | # view AndroidManifest.xml #generated:7 2 | -keep class com.demo.MainActivity { (...); } 3 | 4 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/libs/armeabi/gdbserver: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/libs/armeabi/gdbserver -------------------------------------------------------------------------------- /006-通过hook重定向native方法/bin/NdkDemo1.ap_.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/bin/NdkDemo1.ap_.d -------------------------------------------------------------------------------- /007-动态注册native方法/bin/proguard.txt: -------------------------------------------------------------------------------- 1 | # view AndroidManifest.xml #generated:7 2 | -keep class com.demo.MainActivity { (...); } 3 | 4 | -------------------------------------------------------------------------------- /003-SectionEncrypt/bin/AndroidManifest.xml.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/bin/AndroidManifest.xml.d -------------------------------------------------------------------------------- /003-SectionEncrypt/bin/proguard.txt: -------------------------------------------------------------------------------- 1 | # view AndroidManifest.xml #generated:7 2 | -keep class com.demo.MainActivity { (...); } 3 | 4 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/bin/AndroidManifest.xml.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/bin/AndroidManifest.xml.d -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/bin/proguard.txt: -------------------------------------------------------------------------------- 1 | # view AndroidManifest.xml #generated:7 2 | -keep class com.demo.MainActivity { (...); } 3 | 4 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/libs/armeabi/gdbserver: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/libs/armeabi/gdbserver -------------------------------------------------------------------------------- /007-动态注册native方法/bin/AndroidManifest.xml.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/bin/AndroidManifest.xml.d -------------------------------------------------------------------------------- /002-DexEncrypt/assets/Test.modified.encrypted.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/002-DexEncrypt/assets/Test.modified.encrypted.dex -------------------------------------------------------------------------------- /002-DexEncrypt/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/002-DexEncrypt/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /002-DexEncrypt/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/002-DexEncrypt/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /002-DexEncrypt/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/002-DexEncrypt/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /006-通过hook重定向native方法/bin/AndroidManifest.xml.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/bin/AndroidManifest.xml.d -------------------------------------------------------------------------------- /001-HiddenMethod/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/001-HiddenMethod/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /001-HiddenMethod/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/001-HiddenMethod/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /001-HiddenMethod/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/001-HiddenMethod/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /002-DexEncrypt/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/002-DexEncrypt/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /004-MethodEncrypt/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/004-MethodEncrypt/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /004-MethodEncrypt/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/004-MethodEncrypt/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /004-MethodEncrypt/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/004-MethodEncrypt/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /007-动态注册native方法/bin/NdkDemo1-debug-unaligned.apk.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/bin/NdkDemo1-debug-unaligned.apk.d -------------------------------------------------------------------------------- /007-动态注册native方法/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /007-动态注册native方法/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /007-动态注册native方法/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /007-动态注册native方法/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /001-HiddenMethod/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/001-HiddenMethod/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /003-SectionEncrypt/bin/NdkDemo1-debug-unaligned.apk.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/bin/NdkDemo1-debug-unaligned.apk.d -------------------------------------------------------------------------------- /003-SectionEncrypt/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /003-SectionEncrypt/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /003-SectionEncrypt/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /003-SectionEncrypt/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /004-MethodEncrypt/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/004-MethodEncrypt/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/bin/NdkDemo1-debug-unaligned.apk.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/bin/NdkDemo1-debug-unaligned.apk.d -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /007-动态注册native方法/bin/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/bin/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /007-动态注册native方法/bin/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/bin/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /007-动态注册native方法/bin/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/bin/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /003-SectionEncrypt/bin/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/bin/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /003-SectionEncrypt/bin/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/bin/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /003-SectionEncrypt/bin/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/bin/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /004-MethodEncrypt/bin/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/004-MethodEncrypt/bin/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /004-MethodEncrypt/bin/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/004-MethodEncrypt/bin/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /004-MethodEncrypt/bin/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/004-MethodEncrypt/bin/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /004-MethodEncrypt/bin/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/004-MethodEncrypt/bin/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/bin/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/bin/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/bin/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/bin/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/bin/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/bin/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /006-通过hook重定向native方法/bin/NdkDemo1-debug-unaligned.apk.d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/bin/NdkDemo1-debug-unaligned.apk.d -------------------------------------------------------------------------------- /006-通过hook重定向native方法/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /006-通过hook重定向native方法/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /006-通过hook重定向native方法/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /006-通过hook重定向native方法/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /007-动态注册native方法/bin/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/007-动态注册native方法/bin/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /002-DexEncrypt/bin/res/crunch/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/002-DexEncrypt/bin/res/crunch/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /002-DexEncrypt/bin/res/crunch/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/002-DexEncrypt/bin/res/crunch/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /003-SectionEncrypt/bin/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/003-SectionEncrypt/bin/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /003-SectionEncrypt/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainActivity 4 | 5 | -------------------------------------------------------------------------------- /004-MethodEncrypt/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainActivity 4 | 5 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/bin/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/005-Dalvik运行时篡改字节码/bin/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainActivity 4 | 5 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/bin/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/bin/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /006-通过hook重定向native方法/bin/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/bin/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /006-通过hook重定向native方法/bin/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/bin/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /007-动态注册native方法/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainActivity 4 | 5 | -------------------------------------------------------------------------------- /001-HiddenMethod/bin/res/crunch/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/001-HiddenMethod/bin/res/crunch/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /001-HiddenMethod/bin/res/crunch/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/001-HiddenMethod/bin/res/crunch/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /002-DexEncrypt/bin/res/crunch/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/002-DexEncrypt/bin/res/crunch/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /002-DexEncrypt/bin/res/crunch/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/002-DexEncrypt/bin/res/crunch/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /006-通过hook重定向native方法/bin/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/006-通过hook重定向native方法/bin/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /006-通过hook重定向native方法/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainActivity 4 | 5 | -------------------------------------------------------------------------------- /001-HiddenMethod/bin/res/crunch/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/001-HiddenMethod/bin/res/crunch/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /001-HiddenMethod/bin/res/crunch/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guanchao/AppProtect/HEAD/001-HiddenMethod/bin/res/crunch/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /004-MethodEncrypt/bin/AndroidManifest.xml.d: -------------------------------------------------------------------------------- 1 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\AndroidManifest.xml : \ 2 | C:\cygwin64\home\guanchao\MethodEncrypt\AndroidManifest.xml \ 3 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/src/com/demo/Test.java: -------------------------------------------------------------------------------- 1 | package com.demo; 2 | public class Test{ 3 | 4 | public int add(int a, int b){ 5 | int c; 6 | c = a * b; 7 | return c; 8 | } 9 | } -------------------------------------------------------------------------------- /003-SectionEncrypt/gen/com/demo/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.demo; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /004-MethodEncrypt/gen/com/demo/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.demo; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/gen/com/demo/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.demo; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /007-动态注册native方法/gen/com/demo/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.demo; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /006-通过hook重定向native方法/gen/com/demo/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.demo; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /002-DexEncrypt/gen/com/dexencrypt/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.dexencrypt; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /001-HiddenMethod/gen/com/hiddenmethod/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.hiddenmethod; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /007-动态注册native方法/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := demo 5 | LOCAL_SRC_FILES := demo.c 6 | LOCAL_LDLIBS := -llog 7 | include $(BUILD_SHARED_LIBRARY) 8 | 9 | 10 | -------------------------------------------------------------------------------- /003-SectionEncrypt/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := demo 5 | LOCAL_SRC_FILES := demo.cpp 6 | LOCAL_LDLIBS := -llog 7 | include $(BUILD_SHARED_LIBRARY) 8 | 9 | 10 | -------------------------------------------------------------------------------- /004-MethodEncrypt/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := demo 5 | LOCAL_SRC_FILES := demo.cpp 6 | LOCAL_LDLIBS := -llog 7 | include $(BUILD_SHARED_LIBRARY) 8 | 9 | 10 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := demo1 5 | LOCAL_SRC_FILES := demo1.cpp 6 | LOCAL_LDLIBS := -llog 7 | include $(BUILD_SHARED_LIBRARY) 8 | 9 | 10 | -------------------------------------------------------------------------------- /001-HiddenMethod/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/bin/proguard.txt: -------------------------------------------------------------------------------- 1 | # view AndroidManifest.xml #generated:7 2 | -keep class com.demo.MainActivity { (...); } 3 | 4 | # view AndroidManifest.xml #generated:6 5 | -keep class com.demo.ProxyApplication { (...); } 6 | 7 | -------------------------------------------------------------------------------- /003-SectionEncrypt/bin/build.prop: -------------------------------------------------------------------------------- 1 | #Last build type 2 | #Sat, 31 Dec 2016 19:22:49 +0800 3 | 4 | build.last.target=debug 5 | 6 | build.last.is.instrumented=false 7 | 8 | build.last.is.packaging.debug=true 9 | 10 | build.last.is.signing.debug=true 11 | -------------------------------------------------------------------------------- /004-MethodEncrypt/bin/build.prop: -------------------------------------------------------------------------------- 1 | #Last build type 2 | #Sat, 31 Dec 2016 19:26:51 +0800 3 | 4 | build.last.target=debug 5 | 6 | build.last.is.instrumented=false 7 | 8 | build.last.is.packaging.debug=true 9 | 10 | build.last.is.signing.debug=true 11 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/bin/build.prop: -------------------------------------------------------------------------------- 1 | #Last build type 2 | #Mon, 13 Mar 2017 23:30:37 +0800 3 | 4 | build.last.target=debug 5 | 6 | build.last.is.instrumented=false 7 | 8 | build.last.is.packaging.debug=true 9 | 10 | build.last.is.signing.debug=true 11 | -------------------------------------------------------------------------------- /007-动态注册native方法/bin/build.prop: -------------------------------------------------------------------------------- 1 | #Last build type 2 | #Sat, 18 Mar 2017 12:16:11 +0800 3 | 4 | build.last.target=debug 5 | 6 | build.last.is.instrumented=false 7 | 8 | build.last.is.packaging.debug=true 9 | 10 | build.last.is.signing.debug=true 11 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/bin/build.prop: -------------------------------------------------------------------------------- 1 | #Last build type 2 | #Sat, 18 Mar 2017 11:50:53 +0800 3 | 4 | build.last.target=debug 5 | 6 | build.last.is.instrumented=false 7 | 8 | build.last.is.packaging.debug=true 9 | 10 | build.last.is.signing.debug=true 11 | -------------------------------------------------------------------------------- /002-DexEncrypt/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /001-HiddenMethod/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /001-HiddenMethod/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HiddenMethod 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /002-DexEncrypt/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DexEncrypt 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/libs/armeabi/gdb.setup: -------------------------------------------------------------------------------- 1 | set solib-search-path ./obj/local/armeabi 2 | source D:/Android/android-ndk-r10e/prebuilt/common/gdb/common.setup 3 | directory D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include D:/Android/android-ndk-r10e/sources/cxx-stl/system/include jni 4 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/libs/armeabi/gdb.setup: -------------------------------------------------------------------------------- 1 | set solib-search-path ./obj/local/armeabi 2 | source D:/Android/android-ndk-r10e/prebuilt/common/gdb/common.setup 3 | directory D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include D:/Android/android-ndk-r10e/sources/cxx-stl/system/include jni 4 | -------------------------------------------------------------------------------- /004-MethodEncrypt/bin/NdkDemo1-debug-unaligned.apk.d: -------------------------------------------------------------------------------- 1 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\NdkDemo1-debug-unaligned.apk : \ 2 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\NdkDemo1.ap_ \ 3 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\classes.dex \ 4 | C:\cygwin64\home\guanchao\MethodEncrypt\libs\armeabi\libdemo.so \ 5 | -------------------------------------------------------------------------------- /shellTools/elf_tools.h: -------------------------------------------------------------------------------- 1 | #include "elf_parser.h" 2 | 3 | void encryptFunction(const char *output_filename, Elf32_Ehdr ehdr, FILE *file, long file_size, const char *name, Elf32_Sym *targetSym); 4 | void encryptSection(const char *output_filename, Elf32_Shdr *shdr_tab, int shnum, char *strtab, FILE* file, const char *section_name); 5 | 6 | -------------------------------------------------------------------------------- /shellTools/makefile: -------------------------------------------------------------------------------- 1 | run : main.o elf_parser.o elf_tools.o 2 | cc -o run main.o elf_parser.o elf_tools.o 3 | main.o : main.c elf_parser.h 4 | cc -c main.c 5 | elf_parser.o : elf_parser.c elf_parser.h elf.h 6 | cc -c elf_parser.c 7 | elf_tools.o : elf_tools.c elf_tools.h elf.h 8 | cc -c elf_tools.c 9 | clean : 10 | rm run main.o elf_parser.o elf_tools.o 11 | -------------------------------------------------------------------------------- /001-HiddenMethod/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /002-DexEncrypt/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /002-DexEncrypt/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /001-HiddenMethod/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /002-DexEncrypt/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 64dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /001-HiddenMethod/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 64dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AppProtect 2 | 整理一些app常见的加固方法,包括java层、native层和资源文件加固等 3 | 4 | 1.HiddenMethod 5 | 隐藏dex文件的method 6 | 7 | 2.DexEncrypt 8 | 对dex文件整体加密解密 9 | 10 | 3.SectionEncrypt 11 | 对so文件的指定section进行整体加密解密 12 | 13 | 4.MethodEncrypt 14 | 对so文件的指定方法进行加密解密 15 | 16 | 5.Dalvik运行时篡改字节码 17 | 在运行时动态修改dex中方法的字节码 18 | 19 | 6.通过hook重定向native方法 20 | 使用cydia substrate hook框架重定向native方法,达到保护native方法的目的 21 | 22 | 7.动态注册native方法 23 | 自己注册native方法,隐藏带有Java_xxx_xxx_xxx的函数名特征 -------------------------------------------------------------------------------- /002-DexEncrypt/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /001-HiddenMethod/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /007-动态注册native方法/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /003-SectionEncrypt/local.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | 7 | # location of the SDK. This is only used by Ant 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | sdk.dir=D:\\Android\\sdk 11 | -------------------------------------------------------------------------------- /004-MethodEncrypt/local.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | 7 | # location of the SDK. This is only used by Ant 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | sdk.dir=D:\\Android\\sdk 11 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/local.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | 7 | # location of the SDK. This is only used by Ant 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | sdk.dir=D:\\Android\\sdk 11 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /007-动态注册native方法/local.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | 7 | # location of the SDK. This is only used by Ant 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | sdk.dir=D:\\Android\\sdk 11 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/local.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | 7 | # location of the SDK. This is only used by Ant 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | sdk.dir=D:\\Android\\sdk 11 | -------------------------------------------------------------------------------- /003-SectionEncrypt/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /004-MethodEncrypt/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /002-DexEncrypt/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /001-HiddenMethod/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /003-SectionEncrypt/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /004-MethodEncrypt/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/jni/com_demo_MainActivity.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_demo_MainActivity */ 4 | 5 | #ifndef _Included_com_demo_MainActivity 6 | #define _Included_com_demo_MainActivity 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: com_demo_MainActivity 12 | * Method: test 13 | * Signature: ()V 14 | */ 15 | JNIEXPORT void JNICALL Java_com_demo_MainActivity_test 16 | (JNIEnv *, jobject); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/jni/hello.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "com_demo_MainActivity.h" 4 | 5 | 6 | #define LOG_TAG "shuwoom" 7 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) 8 | 9 | extern "C" { 10 | char* getKey() 11 | { 12 | return "123456"; 13 | } 14 | 15 | } 16 | 17 | JNIEXPORT jstring JNICALL Java_com_demo_MainActivity_test 18 | (JNIEnv * env, jobject obj){ 19 | 20 | //////调用getKey方法,检测是否hook成功 21 | LOGI("[INFO] The key is %s\n", getKey()); 22 | return env->NewStringUTF(getKey()); 23 | } -------------------------------------------------------------------------------- /002-DexEncrypt/src/com/dexencrypt/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.dexencrypt; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.widget.Toast; 6 | 7 | public class MainActivity extends Activity { 8 | 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | setContentView(R.layout.activity_main); 13 | 14 | Security s = new Security(this.getApplicationContext()); 15 | Toast.makeText(getApplication(), s.invokeHiddenMethod(), Toast.LENGTH_SHORT).show(); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /001-HiddenMethod/src/com/hiddenmethod/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.hiddenmethod; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.widget.Toast; 6 | 7 | public class MainActivity extends Activity { 8 | 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | setContentView(R.layout.activity_main); 13 | 14 | Security s = new Security(this.getApplicationContext()); 15 | Toast.makeText(getApplication(), s.invokeHiddenMethod(), Toast.LENGTH_SHORT).show(); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /003-SectionEncrypt/jni/com_demo_MainActivity.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_demo_MainActivity */ 4 | 5 | #ifndef _Included_com_demo_MainActivity 6 | #define _Included_com_demo_MainActivity 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: com_demo_MainActivity 12 | * Method: getText 13 | * Signature: ()Ljava/lang/String; 14 | */ 15 | JNIEXPORT jstring JNICALL Java_com_demo_MainActivity_getText 16 | (JNIEnv *, jobject); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /004-MethodEncrypt/jni/com_demo_MainActivity.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_demo_MainActivity */ 4 | 5 | #ifndef _Included_com_demo_MainActivity 6 | #define _Included_com_demo_MainActivity 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: com_demo_MainActivity 12 | * Method: getText 13 | * Signature: ()Ljava/lang/String; 14 | */ 15 | JNIEXPORT jstring JNICALL Java_com_demo_MainActivity_getText 16 | (JNIEnv *, jobject); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/jni/com_demo_MainActivity.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_demo_MainActivity */ 4 | 5 | #ifndef _Included_com_demo_MainActivity 6 | #define _Included_com_demo_MainActivity 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: com_demo_MainActivity 12 | * Method: test 13 | * Signature: ()Ljava/lang/String; 14 | */ 15 | JNIEXPORT jstring JNICALL Java_com_demo_MainActivity_test 16 | (JNIEnv *, jobject); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /007-动态注册native方法/src/com/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.demo; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | public class MainActivity extends Activity 7 | { 8 | /** Called when the activity is first created. */ 9 | 10 | public native String foo(); 11 | 12 | static{ 13 | System.loadLibrary("demo"); 14 | } 15 | 16 | 17 | @Override 18 | public void onCreate(Bundle savedInstanceState) 19 | { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.main); 22 | 23 | foo(); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := substrate 5 | LOCAL_SRC_FILES := libsubstrate.so 6 | include $(PREBUILT_SHARED_LIBRARY) 7 | 8 | include $(CLEAR_VARS) 9 | LOCAL_MODULE := hello 10 | LOCAL_SRC_FILES := hello.cpp 11 | 12 | LOCAL_LDLIBS := -llog 13 | include $(BUILD_SHARED_LIBRARY) 14 | 15 | include $(CLEAR_VARS) 16 | LOCAL_MODULE := hackcodejiagu 17 | LOCAL_SRC_FILES := hackcodejiagu.cpp 18 | 19 | LOCAL_LDLIBS := -llog 20 | LOCAL_LDLIBS += -L$(LOCAL_PATH) -lsubstrate 21 | include $(BUILD_SHARED_LIBRARY) 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /002-DexEncrypt/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | -------------------------------------------------------------------------------- /001-HiddenMethod/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | -------------------------------------------------------------------------------- /003-SectionEncrypt/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | -------------------------------------------------------------------------------- /004-MethodEncrypt/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | -------------------------------------------------------------------------------- /007-动态注册native方法/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/gen/com/demo/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.demo; 9 | 10 | public final class R { 11 | public static final class attr { 12 | } 13 | public static final class drawable { 14 | public static final int ic_launcher=0x7f020000; 15 | } 16 | public static final class layout { 17 | public static final int main=0x7f030000; 18 | } 19 | public static final class string { 20 | public static final int app_name=0x7f040000; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /007-动态注册native方法/gen/com/demo/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.demo; 9 | 10 | public final class R { 11 | public static final class attr { 12 | } 13 | public static final class drawable { 14 | public static final int ic_launcher=0x7f020000; 15 | } 16 | public static final class layout { 17 | public static final int main=0x7f030000; 18 | } 19 | public static final class string { 20 | public static final int app_name=0x7f040000; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/gen/com/demo/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.demo; 9 | 10 | public final class R { 11 | public static final class attr { 12 | } 13 | public static final class drawable { 14 | public static final int ic_launcher=0x7f020000; 15 | } 16 | public static final class layout { 17 | public static final int main=0x7f030000; 18 | } 19 | public static final class string { 20 | public static final int app_name=0x7f040000; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /004-MethodEncrypt/src/com/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.demo; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.widget.TextView; 6 | 7 | public class MainActivity extends Activity 8 | { 9 | /** Called when the activity is first created. */ 10 | 11 | public native String getText(); 12 | 13 | @Override 14 | public void onCreate(Bundle savedInstanceState) 15 | { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.main); 18 | 19 | System.loadLibrary("demo"); 20 | 21 | 22 | TextView tv = (TextView) findViewById(R.id.text); 23 | tv.setText(getText()); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /003-SectionEncrypt/src/com/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.demo; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.widget.TextView; 6 | 7 | public class MainActivity extends Activity 8 | { 9 | /** Called when the activity is first created. */ 10 | 11 | public native String getText(); 12 | 13 | @Override 14 | public void onCreate(Bundle savedInstanceState) 15 | { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.main); 18 | 19 | System.loadLibrary("demo"); 20 | 21 | 22 | TextView tv = (TextView) findViewById(R.id.text); 23 | tv.setText(getText()); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/src/com/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.demo; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.widget.Toast; 6 | 7 | public class MainActivity extends Activity 8 | { 9 | /** Called when the activity is first created. */ 10 | 11 | public native void test(); 12 | 13 | @Override 14 | public void onCreate(Bundle savedInstanceState) 15 | { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.main); 18 | 19 | System.loadLibrary("demo1"); 20 | 21 | test(); 22 | 23 | Toast.makeText(this, new Test().add(2,5) + "", Toast.LENGTH_LONG).show(); 24 | 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/src/com/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.demo; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.widget.Toast; 6 | 7 | public class MainActivity extends Activity 8 | { 9 | /** Called when the activity is first created. */ 10 | static{ 11 | System.loadLibrary("hello"); 12 | 13 | } 14 | 15 | public native String test(); 16 | 17 | @Override 18 | public void onCreate(Bundle savedInstanceState) 19 | { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.main); 22 | 23 | Toast.makeText(getApplicationContext(), test(), Toast.LENGTH_LONG).show(); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /007-动态注册native方法/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /003-SectionEncrypt/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /004-MethodEncrypt/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /004-MethodEncrypt/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /007-动态注册native方法/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /003-SectionEncrypt/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /004-MethodEncrypt/bin/classes.dex.d: -------------------------------------------------------------------------------- 1 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\classes.dex : \ 2 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\classes\com\demo\BuildConfig.class \ 3 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\classes\com\demo\MainActivity.class \ 4 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\classes\com\demo\R$attr.class \ 5 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\classes\com\demo\R$drawable.class \ 6 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\classes\com\demo\R$id.class \ 7 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\classes\com\demo\R$layout.class \ 8 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\classes\com\demo\R$string.class \ 9 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\classes\com\demo\R.class \ 10 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /002-DexEncrypt/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /001-HiddenMethod/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /002-DexEncrypt/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /003-SectionEncrypt/ant.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked into Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /003-SectionEncrypt/gen/com/demo/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.demo; 9 | 10 | public final class R { 11 | public static final class attr { 12 | } 13 | public static final class drawable { 14 | public static final int ic_launcher=0x7f020000; 15 | } 16 | public static final class id { 17 | public static final int text=0x7f050000; 18 | } 19 | public static final class layout { 20 | public static final int main=0x7f030000; 21 | } 22 | public static final class string { 23 | public static final int app_name=0x7f040000; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /004-MethodEncrypt/ant.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked into Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /004-MethodEncrypt/gen/com/demo/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.demo; 9 | 10 | public final class R { 11 | public static final class attr { 12 | } 13 | public static final class drawable { 14 | public static final int ic_launcher=0x7f020000; 15 | } 16 | public static final class id { 17 | public static final int text=0x7f050000; 18 | } 19 | public static final class layout { 20 | public static final int main=0x7f030000; 21 | } 22 | public static final class string { 23 | public static final int app_name=0x7f040000; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/ant.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked into Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /007-动态注册native方法/ant.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked into Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /001-HiddenMethod/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/ant.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked into Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/src/com/demo/ProxyApplication.java: -------------------------------------------------------------------------------- 1 | package com.demo; 2 | 3 | import java.lang.ref.WeakReference; 4 | import java.util.ArrayList; 5 | import java.util.Map; 6 | 7 | import android.app.Application; 8 | import android.app.Instrumentation; 9 | import android.content.Context; 10 | import android.content.pm.ApplicationInfo; 11 | import android.util.Log; 12 | import android.widget.Toast; 13 | 14 | public class ProxyApplication extends Application{ 15 | 16 | static{ 17 | System.loadLibrary("substrate"); 18 | System.loadLibrary("hackcodejiagu"); 19 | } 20 | 21 | 22 | @Override 23 | public void onCreate() { 24 | super.onCreate(); 25 | } 26 | 27 | 28 | @Override 29 | public void attachBaseContext(Context base) { 30 | super.attachBaseContext(base); 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /002-DexEncrypt/src/com/dexencrypt/Common.java: -------------------------------------------------------------------------------- 1 | package com.dexencrypt; 2 | 3 | public class Common { 4 | 5 | public static String byteArrayToHex(byte[] byteArray) { 6 | 7 | // 首先初始化一个字符数组,用来存放每个16进制字符 8 | 9 | char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 10 | 'A', 'B', 'C', 'D', 'E', 'F' }; 11 | 12 | // new一个字符数组,这个就是用来组成结果字符串的(解释一下:一个byte是八位二进制,也就是2位十六进制字符(2的8次方等于16的2次方)) 13 | 14 | char[] resultCharArray = new char[byteArray.length * 2]; 15 | 16 | // 遍历字节数组,通过位运算(位运算效率高),转换成字符放到字符数组中去 17 | 18 | int index = 0; 19 | 20 | for (byte b : byteArray) { 21 | 22 | resultCharArray[index++] = hexDigits[b >>> 4 & 0xf]; 23 | 24 | resultCharArray[index++] = hexDigits[b & 0xf]; 25 | 26 | } 27 | 28 | // 字符数组组合成字符串返回 29 | 30 | return new String(resultCharArray); 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /002-DexEncrypt/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /001-HiddenMethod/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /003-SectionEncrypt/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /004-MethodEncrypt/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /007-动态注册native方法/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /004-MethodEncrypt/bin/NdkDemo1.ap_.d: -------------------------------------------------------------------------------- 1 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\NdkDemo1.ap_ \ 2 | : C:\cygwin64\home\guanchao\MethodEncrypt\res\drawable-hdpi\ic_launcher.png \ 3 | C:\cygwin64\home\guanchao\MethodEncrypt\res\drawable-ldpi\ic_launcher.png \ 4 | C:\cygwin64\home\guanchao\MethodEncrypt\res\drawable-mdpi\ic_launcher.png \ 5 | C:\cygwin64\home\guanchao\MethodEncrypt\res\drawable-xhdpi\ic_launcher.png \ 6 | C:\cygwin64\home\guanchao\MethodEncrypt\res\layout\main.xml \ 7 | C:\cygwin64\home\guanchao\MethodEncrypt\res\values\strings.xml \ 8 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\res\drawable-hdpi\ic_launcher.png \ 9 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\res\drawable-ldpi\ic_launcher.png \ 10 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\res\drawable-mdpi\ic_launcher.png \ 11 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\res\drawable-xhdpi\ic_launcher.png \ 12 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\AndroidManifest.xml \ 13 | -------------------------------------------------------------------------------- /004-MethodEncrypt/gen/R.java.d: -------------------------------------------------------------------------------- 1 | C:\cygwin64\home\guanchao\MethodEncrypt\gen\com\demo\R.java \ 2 | : C:\cygwin64\home\guanchao\MethodEncrypt\res\drawable-hdpi\ic_launcher.png \ 3 | C:\cygwin64\home\guanchao\MethodEncrypt\res\drawable-ldpi\ic_launcher.png \ 4 | C:\cygwin64\home\guanchao\MethodEncrypt\res\drawable-mdpi\ic_launcher.png \ 5 | C:\cygwin64\home\guanchao\MethodEncrypt\res\drawable-xhdpi\ic_launcher.png \ 6 | C:\cygwin64\home\guanchao\MethodEncrypt\res\layout\main.xml \ 7 | C:\cygwin64\home\guanchao\MethodEncrypt\res\values\strings.xml \ 8 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\res\drawable-hdpi\ic_launcher.png \ 9 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\res\drawable-ldpi\ic_launcher.png \ 10 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\res\drawable-mdpi\ic_launcher.png \ 11 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\res\drawable-xhdpi\ic_launcher.png \ 12 | C:\cygwin64\home\guanchao\MethodEncrypt\bin\AndroidManifest.xml \ 13 | -------------------------------------------------------------------------------- /002-DexEncrypt/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | DexEncrypt 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /002-DexEncrypt/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /001-HiddenMethod/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | HiddenMethod 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /001-HiddenMethod/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /002-DexEncrypt/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /003-SectionEncrypt/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainActivity 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /004-MethodEncrypt/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainActivity 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /001-HiddenMethod/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /shellTools/elf_parser.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "elf.h" 5 | 6 | static unsigned elfhash(const char *_name); 7 | int getSymbolAddr(Elf32_Ehdr ehdr, FILE *file, const char *name, Elf32_Sym *targetSym); 8 | int getSectionAddr(Elf32_Shdr *shdr_tab, int shnum, char *strtab, const char *section_name); 9 | 10 | // Elf32_Shdr* getSectionAddr(Elf32_Ehdr *ehdr, Elf32_Shdr *shdr, char* strtab, char* section_name); 11 | 12 | // Elf32_Shdr* getSectionAddr(Elf32_Ehdr ehdr, , char* strtab, char* section_name){ 13 | // int i; 14 | // Elf32_Shdr *shdr; 15 | // shdr = (Elf32_Shdr*)() 16 | // for(i = 0; i < ehdr.e_shnum; ++i, shdr++){ 17 | // if(strcmp(section_name, strtab + shdr->sh_name) == 0){ 18 | 19 | // return shdr; 20 | // } 21 | // } 22 | // return NULL; 23 | // } 24 | 25 | 26 | // char* getStringTableAddr(char* base){ 27 | // printf("\n=================== String Table ===================\n"); 28 | // char* strtab = NULL; 29 | // int i; 30 | 31 | // strtab = (char*)(base + (shdr + ehdr->e_shstrndx)->sh_offset); 32 | // return strtab; 33 | // } -------------------------------------------------------------------------------- /007-动态注册native方法/jni/demo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static jstring abcdefg(JNIEnv* env){ 7 | __android_log_print(ANDROID_LOG_INFO, "JNITag", "call abcdefg()!!\n"); 8 | return (*env) -> NewStringUTF(env, "native function!"); 9 | }; 10 | 11 | #define JNIREG_CLASS "com/demo/MainActivity" 12 | 13 | static JNINativeMethod gMethods[] = 14 | { 15 | {"foo", "()Ljava/lang/String;", (void*)abcdefg} 16 | }; 17 | 18 | static int registerNativeMethods(JNIEnv* env, const char* className, 19 | JNINativeMethod* gMethods, int numMethods) 20 | { 21 | jclass clazz; 22 | clazz = (*env)->FindClass(env, className); 23 | if(clazz == NULL) 24 | return JNI_FALSE; 25 | 26 | if((*env)->RegisterNatives(env, clazz, gMethods, numMethods) < 0) 27 | return JNI_FALSE; 28 | 29 | return JNI_TRUE; 30 | } 31 | 32 | static int registerNatives(JNIEnv* env) 33 | { 34 | if(!registerNativeMethods(env, JNIREG_CLASS, gMethods, sizeof(gMethods)/sizeof(gMethods[0]))) 35 | return JNI_FALSE; 36 | return JNI_TRUE; 37 | } 38 | 39 | JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM*vm, void* reserved) 40 | { 41 | JNIEnv* env = NULL; 42 | jint result = -1; 43 | 44 | if( (*vm)->GetEnv(vm, (void**)&env, JNI_VERSION_1_4) != JNI_OK) 45 | return -1; 46 | 47 | if(env == NULL) 48 | return -1; 49 | 50 | if(!registerNatives(env)) 51 | return -1; 52 | 53 | result = JNI_VERSION_1_4; 54 | __android_log_print(ANDROID_LOG_INFO, "JNITag", "pid = %d\n", getpid()); 55 | return result; 56 | 57 | } 58 | 59 | JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved){ 60 | JNIEnv* env = NULL; 61 | 62 | if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_4) != JNI_OK) { 63 | return; 64 | } 65 | (*env) -> UnregisterNatives(env, JNIREG_CLASS); 66 | } 67 | -------------------------------------------------------------------------------- /002-DexEncrypt/gen/com/dexencrypt/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.dexencrypt; 9 | 10 | public final class R { 11 | public static final class attr { 12 | } 13 | public static final class dimen { 14 | /** Default screen margins, per the Android Design guidelines. 15 | 16 | Example customization of dimensions originally defined in res/values/dimens.xml 17 | (such as screen margins) for screens with more than 820dp of available width. This 18 | would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). 19 | 20 | */ 21 | public static final int activity_horizontal_margin=0x7f040000; 22 | public static final int activity_vertical_margin=0x7f040001; 23 | } 24 | public static final class drawable { 25 | public static final int ic_launcher=0x7f020000; 26 | } 27 | public static final class id { 28 | public static final int action_settings=0x7f080000; 29 | } 30 | public static final class layout { 31 | public static final int activity_main=0x7f030000; 32 | } 33 | public static final class menu { 34 | public static final int main=0x7f070000; 35 | } 36 | public static final class string { 37 | public static final int action_settings=0x7f050002; 38 | public static final int app_name=0x7f050000; 39 | public static final int hello_world=0x7f050001; 40 | } 41 | public static final class style { 42 | /** 43 | Base application theme, dependent on API level. This theme is replaced 44 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 45 | 46 | 47 | Theme customizations available in newer API levels can go in 48 | res/values-vXX/styles.xml, while customizations related to 49 | backward-compatibility can go here. 50 | 51 | 52 | Base application theme for API 11+. This theme completely replaces 53 | AppBaseTheme from res/values/styles.xml on API 11+ devices. 54 | 55 | API 11 theme customizations can go here. 56 | 57 | Base application theme for API 14+. This theme completely replaces 58 | AppBaseTheme from BOTH res/values/styles.xml and 59 | res/values-v11/styles.xml on API 14+ devices. 60 | 61 | API 14 theme customizations can go here. 62 | */ 63 | public static final int AppBaseTheme=0x7f060000; 64 | /** Application theme. 65 | All customizations that are NOT specific to a particular API-level can go here. 66 | */ 67 | public static final int AppTheme=0x7f060001; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /001-HiddenMethod/gen/com/hiddenmethod/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.hiddenmethod; 9 | 10 | public final class R { 11 | public static final class attr { 12 | } 13 | public static final class dimen { 14 | /** Default screen margins, per the Android Design guidelines. 15 | 16 | Example customization of dimensions originally defined in res/values/dimens.xml 17 | (such as screen margins) for screens with more than 820dp of available width. This 18 | would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). 19 | 20 | */ 21 | public static final int activity_horizontal_margin=0x7f040000; 22 | public static final int activity_vertical_margin=0x7f040001; 23 | } 24 | public static final class drawable { 25 | public static final int ic_launcher=0x7f020000; 26 | } 27 | public static final class id { 28 | public static final int action_settings=0x7f080000; 29 | } 30 | public static final class layout { 31 | public static final int activity_main=0x7f030000; 32 | } 33 | public static final class menu { 34 | public static final int main=0x7f070000; 35 | } 36 | public static final class string { 37 | public static final int action_settings=0x7f050002; 38 | public static final int app_name=0x7f050000; 39 | public static final int hello_world=0x7f050001; 40 | } 41 | public static final class style { 42 | /** 43 | Base application theme, dependent on API level. This theme is replaced 44 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 45 | 46 | 47 | Theme customizations available in newer API levels can go in 48 | res/values-vXX/styles.xml, while customizations related to 49 | backward-compatibility can go here. 50 | 51 | 52 | Base application theme for API 11+. This theme completely replaces 53 | AppBaseTheme from res/values/styles.xml on API 11+ devices. 54 | 55 | API 11 theme customizations can go here. 56 | 57 | Base application theme for API 14+. This theme completely replaces 58 | AppBaseTheme from BOTH res/values/styles.xml and 59 | res/values-v11/styles.xml on API 14+ devices. 60 | 61 | API 14 theme customizations can go here. 62 | */ 63 | public static final int AppBaseTheme=0x7f060000; 64 | /** Application theme. 65 | All customizations that are NOT specific to a particular API-level can go here. 66 | */ 67 | public static final int AppTheme=0x7f060001; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/jni/hackcodejiagu.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "substrate.h" 4 | 5 | #define LOG_TAG "shuwoom" 6 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) 7 | 8 | void* lookup_symbol(char* libraryname,char* symbolname) 9 | { 10 | //获取so库的句柄 11 | void *handle = dlopen(libraryname, RTLD_GLOBAL | RTLD_NOW); 12 | if (handle != NULL){ 13 | LOGI("[INFO] open %s success!", libraryname); 14 | void* symbol = dlsym(handle, symbolname); 15 | if (symbol != NULL){ 16 | LOGI("[INFO] Find symbol %s:0x%x success!", symbolname, symbol); 17 | return symbol; 18 | }else{ 19 | LOGI("[INFO] Find symbol %s failed!", symbolname); 20 | return NULL; 21 | } 22 | }else{ 23 | LOGI("[INFO] open %s failed!", libraryname); 24 | return NULL; 25 | } 26 | } 27 | 28 | //原函数 29 | char* (*getKey_old)(); 30 | 31 | //实际hook后调用的函数 32 | char* getKey_new() 33 | { 34 | LOGI("[INFO] The original function return:%s\n", getKey_old()); 35 | LOGI("[INFO] Hooked by libhackcodejiagu.so! Redirected to getKey_new()"); 36 | 37 | return "654321"; 38 | } 39 | 40 | /** 41 | //检测系统函数是否可以hook 42 | int(*gettimeofday_f)(struct timeval*tv, struct timezone *tz); 43 | 44 | int gettimeofday_hook(struct timeval*tv, struct timezone *tz) 45 | { 46 | LOGI("hook libc function:gettimeofday success!"); 47 | return gettimeofday_f(tv,tz); 48 | } 49 | 50 | void test_hook_system_function1() 51 | { 52 | 53 | void* sym = lookup_symbol("/system/lib/libc.so","gettimeofday"); 54 | if(sym != NULL) 55 | { 56 | MSHookFunction((void *)sym, (void*)gettimeofday_hook, (void**)&gettimeofday_f); 57 | } 58 | 59 | } 60 | */ 61 | 62 | 63 | /* 64 | //检测系统函数是否可以hook 65 | //void* mmap(void *addr, size_t size, int prot, int flags, int fd, long offset) 66 | void* (*mmap_f)(void *addr, size_t size, int prot, int flags, int fd, long offset); 67 | 68 | void* mmap_hook(void *addr, size_t size, int prot, int flags, int fd, long offset) 69 | { 70 | LOGI("hook libc function:mmap success!"); 71 | return mmap_f(addr, size, prot, flags, fd, offset); 72 | } 73 | 74 | void test_hook_system_function2() 75 | { 76 | 77 | void* sym = lookup_symbol("/system/lib/libc.so","mmap"); 78 | if(sym != NULL) 79 | { 80 | MSHookFunction((void *)sym, (void*)mmap_hook, (void**)&mmap_f); 81 | } 82 | 83 | } 84 | */ 85 | 86 | 87 | JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) 88 | { 89 | LOGI("In JNI_OnLoad()..."); 90 | ///////hook getKey方法,并重定向到getKey_new方法 91 | void* sym = lookup_symbol("/data/data/com.demo/lib/libhello.so","getKey"); 92 | if(sym != NULL) 93 | { 94 | MSHookFunction((void*)sym, (void*)getKey_new, (void**)&getKey_old); 95 | } 96 | 97 | //检测系统函数是否可以hook(测试正常) 98 | //test_hook_system_function1(); 99 | //test_hook_system_function2(); 100 | 101 | return JNI_VERSION_1_4; 102 | } 103 | 104 | -------------------------------------------------------------------------------- /shellTools/elf_tools.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "elf.h" 5 | #include "elf_tools.h" 6 | 7 | void encryptFunction(const char *output_filename, Elf32_Ehdr ehdr, FILE *file, long file_size, const char *name, Elf32_Sym *targetSym){ 8 | if(getSymbolAddr(ehdr, file, name, targetSym) != 0){ 9 | printf("Get symbol address error...\n"); 10 | return ; 11 | } 12 | 13 | //1.申请一个同样大小的内存空间用于保存修改后的文件 14 | char *base; 15 | int i; 16 | 17 | base = (char*)malloc(file_size); 18 | if(base == NULL){ 19 | printf("Malloc file error...\n"); 20 | return; 21 | } 22 | 23 | fseek(file, 0, SEEK_SET); 24 | if(fread(base, 1, file_size, file) != file_size){ 25 | printf("Read file content error...\n"); 26 | return; 27 | } 28 | //加密处理 29 | for(i = 0; i < targetSym->st_size; i++){ 30 | char *addr = (char*)(base + targetSym->st_value + i); 31 | *addr = ~(*addr); 32 | } 33 | 34 | FILE* fout; 35 | fout = fopen(output_filename, "wb"); 36 | if(fout == NULL){ 37 | printf("Open file error..."); 38 | } 39 | 40 | fseek(fout, 0, SEEK_SET); 41 | if(fwrite(base, 1, file_size, fout) != file_size){ 42 | printf("Write error..."); 43 | } 44 | 45 | printf("Encrypt function \"%s\" successfully!\n", name); 46 | fclose(fout); 47 | free(base); 48 | } 49 | 50 | 51 | void encryptSection(const char *output_filename, Elf32_Shdr *shdr_tab, int shnum, char *strtab, FILE* file, const char *section_name){ 52 | Elf32_Ehdr *ehdr; 53 | Elf32_Shdr *target_shdr = NULL; 54 | char *section_addr; 55 | char *base; 56 | int i, shndx, file_size; 57 | unsigned int length, page_size; 58 | 59 | shndx = getSectionAddr(shdr_tab, shnum, strtab, section_name); 60 | if(shndx == -1){ 61 | printf("Can not find secction: %s\n", section_name); 62 | return; 63 | } 64 | 65 | length = shdr_tab[shndx].sh_size; 66 | printf("\n[Info] Find section \"%s\": 0x%x, size=0x%d\n", section_name, shdr_tab[shndx].sh_offset, length); 67 | 68 | fseek(file, 0, SEEK_END); 69 | file_size = ftell(file); 70 | rewind(file); 71 | 72 | base = (char*)malloc(file_size); 73 | if(base == NULL){ 74 | printf("Malloc memorry error..."); 75 | return ; 76 | } 77 | ehdr = (Elf32_Ehdr*)base; 78 | 79 | 80 | fseek(file, 0, SEEK_SET); 81 | if(fread(base, 1, file_size, file) != file_size){ 82 | printf("Read file error!\n"); 83 | return; 84 | } 85 | 86 | //TODO 加密处理 87 | unsigned long text_addr = (unsigned long)base + shdr_tab[shndx].sh_offset; 88 | for(i = 0; i < length; i++){ 89 | char *addr = (char*)(text_addr + i); 90 | *addr = ~(*addr); 91 | } 92 | //由于是dynamic link library,内存中的elf header,其中e_shoff和e_entry是不用的,这里用来保存.mytext的地址 93 | page_size = shdr_tab[shndx].sh_offset / 4096 + (shdr_tab[shndx].sh_offset % 4096 == 0 ? 0 : 1); 94 | ehdr->e_shoff = shdr_tab[shndx].sh_offset; 95 | ehdr->e_entry = (length << 16) + page_size; 96 | 97 | FILE* fout; 98 | fout = fopen(output_filename, "wb"); 99 | if(fout == NULL){ 100 | printf("Open file error..."); 101 | } 102 | 103 | fseek(fout, 0, SEEK_SET); 104 | if(fwrite(base, 1, file_size, fout) != file_size){ 105 | printf("Write error..."); 106 | } 107 | 108 | printf("Encrypt section \"%s\" successfully!\n", section_name); 109 | free(base); 110 | fclose(fout); 111 | } -------------------------------------------------------------------------------- /002-DexEncrypt/src/com/dexencrypt/DESUtils.java: -------------------------------------------------------------------------------- 1 | package com.dexencrypt; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileOutputStream; 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | import java.io.OutputStream; 9 | import java.security.Key; 10 | 11 | import javax.crypto.Cipher; 12 | import javax.crypto.KeyGenerator; 13 | import javax.crypto.SecretKey; 14 | import javax.crypto.SecretKeyFactory; 15 | import javax.crypto.spec.DESKeySpec; 16 | 17 | public class DESUtils { 18 | 19 | public static final String KEY_ALGORITHM = "DES"; 20 | public static final String CIPHER_ALGORITHM = "DES/ECB/PKCS5Padding"; 21 | 22 | public static void main(String[] args) throws Exception { 23 | String inputStr = "DES"; 24 | byte[] inputData = inputStr.getBytes(); 25 | System.err.println("原文:\t" + inputStr); 26 | 27 | //初始化密钥 28 | byte[] key = initKey(); 29 | System.err.println("加密后:\t" + Common.byteArrayToHex(key)); 30 | 31 | //加密 32 | inputData = encrypt(inputData, key); 33 | System.err.println("加密后:\t" + Common.byteArrayToHex(inputData)); 34 | 35 | //解密 36 | byte[] outputData = decrypt(inputData, key); 37 | String outputStr = new String(outputData); 38 | System.err.println("解密后:\t" + outputStr); 39 | 40 | } 41 | 42 | public static byte[] decryptDexFile(InputStream input, int dexLength) { 43 | try { 44 | byte[] encryptedData = new byte[dexLength]; 45 | input.read(encryptedData); 46 | input.close(); 47 | 48 | //解密dex文件字节流 49 | byte[] key = "26798CE99E68B6E9".getBytes(); 50 | byte[] decryptedData = decrypt(encryptedData, key); 51 | 52 | return decryptedData; 53 | } catch (Exception e) { 54 | // TODO Auto-generated catch block 55 | e.printStackTrace(); 56 | } 57 | return null; 58 | } 59 | 60 | /** 61 | * 转换密钥 62 | * @param key 63 | * @return 64 | * @throws Exception 65 | */ 66 | private static Key toKey(byte[] key) throws Exception{ 67 | DESKeySpec dks = new DESKeySpec(key); 68 | SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(KEY_ALGORITHM); 69 | SecretKey secretKey = keyFactory.generateSecret(dks); 70 | 71 | return secretKey; 72 | } 73 | 74 | /** 75 | * 待解密数据 76 | * @param data 77 | * @param key 78 | * @return 79 | * @throws Exception 80 | */ 81 | public static byte[] decrypt(byte[] data, byte[]key) throws Exception{ 82 | Key k = toKey(key); 83 | Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM); 84 | cipher.init(Cipher.DECRYPT_MODE, k); 85 | return cipher.doFinal(data); 86 | } 87 | 88 | /** 89 | * 待加密数据 90 | * @param data 91 | * @param key 92 | * @return 93 | * @throws Exception 94 | */ 95 | public static byte[]encrypt(byte[] data, byte[] key) throws Exception{ 96 | Key k = toKey(key); 97 | Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM); 98 | cipher.init(Cipher.ENCRYPT_MODE, k); 99 | return cipher.doFinal(data); 100 | } 101 | 102 | /** 103 | * 生成密钥 104 | * @return 105 | * @throws Exception 106 | */ 107 | public static byte[]initKey() throws Exception{ 108 | KeyGenerator kg = KeyGenerator.getInstance(KEY_ALGORITHM); 109 | kg.init(56); 110 | SecretKey secretKey = kg.generateKey(); 111 | return secretKey.getEncoded(); 112 | } 113 | } -------------------------------------------------------------------------------- /006-通过hook重定向native方法/obj/local/armeabi/objs-debug/hello/hello.o.d: -------------------------------------------------------------------------------- 1 | obj/local/armeabi/objs-debug/hello/hello.o: jni/hello.cpp \ 2 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/log.h \ 3 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdio.h \ 4 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs.h \ 5 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs_elf.h \ 6 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/api-level.h \ 7 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/types.h \ 8 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdint.h \ 9 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/_types.h \ 10 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/_types.h \ 11 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/posix_types.h \ 12 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/stddef.h \ 13 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/compiler.h \ 14 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/posix_types.h \ 15 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/types.h \ 16 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/types.h \ 17 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/kernel.h \ 18 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysmacros.h \ 19 | jni/com_demo_MainActivity.h \ 20 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/jni.h 21 | 22 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/log.h: 23 | 24 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdio.h: 25 | 26 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs.h: 27 | 28 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs_elf.h: 29 | 30 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/api-level.h: 31 | 32 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/types.h: 33 | 34 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdint.h: 35 | 36 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/_types.h: 37 | 38 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/_types.h: 39 | 40 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/posix_types.h: 41 | 42 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/stddef.h: 43 | 44 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/compiler.h: 45 | 46 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/posix_types.h: 47 | 48 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/types.h: 49 | 50 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/types.h: 51 | 52 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/kernel.h: 53 | 54 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysmacros.h: 55 | 56 | jni/com_demo_MainActivity.h: 57 | 58 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/jni.h: 59 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/jni/mycommon.h: -------------------------------------------------------------------------------- 1 | #ifndef DALVIK_COMMON_H_ 2 | #define DALVIK_COMMON_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define RTLD_LAZY 1 10 | static union { char c[4]; unsigned long mylong; }endian_test = {{ 'l', '?', '?', 'b' } }; 11 | #define ENDIANNESS ((char)endian_test.mylong) 12 | 13 | //#if ENDIANNESS == "l" 14 | #define HAVE_LITTLE_ENDIAN 15 | //#else 16 | //#define HAVE_BIG_ENDIAN 17 | //#endif 18 | 19 | #if defined(HAVE_ENDIAN_H) 20 | # include 21 | #else /*not HAVE_ENDIAN_H*/ 22 | # define __BIG_ENDIAN 4321 23 | # define __LITTLE_ENDIAN 1234 24 | # if defined(HAVE_LITTLE_ENDIAN) 25 | # define __BYTE_ORDER __LITTLE_ENDIAN 26 | # else 27 | # define __BYTE_ORDER __BIG_ENDIAN 28 | # endif 29 | #endif /*not HAVE_ENDIAN_H*/ 30 | 31 | #if !defined(NDEBUG) && defined(WITH_DALVIK_ASSERT) 32 | # undef assert 33 | # define assert(x) \ 34 | ((x) ? ((void)0) : (ALOGE("ASSERT FAILED (%s:%d): %s", \ 35 | __FILE__, __LINE__, #x), *(int*)39=39, (void)0) ) 36 | #endif 37 | 38 | #define MIN(x,y) (((x) < (y)) ? (x) : (y)) 39 | #define MAX(x,y) (((x) > (y)) ? (x) : (y)) 40 | 41 | #define LIKELY(exp) (__builtin_expect((exp) != 0, true)) 42 | #define UNLIKELY(exp) (__builtin_expect((exp) != 0, false)) 43 | 44 | #define ALIGN_UP(x, n) (((size_t)(x) + (n) - 1) & ~((n) - 1)) 45 | #define ALIGN_DOWN(x, n) ((size_t)(x) & -(n)) 46 | #define ALIGN_UP_TO_PAGE_SIZE(p) ALIGN_UP(p, SYSTEM_PAGE_SIZE) 47 | #define ALIGN_DOWN_TO_PAGE_SIZE(p) ALIGN_DOWN(p, SYSTEM_PAGE_SIZE) 48 | 49 | #define CLZ(x) __builtin_clz(x) 50 | 51 | /* 52 | * If "very verbose" logging is enabled, make it equivalent to ALOGV. 53 | * Otherwise, make it disappear. 54 | * 55 | * Define this above the #include "Dalvik.h" to enable for only a 56 | * single file. 57 | */ 58 | /* #define VERY_VERBOSE_LOG */ 59 | #if defined(VERY_VERBOSE_LOG) 60 | # define LOGVV ALOGV 61 | # define IF_LOGVV() IF_ALOGV() 62 | #else 63 | # define LOGVV(...) ((void)0) 64 | # define IF_LOGVV() if (false) 65 | #endif 66 | 67 | 68 | /* 69 | * These match the definitions in the VM specification. 70 | */ 71 | typedef uint8_t u1; 72 | typedef uint16_t u2; 73 | typedef uint32_t u4; 74 | typedef uint64_t u8; 75 | typedef int8_t s1; 76 | typedef int16_t s2; 77 | typedef int32_t s4; 78 | typedef int64_t s8; 79 | 80 | /* 81 | * Storage for primitive types and object references. 82 | * 83 | * Some parts of the code (notably object field access) assume that values 84 | * are "left aligned", i.e. given "JValue jv", "jv.i" and "*((s4*)&jv)" 85 | * yield the same result. This seems to be guaranteed by gcc on big- and 86 | * little-endian systems. 87 | */ 88 | 89 | #define OFFSETOF_MEMBER(t, f) \ 90 | (reinterpret_cast( \ 91 | &reinterpret_cast(16)->f) - \ 92 | reinterpret_cast(16)) 93 | 94 | #define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0]))) 95 | 96 | union JValue { 97 | #if defined(HAVE_LITTLE_ENDIAN) 98 | u1 z; 99 | s1 b; 100 | u2 c; 101 | s2 s; 102 | s4 i; 103 | s8 j; 104 | float f; 105 | double d; 106 | void* l; 107 | #endif 108 | #if defined(HAVE_BIG_ENDIAN) 109 | struct { 110 | u1_z[3]; 111 | u1z; 112 | }; 113 | struct { 114 | s1_b[3]; 115 | s1b; 116 | }; 117 | struct { 118 | u2_c; 119 | u2c; 120 | }; 121 | struct { 122 | s2_s; 123 | s2s; 124 | }; 125 | s4 i; 126 | s8 j; 127 | float f; 128 | double d; 129 | void* l; 130 | #endif 131 | }; 132 | 133 | /* 134 | * Array objects have these additional fields. 135 | * 136 | * We don't currently store the size of each element. Usually it's implied 137 | * by the instruction. If necessary, the width can be derived from 138 | * the first char of obj->clazz->descriptor. 139 | */ 140 | typedef struct { 141 | void*clazz; 142 | u4 lock; 143 | u4 length; 144 | u1* contents; 145 | }ArrayObject ; 146 | 147 | #endif // DALVIK_COMMON_H_ 148 | -------------------------------------------------------------------------------- /001-HiddenMethod/src/com/hiddenmethod/Security.java: -------------------------------------------------------------------------------- 1 | package com.hiddenmethod; 2 | 3 | import java.io.InputStream; 4 | import java.lang.reflect.Method; 5 | import java.security.MessageDigest; 6 | import java.util.zip.Adler32; 7 | 8 | import android.content.Context; 9 | import android.content.res.AssetManager; 10 | 11 | public class Security { 12 | private Context context; 13 | 14 | public Security(Context context){ 15 | this.context = context; 16 | } 17 | 18 | public String invokeHiddenMethod(){ 19 | int dexlength = 612; 20 | byte[]dexFile = new byte[dexlength]; 21 | AssetManager assetManager = this.context.getAssets(); 22 | try { 23 | InputStream localInputStream = assetManager.open("Test.modified.dex"); 24 | dexlength = localInputStream.read(dexFile, 0, dexlength); 25 | 26 | //Step1:修改方法A的DexMethod,方法A的DexMethod的偏移地址為:0x1d4 27 | int offset = 0x1d4; 28 | dexFile[offset++]=1; //methodIdx 29 | dexFile[offset++]=1; //accessFlags 30 | dexFile[offset++]=(byte)0x9c; //codeOff 31 | dexFile[offset++]=(byte)0x02; //codeOff 32 | 33 | //Step2:重新計算signature(SHA1) 34 | calcSignature(dexFile); 35 | 36 | //Step3:重新計算checksum 37 | calcChecksum(dexFile); 38 | 39 | //Step4:通過反射調用隱藏的方法methodA 40 | Class dexFileClass = context.getClassLoader().loadClass("dalvik.system.DexFile"); 41 | Method[] arrayOfMethod = Class.forName("dalvik.system.DexFile").getDeclaredMethods(); 42 | Method openDexFileMethod = null; 43 | Method defineCLassMethod = null; 44 | int cookie = 0; 45 | 46 | for(int i = 0; i < arrayOfMethod.length; i++){ 47 | //private native static int openDexFile(byte[] fileContents) 48 | if(arrayOfMethod[i].getName().equalsIgnoreCase("openDexFile") && arrayOfMethod[i].getParameterTypes().length == 1){ 49 | openDexFileMethod = arrayOfMethod[i]; 50 | openDexFileMethod.setAccessible(true); 51 | } 52 | 53 | // private native static Class defineClass(String name, ClassLoader loader, int cookie) 54 | if(arrayOfMethod[i].getName().equalsIgnoreCase("defineClass") && arrayOfMethod[i].getParameterTypes().length == 3){ 55 | defineCLassMethod = arrayOfMethod[i]; 56 | defineCLassMethod.setAccessible(true); 57 | } 58 | } 59 | 60 | Object[] arrayOfObject = new Object[1]; 61 | arrayOfObject[0] = dexFile; 62 | 63 | if(openDexFileMethod != null){ 64 | cookie = ((Integer) openDexFileMethod.invoke(dexFileClass, arrayOfObject)).intValue(); 65 | } 66 | 67 | Object[] params = new Object[3]; 68 | params[0] = "Test"; 69 | params[1] = dexFileClass.getClassLoader(); 70 | params[2] = Integer.valueOf(cookie); 71 | 72 | Class clazz = null; 73 | if(defineCLassMethod != null){ 74 | clazz = (Class) defineCLassMethod.invoke(dexFileClass, params); 75 | } 76 | Method methodA = null; 77 | Method[] allMethods = clazz.getDeclaredMethods(); 78 | 79 | for(int i = 0; i> 8); 115 | dexFile[10] = (byte)(sum >> 16); 116 | dexFile[11] = (byte)(sum >> 24); 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /002-DexEncrypt/src/com/dexencrypt/Security.java: -------------------------------------------------------------------------------- 1 | package com.dexencrypt; 2 | 3 | import java.io.InputStream; 4 | import java.lang.reflect.Method; 5 | import java.security.MessageDigest; 6 | import java.util.zip.Adler32; 7 | 8 | import android.content.Context; 9 | import android.content.res.AssetManager; 10 | import android.util.Log; 11 | 12 | public class Security { 13 | private Context context; 14 | 15 | public Security(Context context){ 16 | this.context = context; 17 | } 18 | 19 | public String invokeHiddenMethod(){ 20 | int dexlength = 616; 21 | AssetManager assetManager = this.context.getAssets(); 22 | try { 23 | InputStream encryptedStream = assetManager.open("Test.modified.encrypted.dex"); 24 | byte[]dexFile = DESUtils.decryptDexFile(encryptedStream, dexlength); 25 | 26 | //Step1:修改方法A的DexMethod,方法A的DexMethod的偏移地址為:0x1d4 27 | int offset = 0x1d4; 28 | dexFile[offset++]=1; //methodIdx 29 | dexFile[offset++]=1; //accessFlags 30 | dexFile[offset++]=(byte)0x9c; //codeOff 31 | dexFile[offset++]=(byte)0x02; //codeOff 32 | 33 | //Step2:重新計算signature(SHA1) 34 | calcSignature(dexFile); 35 | 36 | //Step3:重新計算checksum 37 | calcChecksum(dexFile); 38 | 39 | //Step4:通過反射調用隱藏的方法methodA 40 | Class dexFileClass = context.getClassLoader().loadClass("dalvik.system.DexFile"); 41 | Method[] arrayOfMethod = Class.forName("dalvik.system.DexFile").getDeclaredMethods(); 42 | Method openDexFileMethod = null; 43 | Method defineCLassMethod = null; 44 | int cookie = 0; 45 | 46 | for(int i = 0; i < arrayOfMethod.length; i++){ 47 | //private native static int openDexFile(byte[] fileContents) 48 | if(arrayOfMethod[i].getName().equalsIgnoreCase("openDexFile") && arrayOfMethod[i].getParameterTypes().length == 1){ 49 | openDexFileMethod = arrayOfMethod[i]; 50 | openDexFileMethod.setAccessible(true); 51 | } 52 | 53 | // private native static Class defineClass(String name, ClassLoader loader, int cookie) 54 | if(arrayOfMethod[i].getName().equalsIgnoreCase("defineClass") && arrayOfMethod[i].getParameterTypes().length == 3){ 55 | defineCLassMethod = arrayOfMethod[i]; 56 | defineCLassMethod.setAccessible(true); 57 | } 58 | } 59 | 60 | Object[] arrayOfObject = new Object[1]; 61 | arrayOfObject[0] = dexFile; 62 | 63 | if(openDexFileMethod != null){ 64 | cookie = ((Integer) openDexFileMethod.invoke(dexFileClass, arrayOfObject)).intValue(); 65 | } 66 | 67 | Object[] params = new Object[3]; 68 | params[0] = "Test"; 69 | params[1] = dexFileClass.getClassLoader(); 70 | params[2] = Integer.valueOf(cookie); 71 | 72 | Class clazz = null; 73 | if(defineCLassMethod != null){ 74 | clazz = (Class) defineCLassMethod.invoke(dexFileClass, params); 75 | } 76 | Method methodA = null; 77 | Method[] allMethods = clazz.getDeclaredMethods(); 78 | 79 | for(int i = 0; i> 8); 115 | dexFile[10] = (byte)(sum >> 16); 116 | dexFile[11] = (byte)(sum >> 24); 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /004-MethodEncrypt/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 49 | 50 | 51 | 52 | 56 | 57 | 69 | 70 | 71 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /007-动态注册native方法/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 49 | 50 | 51 | 52 | 56 | 57 | 69 | 70 | 71 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /003-SectionEncrypt/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 49 | 50 | 51 | 52 | 56 | 57 | 69 | 70 | 71 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /005-Dalvik运行时篡改字节码/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 49 | 50 | 51 | 52 | 56 | 57 | 69 | 70 | 71 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 49 | 50 | 51 | 52 | 56 | 57 | 69 | 70 | 71 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /003-SectionEncrypt/jni/demo.cpp: -------------------------------------------------------------------------------- 1 | #include "com_demo_MainActivity.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | #define LOG_TAG "AndroidNDK" 12 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) 13 | 14 | 15 | jstring getString(JNIEnv*) __attribute__((section(".mytext"))); 16 | jstring getString(JNIEnv* env){ 17 | return env->NewStringUTF("Native method return!"); 18 | } 19 | 20 | /** 21 | __attribute__((constructor)表示init_security()函数放在.init section。 22 | .init相当于初始化,比JNI_ONLOAD早执行。 23 | 所以在这里要对加密的section进行解密操作 24 | **/ 25 | void init_security() __attribute__((constructor)); 26 | 27 | unsigned long getLibAddress(char *name); 28 | void decryptSection(char* section_addr, unsigned int length); 29 | // void printELFHeader(Elf32_Ehdr* ehdr); 30 | 31 | void init_security(){ 32 | LOGI("----------------init_security()---------------------"); 33 | //TODO 解密 34 | char name[] = "libdemo.so"; 35 | Elf32_Ehdr *ehdr; 36 | char *target_section_addr; 37 | Elf32_Phdr *phdr; 38 | unsigned long base; 39 | int i = 0; 40 | unsigned int length, page_size; 41 | 42 | //Step1:首先获取目标so在内存中的起始地址 43 | base = getLibAddress(name); 44 | if(base != 0){ 45 | LOGI("%s address=0x%x", name, base); 46 | ehdr = (Elf32_Ehdr*)base; 47 | 48 | //Step2:获取加密section的内存地址、section大小和section占用的页大小 49 | target_section_addr = (char*)(base + ehdr->e_shoff); 50 | length = ehdr->e_entry >> 16; 51 | page_size = ehdr->e_entry & 0xffff; 52 | 53 | LOGI("e_entry=%x\n", ehdr->e_entry); 54 | LOGI("text_addr=0x%x,0x%x\n", ehdr->e_shoff, target_section_addr); 55 | LOGI("section size=%d, page size=%d\n", length, page_size); 56 | 57 | //解密前的section 58 | // for(i = 0; i < length; i++){ 59 | // char *addr = (char*)(target_section_addr + i); 60 | // LOGI("[#%d]%x=>%x", i, addr, *addr); 61 | // } 62 | 63 | //Step3:修改目标section所在内存区域为可写 64 | if(mprotect((void*)base, 4096 * page_size, PROT_READ | PROT_EXEC | PROT_WRITE) != 0){ 65 | LOGI("mprotect 1 error..."); 66 | } 67 | 68 | //Step4:对目标section解密 69 | decryptSection(target_section_addr, length); 70 | 71 | //Step4:回复目标section所在区域为不可写 72 | if(mprotect((void*)base, 4096 * page_size, PROT_READ | PROT_EXEC) != 0){ 73 | LOGI("mprotect 2 error..."); 74 | } 75 | 76 | } 77 | LOGI("----------------init_security() Done---------------------"); 78 | } 79 | 80 | void decryptSection(char* section_addr, unsigned int length){ 81 | int i; 82 | for(i = 0; i < length; i++){ 83 | char *addr = (char*)(section_addr + i); 84 | *addr = ~(*addr); 85 | // LOGI("[#%d]%x=>%x", i, addr, *addr); 86 | } 87 | } 88 | 89 | //获取so加载到内存中的起始地址 90 | unsigned long getLibAddress(char *name){ 91 | unsigned long ret = 0; 92 | char buf[4096], *temp; 93 | int pid; 94 | FILE *fp; 95 | pid = getpid(); 96 | sprintf(buf, "/proc/%d/maps", pid); 97 | LOGI("libdemo.so pid=%d", pid); 98 | fp = fopen(buf, "r"); 99 | if(fp == NULL){ 100 | LOGI("open failed!"); 101 | fclose(fp); 102 | return ret; 103 | } 104 | 105 | while(fgets(buf, sizeof(buf), fp)){ 106 | if(strstr(buf, name)){ 107 | temp = strtok(buf, "-"); 108 | ret = strtoul(temp, NULL, 16); 109 | break; 110 | } 111 | } 112 | fclose(fp); 113 | return ret; 114 | } 115 | 116 | // void printELFHeader(Elf32_Ehdr* ehdr){ 117 | // LOGI("=================== ELF Header ==================="); 118 | // LOGI("In memorry, the address of ELF Header is: 0x%x", ehdr); 119 | // LOGI("e_ident=\t%s", ehdr->e_ident); 120 | // LOGI("e_type=\t%d", ehdr->e_type); 121 | // LOGI("e_machine=\t%d", ehdr->e_machine); 122 | // LOGI("e_version=\t%d", ehdr->e_version); 123 | // LOGI("e_entry=\t0x%x", ehdr->e_entry); 124 | // LOGI("e_phoff=\t0x%x", ehdr->e_phoff); 125 | // LOGI("e_shoff=\t0x%x", ehdr->e_shoff); 126 | // LOGI("e_flags=\t%d", ehdr->e_flags); 127 | // LOGI("e_ehsize=\t%d", ehdr->e_ehsize); 128 | // LOGI("e_phentsize=\t%d", ehdr->e_phentsize); 129 | // LOGI("e_phnum=\t%d", ehdr->e_phnum); 130 | // LOGI("e_shentsize=\t%d", ehdr->e_shentsize); 131 | // LOGI("e_shnum=\t%d", ehdr->e_shnum); 132 | // LOGI("e_shstrndx=\t%d", ehdr->e_shstrndx); 133 | // } 134 | 135 | 136 | 137 | JNIEXPORT jstring JNICALL Java_com_demo_MainActivity_getText 138 | (JNIEnv * env, jobject obj){ 139 | return getString(env); 140 | } -------------------------------------------------------------------------------- /006-通过hook重定向native方法/obj/local/armeabi/objs-debug/hackcodejiagu/hackcodejiagu.o.d: -------------------------------------------------------------------------------- 1 | obj/local/armeabi/objs-debug/hackcodejiagu/hackcodejiagu.o: \ 2 | jni/hackcodejiagu.cpp \ 3 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/log.h \ 4 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdio.h \ 5 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs.h \ 6 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs_elf.h \ 7 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/api-level.h \ 8 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/types.h \ 9 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdint.h \ 10 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/_types.h \ 11 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/_types.h \ 12 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/posix_types.h \ 13 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/stddef.h \ 14 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/compiler.h \ 15 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/posix_types.h \ 16 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/types.h \ 17 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/types.h \ 18 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/kernel.h \ 19 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysmacros.h \ 20 | jni/substrate.h \ 21 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/dlfcn.h \ 22 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdlib.h \ 23 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/string.h \ 24 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/malloc.h \ 25 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/alloca.h \ 26 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/strings.h \ 27 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/memory.h \ 28 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/jni.h 29 | 30 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/log.h: 31 | 32 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdio.h: 33 | 34 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs.h: 35 | 36 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs_elf.h: 37 | 38 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/api-level.h: 39 | 40 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/types.h: 41 | 42 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdint.h: 43 | 44 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/_types.h: 45 | 46 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/_types.h: 47 | 48 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/posix_types.h: 49 | 50 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/stddef.h: 51 | 52 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/compiler.h: 53 | 54 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/posix_types.h: 55 | 56 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/types.h: 57 | 58 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/types.h: 59 | 60 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/kernel.h: 61 | 62 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysmacros.h: 63 | 64 | jni/substrate.h: 65 | 66 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/dlfcn.h: 67 | 68 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdlib.h: 69 | 70 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/string.h: 71 | 72 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/malloc.h: 73 | 74 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/alloca.h: 75 | 76 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/strings.h: 77 | 78 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/memory.h: 79 | 80 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/jni.h: 81 | -------------------------------------------------------------------------------- /006-通过hook重定向native方法/obj/local/armeabi/objs-debug/demo1/demo1.o.d: -------------------------------------------------------------------------------- 1 | obj/local/armeabi/objs-debug/demo1/demo1.o: jni/demo1.cpp \ 2 | jni/com_demo_MainActivity.h \ 3 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/jni.h \ 4 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs.h \ 5 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs_elf.h \ 6 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/api-level.h \ 7 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/log.h \ 8 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdio.h \ 9 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/types.h \ 10 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdint.h \ 11 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/_types.h \ 12 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/_types.h \ 13 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/posix_types.h \ 14 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/stddef.h \ 15 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/compiler.h \ 16 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/posix_types.h \ 17 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/types.h \ 18 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/types.h \ 19 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/kernel.h \ 20 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysmacros.h \ 21 | jni/substrate.h \ 22 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/dlfcn.h \ 23 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdlib.h \ 24 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/string.h \ 25 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/malloc.h \ 26 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/alloca.h \ 27 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/strings.h \ 28 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/memory.h 29 | 30 | jni/com_demo_MainActivity.h: 31 | 32 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/jni.h: 33 | 34 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs.h: 35 | 36 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs_elf.h: 37 | 38 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/api-level.h: 39 | 40 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/log.h: 41 | 42 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdio.h: 43 | 44 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/types.h: 45 | 46 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdint.h: 47 | 48 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/_types.h: 49 | 50 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/_types.h: 51 | 52 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/posix_types.h: 53 | 54 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/stddef.h: 55 | 56 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/compiler.h: 57 | 58 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/posix_types.h: 59 | 60 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/types.h: 61 | 62 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/types.h: 63 | 64 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/kernel.h: 65 | 66 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysmacros.h: 67 | 68 | jni/substrate.h: 69 | 70 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/dlfcn.h: 71 | 72 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdlib.h: 73 | 74 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/string.h: 75 | 76 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/malloc.h: 77 | 78 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/alloca.h: 79 | 80 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/strings.h: 81 | 82 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/memory.h: 83 | -------------------------------------------------------------------------------- /shellTools/main.c: -------------------------------------------------------------------------------- 1 | #include "elf_parser.h" 2 | 3 | void displayProgramHeaderTable(Elf32_Phdr *phdr_tab, int phnum){ 4 | printf("\n=================== Program Header Table ===================\n"); 5 | int i; 6 | for(i = 0; i < phnum; ++i){ 7 | printf("p_type= %-10d p_offset= 0x%-10x p_vaddr= 0x%-8x p_paddr= 0x%-8x p_filesz= 0x%-8x p_memsz= 0x%-10x p_flags= %-4d p_align= 0x%-6x\n", 8 | phdr_tab[i].p_type, 9 | phdr_tab[i].p_offset, 10 | phdr_tab[i].p_vaddr, 11 | phdr_tab[i].p_paddr, 12 | phdr_tab[i].p_filesz, 13 | phdr_tab[i].p_memsz, 14 | phdr_tab[i].p_flags, 15 | phdr_tab[i].p_align); 16 | } 17 | } 18 | 19 | void displaySectionHeaderTable(Elf32_Shdr *shdr_tab, int shnum, char *strtab){ 20 | printf("\n=================== Section Header Table ===================\n"); 21 | int i; 22 | for(i = 0; i < shnum; i++){ 23 | printf("[%2d] sh_name= %-24s sh_type=%-12d sh_flags=%-4d sh_addr=0x%-8x sh_offset=0x%-8x sh_size=0x%-8x sh_link=%-4d sh_info=%-4d sh_addralign=%-4d sh_entsize=%-4d\n", 24 | i, 25 | (strtab + shdr_tab[i].sh_name), 26 | shdr_tab[i].sh_type, 27 | shdr_tab[i].sh_flags, 28 | shdr_tab[i].sh_addr, 29 | shdr_tab[i].sh_offset, 30 | shdr_tab[i].sh_size, 31 | shdr_tab[i].sh_size, 32 | shdr_tab[i].sh_link, 33 | shdr_tab[i].sh_info, 34 | shdr_tab[i].sh_addralign, 35 | shdr_tab[i].sh_entsize); 36 | } 37 | } 38 | 39 | 40 | 41 | int main(){ 42 | char name[] = "libdemo.so"; 43 | // char function_name[] = "_Z9getStringP7_JNIEnv"; 44 | char function_name[] = "Java_com_demo_MainActivity_getText"; 45 | char target_section[] = ".mytext"; 46 | long file_size; 47 | int i; 48 | size_t ret; 49 | Elf32_Ehdr ehdr; 50 | Elf32_Phdr *phdr_tab; 51 | Elf32_Shdr *shdr_tab; 52 | char *strtab; 53 | 54 | FILE *file; 55 | Elf32_Sym targetSym; 56 | 57 | file = fopen(name, "rb"); 58 | if(file == NULL){ 59 | printf("Open file error..."); 60 | return -1; 61 | } 62 | 63 | fseek(file, 0, SEEK_END); 64 | file_size = ftell(file); 65 | rewind(file); 66 | 67 | if(fread(&ehdr, 1, sizeof(Elf32_Ehdr), file) != sizeof(Elf32_Ehdr)){ 68 | printf("Read elf header error...\n"); 69 | return -1; 70 | } 71 | 72 | //////////////////////初始化Program Header Table////////////////////// 73 | phdr_tab = (Elf32_Phdr*)malloc(ehdr.e_phnum * sizeof(Elf32_Phdr)); 74 | if(phdr_tab == NULL){ 75 | printf("Malloc program header table error!!!\n"); 76 | return -1; 77 | } 78 | 79 | fseek(file, ehdr.e_phoff, SEEK_SET); 80 | for(i = 0; i < ehdr.e_phnum; i++){ 81 | if(fread(phdr_tab + i, 1, sizeof(Elf32_Phdr), file) != sizeof(Elf32_Phdr)){ 82 | printf("Read program header error!\n"); 83 | return -1; 84 | } 85 | } 86 | 87 | //////////////////////初始化Section Header Table////////////////////// 88 | shdr_tab = (Elf32_Shdr*)malloc(ehdr.e_shnum * sizeof(Elf32_Shdr)); 89 | if(shdr_tab == NULL){ 90 | printf("Malloc section header table error!!!\n"); 91 | return -1; 92 | } 93 | 94 | fseek(file, ehdr.e_shoff, SEEK_SET); 95 | for(i = 0; i < ehdr.e_shnum; i++){ 96 | if(fread(shdr_tab + i, 1, sizeof(Elf32_Shdr), file) != sizeof(Elf32_Shdr)){ 97 | printf("Read section header error!\n"); 98 | return -1; 99 | } 100 | 101 | } 102 | 103 | //////////////////////初始化String Table////////////////////// 104 | strtab = (char*)malloc(shdr_tab[ehdr.e_shstrndx].sh_size); 105 | if(strtab == NULL){ 106 | printf("Malloc string table error!!!\n"); 107 | return -1; 108 | } 109 | 110 | fseek(file, shdr_tab[ehdr.e_shstrndx].sh_offset, SEEK_SET); 111 | if(fread(strtab, 1, shdr_tab[ehdr.e_shstrndx].sh_size, file) != shdr_tab[ehdr.e_shstrndx].sh_size){ 112 | printf("Read string table error!\n"); 113 | return -1; 114 | } 115 | 116 | displayProgramHeaderTable(phdr_tab, ehdr.e_phnum); 117 | displaySectionHeaderTable(shdr_tab, ehdr.e_shnum, strtab); 118 | 119 | 120 | //////////////////////查找symbol name////////////////////// 121 | if(getSymbolAddr(ehdr, file, function_name, &targetSym) != 0){ 122 | printf("Can not find: %s\n", function_name); 123 | } 124 | 125 | //////////////////////查找section name////////////////////// 126 | int shndx; 127 | shndx = getSectionAddr(shdr_tab, ehdr.e_shnum, strtab, target_section); 128 | if(shndx != -1){ 129 | printf("Section \"%s\": idx:%d offset:0x%x, size:0x%x\n", target_section, shndx, shdr_tab[shndx].sh_offset, shdr_tab[shndx].sh_size); 130 | } 131 | 132 | 133 | //////////////////////加密函数////////////////////// 134 | //encryptFunction("libdemo.hacked.function.so", ehdr, file, file_size, function_name, &targetSym); 135 | 136 | 137 | //////////////////////加密section////////////////////// 138 | //encryptSection("libdemo.hacked.section.so", shdr_tab, ehdr.e_shnum, strtab, file, target_section); 139 | 140 | 141 | free(strtab); 142 | free(shdr_tab); 143 | free(phdr_tab); 144 | fclose(file); 145 | return 0; 146 | } -------------------------------------------------------------------------------- /shellTools/elf_parser.c: -------------------------------------------------------------------------------- 1 | #include "elf_parser.h" 2 | 3 | static unsigned elfhash(const char *_name){ 4 | const unsigned char *name = (const unsigned char *) _name; 5 | unsigned h = 0, g; 6 | 7 | while(*name) { 8 | h = (h << 4) + *name++; 9 | g = h & 0xf0000000; 10 | h ^= g; 11 | h ^= g >> 24; 12 | } 13 | return h; 14 | } 15 | 16 | int getSymbolAddr(Elf32_Ehdr ehdr, FILE *file, const char *name, Elf32_Sym *targetSym){ 17 | //1.读取program header中PT_DYNAMIC属性的segment 18 | Elf32_Phdr phdr; 19 | Elf32_Dyn dyn; 20 | Elf32_Dyn dyn_strsz, dyn_hash, dyn_symtab, dyn_strtab; 21 | char *dynstr; 22 | int i, flag = -1; 23 | 24 | fseek(file, ehdr.e_phoff, SEEK_SET); 25 | for(i = 0; i < ehdr.e_phnum; i++){ 26 | if(fread(&phdr, 1, sizeof(Elf32_Phdr), file) != sizeof(Elf32_Phdr)){ 27 | printf("Read program header table error...\n"); 28 | return -1; 29 | } 30 | 31 | if(phdr.p_type == PT_DYNAMIC){ 32 | ++flag; 33 | } 34 | } 35 | 36 | //2:找出DT_STRSZ、DT_HASH、DT_STRTAB、DT_SYMTAB 37 | for(i = 0; i < phdr.p_filesz/sizeof(Elf32_Dyn); i++){ 38 | fseek(file, phdr.p_offset + sizeof(Elf32_Dyn)*i, SEEK_SET); 39 | if(fread(&dyn, 1, sizeof(Elf32_Dyn), file) != sizeof(Elf32_Dyn)){ 40 | printf("Read symbol error...\n"); 41 | return -1; 42 | } 43 | 44 | if(dyn.d_tag == DT_STRSZ){ 45 | ++flag; 46 | dyn_strsz = dyn; 47 | } 48 | 49 | if(dyn.d_tag == DT_HASH){ 50 | ++flag; 51 | dyn_hash = dyn; 52 | } 53 | 54 | if(dyn.d_tag == DT_SYMTAB){ 55 | ++flag; 56 | dyn_symtab = dyn; 57 | } 58 | 59 | if(dyn.d_tag == DT_STRTAB){ 60 | ++flag; 61 | dyn_strtab = dyn; 62 | } 63 | } 64 | 65 | if(flag != 4){ 66 | printf("Error...\n"); 67 | } 68 | 69 | dynstr = (char*)malloc(dyn_strsz.d_un.d_val); 70 | if(dynstr == NULL){ 71 | printf("Malloc dynstr error...\n"); 72 | return -1; 73 | } 74 | 75 | fseek(file, dyn_strtab.d_un.d_ptr, SEEK_SET); 76 | if(fread(dynstr, 1, dyn_strsz.d_un.d_val, file) != dyn_strsz.d_un.d_val){ 77 | printf("Read dynstr error...\n"); 78 | return -1; 79 | } 80 | 81 | 82 | //3.跳转到哈希表,获取nbucket、nchain 83 | unsigned nbucket, nchain; 84 | unsigned funHash, funIndex; 85 | 86 | fseek(file, dyn_hash.d_un.d_ptr, SEEK_SET); 87 | if(fread(&nbucket, 1, 4, file) != 4){ 88 | printf("Read nbucket error...\n"); 89 | return -1; 90 | } 91 | 92 | fseek(file, dyn_hash.d_un.d_ptr + 4, SEEK_SET); 93 | if(fread(&nchain, 1, 4, file) != 4){ 94 | printf("Read nchain error...\n"); 95 | return -1; 96 | } 97 | 98 | funHash = elfhash(name); 99 | funHash = funHash % nbucket; 100 | 101 | //4.获取function的索引 102 | fseek(file, funHash*4, SEEK_CUR); 103 | if (fread(&funIndex, 1, 4, file) != 4){ 104 | printf("Read function index error...\n"); 105 | return -1; 106 | } 107 | 108 | //5.获取该function索引对应的字符串名称 109 | Elf32_Sym funSym; 110 | 111 | fseek(file, dyn_symtab.d_un.d_ptr + funIndex*sizeof(Elf32_Sym), SEEK_SET); 112 | if(fread(&funSym, 1, sizeof(Elf32_Sym), file) != sizeof(Elf32_Sym)){ 113 | printf("Read function symbol error...\n"); 114 | return -1; 115 | } 116 | 117 | //6.如果index=bucket[X % nbucket]对应的symbolTable[index]不是要查找的, 118 | //则chain[index]的值是具有相同哈希值的下一个符号的索引,沿着chain查找,直到chain[index] = 0 119 | if(strcmp(dynstr + funSym.st_name, name) != 0){ 120 | while(1){ 121 | //6.1获取index = chain[index] 122 | fseek(file, dyn_hash.d_un.d_ptr + 8 + (nbucket + funIndex)*4, SEEK_SET); 123 | if(fread(&funIndex, 1, 4, file) != 4){ 124 | printf("Read funIndex in chain error...\n"); 125 | return -1; 126 | } 127 | 128 | if(funIndex == 0){ 129 | printf("Can not find function...\n"); 130 | return -1; 131 | } 132 | 133 | //6.2根据新的方法index到symtab中查找 134 | fseek(file, dyn_symtab.d_un.d_ptr + funIndex * sizeof(Elf32_Sym), SEEK_SET); 135 | if(fread(&funSym, 1, sizeof(Elf32_Sym), file) != sizeof(Elf32_Sym)){ 136 | printf("Read function symbol error...\n"); 137 | return -1; 138 | } 139 | 140 | //6.3对比符号名是否相等 141 | if(strcmp(dynstr + funSym.st_name, name) == 0){ 142 | break; 143 | } 144 | } 145 | } 146 | 147 | targetSym->st_value = funSym.st_value; 148 | targetSym->st_size = funSym.st_size; 149 | targetSym->st_info = funSym.st_info; 150 | targetSym->st_other = funSym.st_other; 151 | targetSym->st_shndx = funSym.st_shndx; 152 | 153 | printf("\"%s\": offset=>0x%x, size=>%d\n", name, targetSym->st_value, targetSym->st_size); 154 | 155 | free(dynstr); 156 | return 0; 157 | } 158 | 159 | 160 | int getSectionAddr(Elf32_Shdr *shdr_tab, int shnum, char *strtab, const char *section_name){ 161 | int shndx; 162 | for(shndx = 0; shndx < shnum; shndx++){ 163 | // printf("-----%s\n",strtab + shdr_tab[shndx].sh_name); 164 | if(strcmp(section_name, strtab + shdr_tab[shndx].sh_name) == 0){ 165 | 166 | return shndx; 167 | } 168 | } 169 | return -1; 170 | } -------------------------------------------------------------------------------- /007-动态注册native方法/obj/local/armeabi/objs/demo/demo.o.d: -------------------------------------------------------------------------------- 1 | obj/local/armeabi/objs/demo/demo.o: jni/demo.c \ 2 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/jni.h \ 3 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs.h \ 4 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs_elf.h \ 5 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/api-level.h \ 6 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/log.h \ 7 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdio.h \ 8 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/types.h \ 9 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdint.h \ 10 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/_types.h \ 11 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/_types.h \ 12 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/_wchar_limits.h \ 13 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/posix_types.h \ 14 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/stddef.h \ 15 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/compiler.h \ 16 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/posix_types.h \ 17 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/types.h \ 18 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/types.h \ 19 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/kernel.h \ 20 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysmacros.h \ 21 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/unistd.h \ 22 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/select.h \ 23 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/time.h \ 24 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/time.h \ 25 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/signal.h \ 26 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/limits.h \ 27 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/limits.h \ 28 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/limits.h \ 29 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/internal_types.h \ 30 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/limits.h \ 31 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/syslimits.h \ 32 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/page.h \ 33 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/string.h \ 34 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/malloc.h \ 35 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/signal.h \ 36 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/signal.h \ 37 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/sigcontext.h \ 38 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/siginfo.h \ 39 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/siginfo.h \ 40 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/ucontext.h \ 41 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/user.h \ 42 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysconf.h \ 43 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/capability.h \ 44 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/pathconf.h 45 | 46 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/jni.h: 47 | 48 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs.h: 49 | 50 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs_elf.h: 51 | 52 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/api-level.h: 53 | 54 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/log.h: 55 | 56 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdio.h: 57 | 58 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/types.h: 59 | 60 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdint.h: 61 | 62 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/_types.h: 63 | 64 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/_types.h: 65 | 66 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/_wchar_limits.h: 67 | 68 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/posix_types.h: 69 | 70 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/stddef.h: 71 | 72 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/compiler.h: 73 | 74 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/posix_types.h: 75 | 76 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/types.h: 77 | 78 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/types.h: 79 | 80 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/kernel.h: 81 | 82 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysmacros.h: 83 | 84 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/unistd.h: 85 | 86 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/select.h: 87 | 88 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/time.h: 89 | 90 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/time.h: 91 | 92 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/signal.h: 93 | 94 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/limits.h: 95 | 96 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/limits.h: 97 | 98 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/limits.h: 99 | 100 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/internal_types.h: 101 | 102 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/limits.h: 103 | 104 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/syslimits.h: 105 | 106 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/page.h: 107 | 108 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/string.h: 109 | 110 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/malloc.h: 111 | 112 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/signal.h: 113 | 114 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/signal.h: 115 | 116 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/sigcontext.h: 117 | 118 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/siginfo.h: 119 | 120 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/siginfo.h: 121 | 122 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/ucontext.h: 123 | 124 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/user.h: 125 | 126 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysconf.h: 127 | 128 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/capability.h: 129 | 130 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/pathconf.h: 131 | -------------------------------------------------------------------------------- /004-MethodEncrypt/jni/demo.cpp: -------------------------------------------------------------------------------- 1 | #include "com_demo_MainActivity.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | #define LOG_TAG "AndroidNDK" 12 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) 13 | 14 | 15 | jstring getString(JNIEnv*) __attribute__((section(".mytext"))); 16 | jstring getString(JNIEnv* env){ 17 | return env->NewStringUTF("Native method return!"); 18 | } 19 | 20 | /** 21 | __attribute__((constructor)表示init_security()函数放在.init section。 22 | .init相当于初始化,比JNI_ONLOAD早执行。 23 | 所以在这里要对加密的section进行解密操作 24 | **/ 25 | void init_security() __attribute__((constructor)); 26 | 27 | unsigned long getLibAddress(const char *name); 28 | void decryptFunction(unsigned long base, Elf32_Sym *funSym); 29 | // void printELFHeader(Elf32_Ehdr* ehdr); 30 | static unsigned elfhash(const char *_name); 31 | 32 | // void displayProgramHeaderTable(Elf32_Phdr* phdr, int phnum){ 33 | // printf("\n=================== Program Header Table ===================\n"); 34 | // printf("In memorry, the address of Program Header table is: 0x%x\n", phdr); 35 | // int i; 36 | // for(i = 0; i < phnum; ++i, ++phdr){ 37 | // LOGI("p_type= %d, p_offset= 0x%x, p_vaddr= 0x%x, p_paddr= 0x%x, p_filesz= 0x%x, p_memsz= 0x%x, p_flags= %d, p_align= 0x%x\n", 38 | // phdr->p_type, 39 | // phdr->p_offset, 40 | // phdr->p_vaddr, 41 | // phdr->p_paddr, 42 | // phdr->p_filesz, 43 | // phdr->p_memsz, 44 | // phdr->p_flags, 45 | // phdr->p_align); 46 | // } 47 | // } 48 | 49 | 50 | static unsigned elfhash(const char *_name){ 51 | const unsigned char *name = (const unsigned char *) _name; 52 | unsigned h = 0, g; 53 | 54 | while(*name) { 55 | h = (h << 4) + *name++; 56 | g = h & 0xf0000000; 57 | h ^= g; 58 | h ^= g >> 24; 59 | } 60 | return h; 61 | } 62 | 63 | void init_security(){ 64 | LOGI("----------------init_security()---------------------"); 65 | unsigned long base; 66 | Elf32_Ehdr *ehdr; 67 | Elf32_Phdr *phdr; 68 | int i, flag = -1; 69 | 70 | 71 | //1.获取so文件内存地址 72 | base = getLibAddress("libdemo.so"); 73 | if(base == 0){ 74 | LOGI("Get so address error..."); 75 | return; 76 | } 77 | // LOGI("so addr:0x%x\n", base); 78 | 79 | //2.解析elf header和program header 80 | ehdr = (Elf32_Ehdr*)base; 81 | phdr = (Elf32_Phdr*)(base + ehdr->e_phoff); 82 | 83 | //3.解析program header table,找到PT_DYNAMIC属性的segment 84 | for(i = 0; i < ehdr->e_phnum; ++i, ++phdr){ 85 | if(phdr->p_type == PT_DYNAMIC){ 86 | ++flag; 87 | break; 88 | } 89 | } 90 | 91 | if(flag != 0){ 92 | LOGI("Find PT_DYNAMIC segment error...\n"); 93 | return; 94 | } 95 | LOGI("Dynamic link table addr:0x%x\n", phdr->p_offset); 96 | 97 | //4.遍历Dynamic link table获取DT_STRTAB、DT_SYMTAB、DT_STRSZ、DT_HASH四个属性的Elf32_Dyn对象 98 | Elf32_Dyn *dyn_strtab, *dyn_symtab, *dyn_strsz, *dyn_hash; 99 | Elf32_Dyn *dyn; 100 | for(i = 0; i < phdr->p_filesz/sizeof(Elf32_Dyn); i++){ 101 | dyn = (Elf32_Dyn*)(base + phdr->p_offset + i*sizeof(Elf32_Dyn)); 102 | 103 | if(dyn->d_tag == DT_STRTAB){ 104 | ++flag; 105 | dyn_strtab = dyn; 106 | LOGI("Find DT_STRTAB!"); 107 | } 108 | 109 | if(dyn->d_tag == DT_SYMTAB){ 110 | ++flag; 111 | dyn_symtab = dyn; 112 | LOGI("Find DT_SYMTAB!"); 113 | } 114 | 115 | if(dyn->d_tag == DT_STRSZ){ 116 | ++flag; 117 | dyn_strsz = dyn; 118 | LOGI("Find DT_STRSZ!"); 119 | } 120 | 121 | if(dyn->d_tag == DT_HASH){ 122 | ++flag; 123 | dyn_hash = dyn; 124 | LOGI("Find DT_HASH!"); 125 | } 126 | 127 | } 128 | 129 | if(flag != 4){ 130 | LOGI("Error..."); 131 | } 132 | 133 | //5.初始化dynstr符号列表(从STRTAB读取) 134 | char *dynstr; 135 | dynstr = (char*)(base + dyn_strtab->d_un.d_ptr); 136 | 137 | //6.初始化哈希表,nbucket, nchain, bucket, chain 138 | unsigned nbucket, nchain; 139 | unsigned *bucket, *chain; 140 | unsigned funHash, funIndex; 141 | Elf32_Sym *funSym; 142 | char funName[] = "Java_com_demo_MainActivity_getText"; 143 | int isFind = -1; 144 | 145 | 146 | nbucket = *(unsigned*)(base + dyn_hash->d_un.d_ptr); 147 | nchain = *(unsigned*)(base + dyn_hash->d_un.d_ptr + 4); 148 | bucket = (unsigned*)(base + dyn_hash->d_un.d_ptr + 8); 149 | chain = (unsigned*)(base + dyn_hash->d_un.d_ptr + 8 + nbucket*4); 150 | funHash = elfhash(funName); 151 | funHash = funHash % nbucket; 152 | 153 | //6.1首先根据index = bucket[X % nbucket],去symtab查找对应的Elf32_Sym对象 154 | funIndex = *(bucket + funHash); 155 | funSym = (Elf32_Sym*)(base + dyn_symtab->d_un.d_ptr + funIndex * sizeof(Elf32_Sym)); 156 | LOGI("nbucket=%d, nchain=%d, funHash=%d, funIndex=%d", nbucket, nchain,funHash, funIndex); 157 | LOGI("%s", (char*)(dynstr + funSym->st_name)); 158 | 159 | if(strcmp(dynstr + funSym->st_name, funName) != 0){ 160 | //6.2如果不相等,则获取index = chain[index],再进行查找 161 | while(1){ 162 | funIndex = *(chain + funHash); 163 | funSym = (Elf32_Sym*)(base + dyn_symtab->d_un.d_ptr + funIndex * sizeof(Elf32_Sym)); 164 | LOGI("funIndex=%d, funSym=%s",funIndex, dynstr + funSym->st_name); 165 | 166 | if(funIndex == 0){ 167 | LOGI("Can not find function: %s", funName); 168 | } 169 | 170 | if(strcmp(dynstr + funSym->st_name, funName) == 0){ 171 | isFind = 0; 172 | break; 173 | } 174 | } 175 | 176 | }else{ 177 | isFind = 0; 178 | } 179 | 180 | if(isFind == 0){ 181 | //找到目标函数,开始解密 182 | unsigned int page_size; 183 | 184 | page_size = funSym->st_size / PAGE_SIZE + ((funSym->st_size % PAGE_SIZE == 0) ? 0: 1); 185 | 186 | LOGI("Function is found! Addr:0x%x, Size:%d", funSym->st_value, funSym->st_size); 187 | 188 | if(mprotect( (void*)((base + funSym->st_value)/PAGE_SIZE * PAGE_SIZE), page_size * PAGE_SIZE, PROT_READ | PROT_EXEC | PROT_WRITE) != 0){ 189 | LOGI("mprotect 1 error...\n"); 190 | return ; 191 | } 192 | 193 | decryptFunction(base, funSym); 194 | 195 | if(mprotect( (void*)((base + funSym->st_value)/PAGE_SIZE * PAGE_SIZE), page_size * PAGE_SIZE, PROT_READ | PROT_EXEC) != 0){ 196 | LOGI("mprotect 2 error...\n"); 197 | return ; 198 | } 199 | 200 | 201 | } 202 | 203 | LOGI("----------------init_security() Done---------------------"); 204 | } 205 | 206 | void decryptFunction(unsigned long base, Elf32_Sym *funSym){ 207 | int i; 208 | unsigned int length; 209 | 210 | length = funSym->st_size; 211 | 212 | for(i = 0; i < length; i++){ 213 | char *addr = (char*)(base + funSym->st_value + i); 214 | *addr = ~(*addr); 215 | } 216 | LOGI("%s", "Decrypt function successfully!"); 217 | } 218 | 219 | //获取so加载到内存中的起始地址 220 | unsigned long getLibAddress(const char *name){ 221 | unsigned long ret = 0; 222 | char buf[PAGE_SIZE], *temp; 223 | int pid; 224 | FILE *fp; 225 | pid = getpid(); 226 | sprintf(buf, "/proc/%d/maps", pid); 227 | LOGI("libdemo.so pid=%d", pid); 228 | fp = fopen(buf, "r"); 229 | if(fp == NULL){ 230 | LOGI("open failed!"); 231 | fclose(fp); 232 | return ret; 233 | } 234 | 235 | while(fgets(buf, sizeof(buf), fp)){ 236 | if(strstr(buf, name)){ 237 | temp = strtok(buf, "-"); 238 | ret = strtoul(temp, NULL, 16); 239 | break; 240 | } 241 | } 242 | fclose(fp); 243 | return ret; 244 | } 245 | 246 | // void printELFHeader(Elf32_Ehdr* ehdr){ 247 | // LOGI("=================== ELF Header ==================="); 248 | // LOGI("In memorry, the address of ELF Header is: 0x%x", ehdr); 249 | // LOGI("e_ident=\t%s", ehdr->e_ident); 250 | // LOGI("e_type=\t%d", ehdr->e_type); 251 | // LOGI("e_machine=\t%d", ehdr->e_machine); 252 | // LOGI("e_version=\t%d", ehdr->e_version); 253 | // LOGI("e_entry=\t0x%x", ehdr->e_entry); 254 | // LOGI("e_phoff=\t0x%x", ehdr->e_phoff); 255 | // LOGI("e_shoff=\t0x%x", ehdr->e_shoff); 256 | // LOGI("e_flags=\t%d", ehdr->e_flags); 257 | // LOGI("e_ehsize=\t%d", ehdr->e_ehsize); 258 | // LOGI("e_phentsize=\t%d", ehdr->e_phentsize); 259 | // LOGI("e_phnum=\t%d", ehdr->e_phnum); 260 | // LOGI("e_shentsize=\t%d", ehdr->e_shentsize); 261 | // LOGI("e_shnum=\t%d", ehdr->e_shnum); 262 | // LOGI("e_shstrndx=\t%d", ehdr->e_shstrndx); 263 | // } 264 | 265 | 266 | 267 | JNIEXPORT jstring JNICALL Java_com_demo_MainActivity_getText 268 | (JNIEnv * env, jobject obj){ 269 | // return getString(env); 270 | LOGI("Call Java_com_demo_MainActivity_getText!"); 271 | return env->NewStringUTF("Native method return!"); 272 | } -------------------------------------------------------------------------------- /004-MethodEncrypt/obj/local/armeabi/objs/demo/demo.o.d: -------------------------------------------------------------------------------- 1 | obj/local/armeabi/objs/demo/demo.o: jni/demo.cpp \ 2 | jni/com_demo_MainActivity.h \ 3 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/jni.h \ 4 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs.h \ 5 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs_elf.h \ 6 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/api-level.h \ 7 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/log.h \ 8 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/string.h \ 9 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/malloc.h \ 10 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdio.h \ 11 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/types.h \ 12 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdint.h \ 13 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/_types.h \ 14 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/_types.h \ 15 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/posix_types.h \ 16 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/stddef.h \ 17 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/compiler.h \ 18 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/posix_types.h \ 19 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/types.h \ 20 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/types.h \ 21 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/kernel.h \ 22 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysmacros.h \ 23 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdlib.h \ 24 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/alloca.h \ 25 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/strings.h \ 26 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/memory.h \ 27 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/unistd.h \ 28 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/select.h \ 29 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/time.h \ 30 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/time.h \ 31 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/signal.h \ 32 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/limits.h \ 33 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/limits.h \ 34 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/limits.h \ 35 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/internal_types.h \ 36 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/limits.h \ 37 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/syslimits.h \ 38 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/page.h \ 39 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/signal.h \ 40 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/signal.h \ 41 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/sigcontext.h \ 42 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/siginfo.h \ 43 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/siginfo.h \ 44 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/ucontext.h \ 45 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/user.h \ 46 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysconf.h \ 47 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/capability.h \ 48 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/pathconf.h \ 49 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/elf.h \ 50 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/exec_elf.h \ 51 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/exec.h \ 52 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/mman.h \ 53 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/mman.h \ 54 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/mman.h \ 55 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/mman-common.h 56 | 57 | jni/com_demo_MainActivity.h: 58 | 59 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/jni.h: 60 | 61 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs.h: 62 | 63 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs_elf.h: 64 | 65 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/api-level.h: 66 | 67 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/log.h: 68 | 69 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/string.h: 70 | 71 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/malloc.h: 72 | 73 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdio.h: 74 | 75 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/types.h: 76 | 77 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdint.h: 78 | 79 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/_types.h: 80 | 81 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/_types.h: 82 | 83 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/posix_types.h: 84 | 85 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/stddef.h: 86 | 87 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/compiler.h: 88 | 89 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/posix_types.h: 90 | 91 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/types.h: 92 | 93 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/types.h: 94 | 95 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/kernel.h: 96 | 97 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysmacros.h: 98 | 99 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdlib.h: 100 | 101 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/alloca.h: 102 | 103 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/strings.h: 104 | 105 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/memory.h: 106 | 107 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/unistd.h: 108 | 109 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/select.h: 110 | 111 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/time.h: 112 | 113 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/time.h: 114 | 115 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/signal.h: 116 | 117 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/limits.h: 118 | 119 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/limits.h: 120 | 121 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/limits.h: 122 | 123 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/internal_types.h: 124 | 125 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/limits.h: 126 | 127 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/syslimits.h: 128 | 129 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/page.h: 130 | 131 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/signal.h: 132 | 133 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/signal.h: 134 | 135 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/sigcontext.h: 136 | 137 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/siginfo.h: 138 | 139 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/siginfo.h: 140 | 141 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/ucontext.h: 142 | 143 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/user.h: 144 | 145 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysconf.h: 146 | 147 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/capability.h: 148 | 149 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/pathconf.h: 150 | 151 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/elf.h: 152 | 153 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/exec_elf.h: 154 | 155 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/exec.h: 156 | 157 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/mman.h: 158 | 159 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/mman.h: 160 | 161 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/mman.h: 162 | 163 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/mman-common.h: 164 | -------------------------------------------------------------------------------- /003-SectionEncrypt/obj/local/armeabi/objs/demo/demo.o.d: -------------------------------------------------------------------------------- 1 | obj/local/armeabi/objs/demo/demo.o: jni/demo.cpp \ 2 | jni/com_demo_MainActivity.h \ 3 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/jni.h \ 4 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs.h \ 5 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs_elf.h \ 6 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/api-level.h \ 7 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/log.h \ 8 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/string.h \ 9 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/malloc.h \ 10 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdio.h \ 11 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/types.h \ 12 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdint.h \ 13 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/_types.h \ 14 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/_types.h \ 15 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/posix_types.h \ 16 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/stddef.h \ 17 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/compiler.h \ 18 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/posix_types.h \ 19 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/types.h \ 20 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/types.h \ 21 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/kernel.h \ 22 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysmacros.h \ 23 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdlib.h \ 24 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/alloca.h \ 25 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/strings.h \ 26 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/memory.h \ 27 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/unistd.h \ 28 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/select.h \ 29 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/time.h \ 30 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/time.h \ 31 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/signal.h \ 32 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/limits.h \ 33 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/limits.h \ 34 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/limits.h \ 35 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/internal_types.h \ 36 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/limits.h \ 37 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/syslimits.h \ 38 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/page.h \ 39 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/signal.h \ 40 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/signal.h \ 41 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/sigcontext.h \ 42 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/siginfo.h \ 43 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/siginfo.h \ 44 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/ucontext.h \ 45 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/user.h \ 46 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysconf.h \ 47 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/capability.h \ 48 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/pathconf.h \ 49 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/elf.h \ 50 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/exec_elf.h \ 51 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/exec.h \ 52 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/mman.h \ 53 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/mman.h \ 54 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/mman.h \ 55 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/mman-common.h 56 | 57 | jni/com_demo_MainActivity.h: 58 | 59 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/jni.h: 60 | 61 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs.h: 62 | 63 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/cdefs_elf.h: 64 | 65 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/api-level.h: 66 | 67 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/android/log.h: 68 | 69 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/string.h: 70 | 71 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/malloc.h: 72 | 73 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdio.h: 74 | 75 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/types.h: 76 | 77 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdint.h: 78 | 79 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/_types.h: 80 | 81 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/_types.h: 82 | 83 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/posix_types.h: 84 | 85 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/stddef.h: 86 | 87 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/compiler.h: 88 | 89 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/posix_types.h: 90 | 91 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/types.h: 92 | 93 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/types.h: 94 | 95 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/kernel.h: 96 | 97 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysmacros.h: 98 | 99 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/stdlib.h: 100 | 101 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/alloca.h: 102 | 103 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/strings.h: 104 | 105 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/memory.h: 106 | 107 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/unistd.h: 108 | 109 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/select.h: 110 | 111 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/time.h: 112 | 113 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/time.h: 114 | 115 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/signal.h: 116 | 117 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/limits.h: 118 | 119 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/limits.h: 120 | 121 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/limits.h: 122 | 123 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/internal_types.h: 124 | 125 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/limits.h: 126 | 127 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/syslimits.h: 128 | 129 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/page.h: 130 | 131 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/signal.h: 132 | 133 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/signal.h: 134 | 135 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/sigcontext.h: 136 | 137 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/siginfo.h: 138 | 139 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/siginfo.h: 140 | 141 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/ucontext.h: 142 | 143 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/user.h: 144 | 145 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/sysconf.h: 146 | 147 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/linux/capability.h: 148 | 149 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/pathconf.h: 150 | 151 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/elf.h: 152 | 153 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/exec_elf.h: 154 | 155 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/machine/exec.h: 156 | 157 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/sys/mman.h: 158 | 159 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm/mman.h: 160 | 161 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/mman.h: 162 | 163 | D:/Android/android-ndk-r10e/platforms/android-19/arch-arm/usr/include/asm-generic/mman-common.h: 164 | --------------------------------------------------------------------------------