├── LICENSE ├── README.md ├── app ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── CMakeLists.txt │ └── native-lib.cpp │ ├── java │ └── com │ │ └── sakuqi │ │ └── apksteady │ │ └── MainActivity.kt │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ └── activity_main.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── values-night │ └── themes.xml │ └── values │ ├── colors.xml │ ├── strings.xml │ └── themes.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── local.properties ├── settings.gradle └── steady ├── build.gradle ├── proguard-rules.pro └── src ├── androidTest └── java │ └── com │ └── sakuqi │ └── steady │ └── ExampleInstrumentedTest.kt ├── main ├── AndroidManifest.xml ├── cpp │ ├── CMakeLists.txt │ └── steady-lib.cpp ├── java │ └── com │ │ └── sakuqi │ │ └── steady │ │ ├── ClassLoaderUtils.java │ │ ├── ProxyUtils.java │ │ ├── SteadyApplication.java │ │ └── Zip.java └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── values-night │ └── themes.xml │ └── values │ ├── colors.xml │ ├── strings.xml │ └── themes.xml └── test └── java └── com └── sakuqi └── steady └── ExampleUnitTest.kt /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ApkSteady 2 | 3 | #### 介绍 4 | Android. APK加固。该项目包含了对加固后的apk进行dex解密和加载 5 | 6 | ## 一、生成 Shell.aar(dex 解密和类加载) 7 | 8 | ### 1、解密加固的 dex 文件的流程 9 | 1. 在 Application 中可以通过 getApplicationInfo().sourceDir 来获取 base APK,这个 apk 就包含了我们应用的所有代码。 10 | 2. 通过 Application 的getDir() 方法,我们在应用的私有目录创建一个私有文件夹 SteadyDir 11 | 3. 在 2 中创建的目录里面我们将 bask.apk 解压 12 | 4. 解压后我们得到 apk 的所有文件,然后过滤出所有以dex为后缀的文件。其中 classes.dex 文件我们不需要因为它已经被加载进系统,所以只需要处理被我们加密的dex 文件 13 | 5. 将解密后的 dex 文件加载到程序中 14 | 6. 运行 apk 真实的 application,启动 app 15 | 16 | ### 2、如何解压 apk 文件 17 | 18 | zip 解压主要用到了 java 中的 ZipFile 类,具体实现直接上代码,代码中包含注释就不多解释。 19 | 20 | ```java 21 | public static void unZip(File zip, File dir) { 22 | try { 23 | //清空存放解压文件的目录 24 | deleteFile(dir); 25 | ZipFile zipFile = new ZipFile(zip); 26 | //zip文件中每一个条目 27 | Enumeration entries = zipFile.entries(); 28 | //遍历 29 | while (entries.hasMoreElements()) { 30 | ZipEntry zipEntry = entries.nextElement(); 31 | //zip中 文件/目录名 32 | String name = zipEntry.getName(); 33 | //原来的签名文件 不需要了 34 | if (name.equals("META-INF/CERT.RSA") || name.equals("META-INF/CERT.SF") || name 35 | .equals("META-INF/MANIFEST.MF")) { 36 | continue; 37 | } 38 | //空目录不管 39 | if (!zipEntry.isDirectory()) { 40 | File file = new File(dir, name); 41 | //创建目录 42 | if (!file.getParentFile().exists()) { 43 | file.getParentFile().mkdirs(); 44 | } 45 | //写文件 46 | FileOutputStream fos = new FileOutputStream(file); 47 | InputStream is = zipFile.getInputStream(zipEntry); 48 | byte[] buffer = new byte[2048]; 49 | int len; 50 | while ((len = is.read(buffer)) != -1) { 51 | fos.write(buffer, 0, len); 52 | } 53 | is.close(); 54 | fos.close(); 55 | } 56 | } 57 | zipFile.close(); 58 | } catch (Exception e) { 59 | e.printStackTrace(); 60 | } 61 | } 62 | 63 | 64 | private static void deleteFile(File file){ 65 | if (file.isDirectory()){ 66 | File[] files = file.listFiles(); 67 | for (File f: files) { 68 | deleteFile(f); 69 | } 70 | }else{ 71 | file.delete(); 72 | } 73 | } 74 | ``` 75 | 76 | ### 3、如何解密 dex 文件 77 | 78 | 通过第二步中的解压方式,我们可以很轻松的将 base.apk 解压到私有目录下。然后我们通过文件的后缀名.dex 过滤出所有 dex 文件(排除 classes.dex),接着读取每个 dex 到字节数组中,然后对字节数组进行解密操作。 79 | 这里加解密使用的是 AES 的方式,为了增加安全性这里将解密的方式用 jni 方式完成。解密方式如下: 80 | 81 | ```c++ 82 | jbyteArray decrypt(JNIEnv *env,jbyteArray srcData) { 83 | jstring type = (*env).NewStringUTF("AES"); 84 | jstring cipher_mode = (*env).NewStringUTF("AES/ECB/PKCS5Padding"); 85 | jbyteArray pwd = (*env).NewByteArray(16); 86 | char *master_key = (char *) "huangdh'l,.AMWK;"; 87 | (*env).SetByteArrayRegion(pwd,0,16,reinterpret_cast(master_key)); 88 | 89 | jclass secretKeySpecClass = (*env).FindClass("javax/crypto/spec/SecretKeySpec"); 90 | jmethodID secretKeySpecMethodId = (*env).GetMethodID(secretKeySpecClass,"", "([BLjava/lang/String;)V"); 91 | jobject secretKeySpecObj = (*env).NewObject(secretKeySpecClass,secretKeySpecMethodId,pwd,type); 92 | 93 | jclass cipherClass = (*env).FindClass("javax/crypto/Cipher"); 94 | jmethodID cipherInitMethodId = (*env).GetMethodID(cipherClass,"init", "(ILjava/security/Key;)V"); 95 | jmethodID cipherInstanceMethodId = (*env).GetStaticMethodID(cipherClass,"getInstance", "(Ljava/lang/String;)Ljavax/crypto/Cipher;"); 96 | jobject cipherObj = (*env).CallStaticObjectMethod(cipherClass,cipherInstanceMethodId,cipher_mode); 97 | 98 | jfieldID decryptModeFieldId = (*env).GetStaticFieldID(cipherClass,"DECRYPT_MODE", "I"); 99 | jint mode = (*env).GetStaticIntField(cipherClass,decryptModeFieldId); 100 | (*env).CallVoidMethod(cipherObj,cipherInitMethodId,mode,secretKeySpecObj); 101 | 102 | jmethodID doFinalMethodId = (*env).GetMethodID(cipherClass,"doFinal", "([B)[B"); 103 | jbyteArray text = (jbyteArray)(*env).CallObjectMethod(cipherObj,doFinalMethodId,srcData); 104 | return text; 105 | } 106 | ``` 107 | 108 | ### 4、加载 dex 文件 109 | 通过上面的解压和解密操作我们得到了原始的 dex 文件,我们将这些dex文件放进一个集合中,接下来使用类加载机制加载已经解密后的 dex 文件。关于类加载机制会在后续文章中讲解。 110 | ```java 111 | public static void loadDex(Application application,List dexFiles, File versionDir) throws Exception{ 112 | //1.先从 ClassLoader 中获取 pathList 的变量 113 | Field pathListField = ProxyUtils.findField(application.getClassLoader(), "pathList"); 114 | //1.1 得到 DexPathList 类 115 | Object pathList = pathListField.get(application.getClassLoader()); 116 | //1.2 从 DexPathList 类中拿到 dexElements 变量 117 | Field dexElementsField= ProxyUtils.findField(pathList,"dexElements"); 118 | //1.3 拿到已加载的 dex 数组 119 | Object[] dexElements=(Object[])dexElementsField.get(pathList); 120 | 121 | //2. 反射到初始化 dexElements 的方法,也就是得到加载 dex 到系统的方法 122 | Method makeDexElements= ProxyUtils.findMethod(pathList,"makePathElements",List.class,File.class,List.class); 123 | //2.1 实例化一个 集合 makePathElements 需要用到 124 | ArrayList suppressedExceptions = new ArrayList(); 125 | //2.2 反射执行 makePathElements 函数,把已解码的 dex 加载到系统,不然是打不开 dex 的,会导致 crash 126 | Object[] addElements=(Object[])makeDexElements.invoke(pathList,dexFiles,versionDir,suppressedExceptions); 127 | 128 | //3. 实例化一个新数组,用于将当前加载和已加载的 dex 合并成一个新的数组 129 | Object[] newElements= (Object[]) Array.newInstance(dexElements.getClass().getComponentType(),dexElements.length+addElements.length); 130 | //3.1 将系统中的已经加载的 dex 放入 newElements 中 131 | System.arraycopy(dexElements,0,newElements,0,dexElements.length); 132 | //3.2 将解密后已加载的 dex 放入新数组中 133 | System.arraycopy(addElements,0,newElements,dexElements.length,addElements.length); 134 | 135 | //4. 将合并的新数组重新设置给 DexPathList的 dexElements 136 | dexElementsField.set(pathList,newElements); 137 | } 138 | ``` 139 | ### 5、加载真实的 application 类,运行 app 140 | 1、首先从 AndroidManifest.xml 文件中获取到原 application 的类名。(在下一篇文章中会讲解我们如何将 apk 的原来的 application 类名放到 AndroidManifest.xml 的meta-data 标签下) 141 | ```java 142 | /** 143 | * 解析项目中原来的 Application 名称 144 | */ 145 | private void getMateData(){ 146 | try{ 147 | ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo(getPackageName(), 148 | PackageManager.GET_META_DATA);//获取包信息 149 | Bundle metaData = applicationInfo.metaData;//获取 Meta-data 的键值对信息 150 | if(null != metaData){ 151 | if(metaData.containsKey("app_name")){ 152 | app_name = metaData.getString("app_name");//获取原来的包名 153 | } 154 | } 155 | }catch (Exception e){ 156 | e.printStackTrace(); 157 | } 158 | } 159 | ``` 160 | 2、获取到原 application 的类名后就通过反射获取到 application 的实例。 161 | ``` 162 | private void bindRealApplication() throws Exception{ 163 | if(isBindReal){ 164 | return; 165 | } 166 | if(TextUtils.isEmpty(app_name)){ 167 | return; 168 | } 169 | //1、得到 attachBaseContext(context)传入的上下文 ContextImpl 170 | Context baseContext = getBaseContext(); 171 | //2、拿到真实 APK Application 的 class 172 | Class delegateClass = Class.forName(app_name); 173 | //反射实例化, 174 | delegate = (Application) delegateClass.newInstance(); 175 | //得到 Application attach() 方法 也就是最先初始化的 176 | Method attach = Application.class.getDeclaredMethod("attach",Context.class); 177 | attach.setAccessible(true); 178 | //执行 Application#attach(Context) 179 | attach.invoke(delegate,baseContext); 180 | 181 | // ContextImpl---->mOuterContext(app) 通过Application的attachBaseContext回调参数获取 182 | //4. 拿到 Context 的实现类 183 | Class contextImplClass = Class.forName("android.app.ContextImpl"); 184 | //4.1 获取 mOuterContext Context 属性 185 | Field mOuterContextField = contextImplClass.getDeclaredField("mOuterContext"); 186 | mOuterContextField.setAccessible(true); 187 | //4.2 将真实的 Application 交于 Context 中。这个根据源码执行,实例化 Application 下一个就行调用 setOuterContext 函数,所以需要绑定 Context 188 | // app = mActivityThread.mInstrumentation.newApplication( 189 | // cl, appClass, appContext); 190 | // appContext.setOuterContext(app); 191 | mOuterContextField.set(baseContext, delegate); 192 | 193 | // ActivityThread--->mAllApplications(ArrayList) ContextImpl的mMainThread属性 194 | //5. 拿到 ActivityThread 变量 195 | Field mMainThreadField = contextImplClass.getDeclaredField("mMainThread"); 196 | mMainThreadField.setAccessible(true); 197 | //5.1 拿到 ActivityThread 对象 198 | Object mMainThread = mMainThreadField.get(baseContext); 199 | 200 | // ActivityThread--->>mInitialApplication 201 | //6. 反射拿到 ActivityThread class 202 | Class activityThreadClass=Class.forName("android.app.ActivityThread"); 203 | //6.1 得到当前加载的 Application 类 204 | Field mInitialApplicationField = activityThreadClass.getDeclaredField("mInitialApplication"); 205 | mInitialApplicationField.setAccessible(true); 206 | //6.2 将 ActivityThread 中的 Applicaiton 替换为 真实的 Application 可以用于接收相应的声明周期和一些调用等 207 | mInitialApplicationField.set(mMainThread,delegate); 208 | 209 | 210 | // ActivityThread--->mAllApplications(ArrayList) ContextImpl的mMainThread属性 211 | //7. 拿到 ActivityThread 中所有的 Application 集合对象,这里是多进程的场景 212 | Field mAllApplicationsField = activityThreadClass.getDeclaredField("mAllApplications"); 213 | mAllApplicationsField.setAccessible(true); 214 | ArrayList mAllApplications =(ArrayList) mAllApplicationsField.get(mMainThread); 215 | //7.1 删除 ProxyApplication 216 | mAllApplications.remove(this); 217 | //7.2 添加真实的 Application 218 | mAllApplications.add(delegate); 219 | 220 | // LoadedApk------->mApplication ContextImpl的mPackageInfo属性 221 | //8. 从 ContextImpl 拿到 mPackageInfo 变量 222 | Field mPackageInfoField = contextImplClass.getDeclaredField("mPackageInfo"); 223 | mPackageInfoField.setAccessible(true); 224 | //8.1 拿到 LoadedApk 对象 225 | Object mPackageInfo=mPackageInfoField.get(baseContext); 226 | 227 | //9 反射得到 LoadedApk 对象 228 | // @Override 229 | // public Context getApplicationContext() { 230 | // return (mPackageInfo != null) ? 231 | // mPackageInfo.getApplication() : mMainThread.getApplication(); 232 | // } 233 | Class loadedApkClass=Class.forName("android.app.LoadedApk"); 234 | Field mApplicationField = loadedApkClass.getDeclaredField("mApplication"); 235 | mApplicationField.setAccessible(true); 236 | //9.1 将 LoadedApk 中的 Application 替换为 真实的 Application 237 | mApplicationField.set(mPackageInfo,delegate); 238 | 239 | //修改ApplicationInfo className LooadedApk 240 | 241 | //10. 拿到 LoadApk 中的 mApplicationInfo 变量 242 | Field mApplicationInfoField = loadedApkClass.getDeclaredField("mApplicationInfo"); 243 | mApplicationInfoField.setAccessible(true); 244 | //10.1 根据变量反射得到 ApplicationInfo 对象 245 | ApplicationInfo mApplicationInfo = (ApplicationInfo)mApplicationInfoField.get(mPackageInfo); 246 | //10.2 将我们真实的 APPlication ClassName 名称赋值于它 247 | mApplicationInfo.className=app_name; 248 | 249 | //11. 执行 代理 Application onCreate 声明周期 250 | delegate.onCreate(); 251 | 252 | //解码完成 253 | isBindReal = true; 254 | 255 | } 256 | ``` 257 | 至此 apk 的解密便结束了 258 | 259 | #### 参与贡献 260 | 261 | 1. Fork 本仓库 262 | 2. 新建 Feat_xxx 分支 263 | 3. 提交代码 264 | 4. 新建 Pull Request 265 | 266 | 267 | #### 特技 268 | 269 | 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 270 | 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 271 | 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 272 | 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 273 | 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 274 | 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) 275 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | id 'kotlin-android' 4 | } 5 | 6 | android { 7 | compileSdkVersion 30 8 | buildToolsVersion "30.0.3" 9 | 10 | defaultConfig { 11 | applicationId "com.sakuqi.apksteady" 12 | minSdkVersion 21 13 | targetSdkVersion 30 14 | versionCode 1 15 | versionName "1.0" 16 | 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 18 | externalNativeBuild { 19 | cmake { 20 | cppFlags '' 21 | } 22 | } 23 | } 24 | 25 | buildTypes { 26 | release { 27 | minifyEnabled false 28 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 29 | } 30 | } 31 | compileOptions { 32 | sourceCompatibility JavaVersion.VERSION_1_8 33 | targetCompatibility JavaVersion.VERSION_1_8 34 | } 35 | kotlinOptions { 36 | jvmTarget = '1.8' 37 | } 38 | externalNativeBuild { 39 | cmake { 40 | path file('src/main/cpp/CMakeLists.txt') 41 | version '3.10.2' 42 | } 43 | } 44 | buildFeatures { 45 | viewBinding true 46 | } 47 | } 48 | 49 | dependencies { 50 | 51 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 52 | implementation 'androidx.core:core-ktx:1.3.1' 53 | implementation 'androidx.appcompat:appcompat:1.2.0' 54 | implementation 'com.google.android.material:material:1.2.1' 55 | implementation 'androidx.constraintlayout:constraintlayout:2.0.1' 56 | implementation project(path: ':steady') 57 | testImplementation 'junit:junit:4.+' 58 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 59 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 60 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # For more information about using CMake with Android Studio, read the 2 | # documentation: https://d.android.com/studio/projects/add-native-code.html 3 | 4 | # Sets the minimum version of CMake required to build the native library. 5 | 6 | cmake_minimum_required(VERSION 3.10.2) 7 | 8 | # Declares and names the project. 9 | 10 | project("apksteady") 11 | 12 | # Creates and names a library, sets it as either STATIC 13 | # or SHARED, and provides the relative paths to its source code. 14 | # You can define multiple libraries, and CMake builds them for you. 15 | # Gradle automatically packages shared libraries with your APK. 16 | 17 | add_library( # Sets the name of the library. 18 | native-lib 19 | 20 | # Sets the library as a shared library. 21 | SHARED 22 | 23 | # Provides a relative path to your source file(s). 24 | native-lib.cpp ) 25 | 26 | # Searches for a specified prebuilt library and stores the path as a 27 | # variable. Because CMake includes system libraries in the search path by 28 | # default, you only need to specify the name of the public NDK library 29 | # you want to add. CMake verifies that the library exists before 30 | # completing its build. 31 | 32 | find_library( # Sets the name of the path variable. 33 | log-lib 34 | 35 | # Specifies the name of the NDK library that 36 | # you want CMake to locate. 37 | log ) 38 | 39 | # Specifies libraries CMake should link to your target library. You 40 | # can link multiple libraries, such as libraries you define in this 41 | # build script, prebuilt third-party libraries, or system libraries. 42 | 43 | target_link_libraries( # Specifies the target library. 44 | native-lib 45 | 46 | # Links the target library to the log library 47 | # included in the NDK. 48 | ${log-lib} ) -------------------------------------------------------------------------------- /app/src/main/cpp/native-lib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern "C" JNIEXPORT jstring JNICALL 5 | Java_com_sakuqi_apksteady_MainActivity_stringFromJNI( 6 | JNIEnv* env, 7 | jobject /* this */) { 8 | std::string hello = "Hello from C++"; 9 | return env->NewStringUTF(hello.c_str()); 10 | } -------------------------------------------------------------------------------- /app/src/main/java/com/sakuqi/apksteady/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.sakuqi.apksteady 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import android.widget.TextView 6 | import com.sakuqi.apksteady.databinding.ActivityMainBinding 7 | 8 | class MainActivity : AppCompatActivity() { 9 | 10 | private lateinit var binding: ActivityMainBinding 11 | 12 | override fun onCreate(savedInstanceState: Bundle?) { 13 | super.onCreate(savedInstanceState) 14 | 15 | binding = ActivityMainBinding.inflate(layoutInflater) 16 | setContentView(binding.root) 17 | 18 | // Example of a call to a native method 19 | binding.sampleText.text = stringFromJNI() 20 | } 21 | 22 | /** 23 | * A native method that is implemented by the 'native-lib' native library, 24 | * which is packaged with this application. 25 | */ 26 | external fun stringFromJNI(): String 27 | 28 | companion object { 29 | // Used to load the 'native-lib' library on application startup. 30 | init { 31 | System.loadLibrary("native-lib") 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ApkSteady 3 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | ext.kotlin_version = "1.5.20" 4 | repositories { 5 | google() 6 | mavenCentral() 7 | } 8 | dependencies { 9 | classpath "com.android.tools.build:gradle:4.2.1" 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | jcenter() // Warning: this repository is going to shut down soon 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Kotlin code style for this project: "official" or "obsolete": 19 | kotlin.code.style=official -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jul 12 15:28:20 CST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /local.properties: -------------------------------------------------------------------------------- 1 | ## This file is automatically generated by Android Studio. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file should *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 Gradle. 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | sdk.dir=/Users/huangdianhua/Library/Android/sdk -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "ApkSteady" 2 | include ':app' 3 | include ':steady' 4 | -------------------------------------------------------------------------------- /steady/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.library' 3 | id 'kotlin-android' 4 | } 5 | 6 | android { 7 | compileSdkVersion 30 8 | buildToolsVersion "30.0.3" 9 | 10 | defaultConfig { 11 | minSdkVersion 21 12 | targetSdkVersion 30 13 | versionCode 1 14 | versionName "1.0" 15 | 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | } 18 | 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | compileOptions { 26 | sourceCompatibility JavaVersion.VERSION_1_8 27 | targetCompatibility JavaVersion.VERSION_1_8 28 | } 29 | kotlinOptions { 30 | jvmTarget = '1.8' 31 | } 32 | externalNativeBuild { 33 | cmake { 34 | path file('src/main/cpp/CMakeLists.txt') 35 | } 36 | } 37 | } 38 | 39 | dependencies { 40 | 41 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 42 | implementation 'androidx.core:core-ktx:1.3.1' 43 | implementation 'androidx.appcompat:appcompat:1.2.0' 44 | implementation 'com.google.android.material:material:1.2.1' 45 | implementation 'androidx.constraintlayout:constraintlayout:2.0.1' 46 | testImplementation 'junit:junit:4.+' 47 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 48 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 49 | } -------------------------------------------------------------------------------- /steady/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /steady/src/androidTest/java/com/sakuqi/steady/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.sakuqi.steady 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.sakuqi.steady", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /steady/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /steady/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # For more information about using CMake with Android Studio, read the 2 | # documentation: https://d.android.com/studio/projects/add-native-code.html 3 | 4 | # Sets the minimum version of CMake required to build the native library. 5 | 6 | cmake_minimum_required(VERSION 3.10.2) 7 | 8 | # Declares and names the project. 9 | 10 | project("apksteady") 11 | 12 | # Creates and names a library, sets it as either STATIC 13 | # or SHARED, and provides the relative paths to its source code. 14 | # You can define multiple libraries, and CMake builds them for you. 15 | # Gradle automatically packages shared libraries with your APK. 16 | 17 | add_library( # Sets the name of the library. 18 | steady-lib 19 | 20 | # Sets the library as a shared library. 21 | SHARED 22 | 23 | # Provides a relative path to your source file(s). 24 | steady-lib.cpp) 25 | 26 | # Searches for a specified prebuilt library and stores the path as a 27 | # variable. Because CMake includes system libraries in the search path by 28 | # default, you only need to specify the name of the public NDK library 29 | # you want to add. CMake verifies that the library exists before 30 | # completing its build. 31 | 32 | find_library( # Sets the name of the path variable. 33 | log-lib 34 | 35 | # Specifies the name of the NDK library that 36 | # you want CMake to locate. 37 | log ) 38 | 39 | # Specifies libraries CMake should link to your target library. You 40 | # can link multiple libraries, such as libraries you define in this 41 | # build script, prebuilt third-party libraries, or system libraries. 42 | 43 | target_link_libraries( # Specifies the target library. 44 | steady-lib 45 | 46 | # Links the target library to the log library 47 | # included in the NDK. 48 | ${log-lib} ) -------------------------------------------------------------------------------- /steady/src/main/cpp/steady-lib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define TAG "steady-jni" 6 | // 定义debug信息 7 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,TAG,__VA_ARGS__) 8 | // 定义error信息 9 | #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,TAG,__VA_ARGS__) 10 | // 定义info信息 11 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO,TAG,__VA_ARGS__) 12 | 13 | jbyteArray readClassesDexFromApk(JNIEnv *pEnv, jobject pJobject); 14 | 15 | void 16 | extraTargetZipFileFromDex(JNIEnv *env, jobject obj, jstring fileName, jbyteArray classesDexData); 17 | 18 | jbyteArray decrypt(JNIEnv *env,jbyteArray srcData); 19 | 20 | extern "C" JNIEXPORT jstring JNICALL 21 | Java_com_sakuqi_apksteady_MainActivity_stringFromJNI( 22 | JNIEnv* env, 23 | jobject /* this */) { 24 | std::string hello = "Hello from C++"; 25 | return env->NewStringUTF(hello.c_str()); 26 | } 27 | 28 | jbyteArray decrypt(JNIEnv *env,jbyteArray srcData) { 29 | jstring type = (*env).NewStringUTF("AES"); 30 | jstring cipher_mode = (*env).NewStringUTF("AES/ECB/PKCS5Padding"); 31 | jbyteArray pwd = (*env).NewByteArray(16); 32 | char *master_key = (char *) "huangdh'l,.AMWK;"; 33 | (*env).SetByteArrayRegion(pwd,0,16,reinterpret_cast(master_key)); 34 | 35 | jclass secretKeySpecClass = (*env).FindClass("javax/crypto/spec/SecretKeySpec"); 36 | jmethodID secretKeySpecMethodId = (*env).GetMethodID(secretKeySpecClass,"", "([BLjava/lang/String;)V"); 37 | jobject secretKeySpecObj = (*env).NewObject(secretKeySpecClass,secretKeySpecMethodId,pwd,type); 38 | 39 | jclass cipherClass = (*env).FindClass("javax/crypto/Cipher"); 40 | jmethodID cipherInitMethodId = (*env).GetMethodID(cipherClass,"init", "(ILjava/security/Key;)V"); 41 | jmethodID cipherInstanceMethodId = (*env).GetStaticMethodID(cipherClass,"getInstance", "(Ljava/lang/String;)Ljavax/crypto/Cipher;"); 42 | jobject cipherObj = (*env).CallStaticObjectMethod(cipherClass,cipherInstanceMethodId,cipher_mode); 43 | 44 | jfieldID decryptModeFieldId = (*env).GetStaticFieldID(cipherClass,"DECRYPT_MODE", "I"); 45 | jint mode = (*env).GetStaticIntField(cipherClass,decryptModeFieldId); 46 | (*env).CallVoidMethod(cipherObj,cipherInitMethodId,mode,secretKeySpecObj); 47 | 48 | jmethodID doFinalMethodId = (*env).GetMethodID(cipherClass,"doFinal", "([B)[B"); 49 | jbyteArray text = (jbyteArray)(*env).CallObjectMethod(cipherObj,doFinalMethodId,srcData); 50 | return text; 51 | } 52 | 53 | jbyteArray readClassesDexFromApk(JNIEnv *env, jobject obj) { 54 | jclass byteArryOutputStreamClass = (*env).FindClass("java/io/ByteArrayOutputStream"); 55 | jmethodID byteArrayOutputStreamMethodID = (*env).GetMethodID(byteArryOutputStreamClass,"","()V"); 56 | jmethodID writeMethodId = (*env).GetMethodID(byteArryOutputStreamClass,"write","([BII)V"); 57 | jmethodID toByteArrayMethodId = (*env).GetMethodID(byteArryOutputStreamClass,"toByteArray","()[B"); 58 | jobject byteArrayOutputStreamObj = (*env).NewObject(byteArryOutputStreamClass,byteArrayOutputStreamMethodID); 59 | jclass applicationClass = (*env).GetObjectClass(obj); 60 | jmethodID getApplicationInfoMethodId = (*env).GetMethodID(applicationClass,"getApplicationInfo","()Landroid/content/pm/ApplicationInfo;"); 61 | jobject applicationInfoObj = (*env) . CallObjectMethod(obj,getApplicationInfoMethodId); 62 | 63 | jclass applicationInfoClass = (*env).GetObjectClass(applicationInfoObj); 64 | jfieldID sourceDirFieldId = (*env).GetFieldID(applicationInfoClass,"sourceDir","Ljava/lang/String;"); 65 | jstring sourceDirString = (jstring)(*env).GetObjectField(applicationInfoObj,sourceDirFieldId); 66 | const char* str = (*env).GetStringUTFChars(sourceDirString,0); 67 | 68 | jclass fileInputStreamClass = (*env).FindClass("java/io/FileInputStream"); 69 | jmethodID fileInputStreamMethodId = (*env).GetMethodID(fileInputStreamClass,"","(Ljava/lang/String;)V"); 70 | jobject fileInputStreamObj = (*env).NewObject(fileInputStreamClass,fileInputStreamMethodId,sourceDirString); 71 | 72 | jclass bufferedInputStreamClass = (*env).FindClass("java/io/BufferedInputStream"); 73 | jmethodID bufferedInputStreamMethodId = (*env).GetMethodID(bufferedInputStreamClass,"","(Ljava/io/InputStream;)V"); 74 | jobject bufferedInputStreamObj = (*env).NewObject(bufferedInputStreamClass,bufferedInputStreamMethodId,fileInputStreamObj); 75 | 76 | jclass zipInputStreamClass = (*env).FindClass("java/util/zip/ZipInputStream"); 77 | jmethodID zipInputStreamMethodID = (*env).GetMethodID(zipInputStreamClass,"","(Ljava/io/InputStream;)V"); 78 | jobject zipInputStreamObj = (*env).NewObject(zipInputStreamClass,zipInputStreamMethodID,bufferedInputStreamObj); 79 | 80 | jmethodID closeMethodId = (*env).GetMethodID(zipInputStreamClass,"close","()V"); 81 | jmethodID readMethodId = (*env).GetMethodID(zipInputStreamClass,"read","([B)I"); 82 | jmethodID getNextEntryMethodID = (*env).GetMethodID(zipInputStreamClass,"getNextEntry","()Ljava/util/zip/ZipEntry;"); 83 | jmethodID closeEntryMethodID = (*env).GetMethodID(zipInputStreamClass,"closeEntry","()V"); 84 | 85 | jclass zipEntryClass = (*env).FindClass("java/util/zip/ZipEntry"); 86 | jmethodID getNameMethodId = (*env).GetMethodID(zipEntryClass,"getName","()Ljava/lang/String;"); 87 | while (1){ 88 | jobject zipEntryObj = (*env).CallObjectMethod(zipInputStreamObj,getNextEntryMethodID); 89 | if(zipEntryObj == NULL){ 90 | (*env).CallVoidMethod(zipInputStreamObj,closeMethodId); 91 | break; 92 | } 93 | jstring entryName = (jstring)(*env).CallObjectMethod(zipEntryObj,getNameMethodId); 94 | const char* entryNameStr = (*env).GetStringUTFChars(entryName,0); 95 | if(strcmp(entryNameStr,"classes.dex") == 0){ 96 | jbyteArray buffer = (*env).NewByteArray(1024); 97 | while (1){ 98 | int ret = (*env).CallIntMethod(zipInputStreamObj,readMethodId,buffer); 99 | if(-1 == ret){ 100 | break; 101 | } 102 | (*env).CallVoidMethod(byteArrayOutputStreamObj,writeMethodId,buffer,0,ret); 103 | } 104 | (*env).ReleaseStringUTFChars(entryName,entryNameStr); 105 | (*env).CallVoidMethod(zipInputStreamObj,closeEntryMethodID); 106 | break; 107 | } 108 | (*env).ReleaseStringUTFChars(entryName,entryNameStr); 109 | (*env).DeleteLocalRef(entryName); 110 | (*env).DeleteLocalRef(zipEntryObj); 111 | (*env).CallVoidMethod(zipInputStreamObj,closeEntryMethodID); 112 | } 113 | (*env).CallVoidMethod(zipInputStreamObj,closeMethodId); 114 | (*env).ReleaseStringUTFChars(sourceDirString,str); 115 | 116 | jbyteArray retArray = (jbyteArray)(*env).CallObjectMethod(byteArrayOutputStreamObj,toByteArrayMethodId); 117 | return retArray; 118 | } 119 | 120 | void extraTargetZipFileFromDex(JNIEnv *env, jobject obj,jbyteArray classesDexData, jstring targetFileName) { 121 | jsize dexLen = (*env).GetArrayLength(classesDexData); 122 | jbyteArray targetZipLenArray = (*env).NewByteArray(4); 123 | jclass systemClass = (*env).FindClass("java/lang/System"); 124 | jmethodID arrayCopyMethodId = (*env).GetStaticMethodID(systemClass,"arraycopy", "(Ljava/lang/Object;ILjava/lang/Object;II)V"); 125 | (*env).CallStaticVoidMethod(systemClass,arrayCopyMethodId,classesDexData,dexLen-4,targetZipLenArray,0,4); 126 | 127 | jclass baisClass = (*env).FindClass("java/io/ByteArrayInputStream"); 128 | jmethodID baisMethodId = (*env).GetMethodID(baisClass,"", "([B)V"); 129 | jobject bsisObj = (*env).NewObject(baisClass,baisMethodId,targetZipLenArray); 130 | 131 | jclass dataInputStreamClass = (*env).FindClass("java/io/DataInputStream"); 132 | jmethodID dataInputStreamMethodID = (*env).GetMethodID(dataInputStreamClass,"", "(Ljava/io/InputStream;)V"); 133 | jmethodID readIntMethodId = (*env).GetMethodID(dataInputStreamClass,"readLong", "()J"); 134 | jobject dataInputStreamObj = (*env).NewObject(dataInputStreamClass,dataInputStreamMethodID,bsisObj); 135 | long targetZipLen = (*env).CallLongMethod(dataInputStreamObj,readIntMethodId); 136 | 137 | jbyteArray targetZipData = (*env).NewByteArray(targetZipLen); 138 | (*env).CallStaticVoidMethod(systemClass,arrayCopyMethodId,classesDexData,dexLen-targetZipLen-4,targetZipData,0,targetZipLen); 139 | 140 | jbyteArray decodedTargetZipData = decrypt(env,targetZipData); 141 | jclass fileClass = (*env).FindClass("java/io/File"); 142 | jmethodID fileMethodId = (*env).GetMethodID(fileClass,"", "(Ljava/lang/String;)V"); 143 | jobject fileObj = (*env).NewObject(fileClass,fileMethodId,targetFileName); 144 | 145 | jclass fileOutputStreamClass = (*env).FindClass("java/io/FileOutputStream"); 146 | jmethodID fileOutputStreamMethodId = (*env).GetMethodID(fileOutputStreamClass,"", "(Ljava/io/File;)V"); 147 | jmethodID fos_write_methodId = (*env).GetMethodID(fileOutputStreamClass,"write", "([B)V"); 148 | jmethodID fos_flush_methodId = (*env).GetMethodID(fileOutputStreamClass,"flush","()V"); 149 | jmethodID fos_close_methodId = (*env).GetMethodID(fileOutputStreamClass,"close", "()V"); 150 | 151 | jobject fileOutputStreamObj = (*env).NewObject(fileOutputStreamClass,fileOutputStreamMethodId,fileObj); 152 | (*env).CallVoidMethod(fileOutputStreamObj,fos_write_methodId,decodedTargetZipData); 153 | (*env).CallVoidMethod(fileOutputStreamObj,fos_flush_methodId); 154 | (*env).CallVoidMethod(fileOutputStreamObj,fos_close_methodId); 155 | 156 | } 157 | 158 | 159 | extern "C" 160 | JNIEXPORT void JNICALL 161 | Java_com_sakuqi_steady_SteadyApplication_unsteady(JNIEnv *env, jobject obj, jstring apk_file, 162 | jobject application) { 163 | //创建一个解压 APK 的内部目录 164 | jclass contextWrapperClass = (*env) . FindClass("android/content/ContextWrapper"); 165 | jmethodID getDirMethodId = (*env).GetMethodID(contextWrapperClass,"getDir","(Ljava/lang/String;I)Ljava/io/File;"); 166 | jstring path_name = (*env).NewStringUTF("steady"); 167 | jclass contextClass = (*env).FindClass("android/content/Context"); 168 | jfieldID fid = (*env) . GetStaticFieldID(contextClass,"MODE_PRIVATE","I"); 169 | jint i = (*env).GetStaticIntField(contextClass,fid); 170 | jobject fileDir = (*env).CallObjectMethod(application,getDirMethodId,path_name,i); 171 | 172 | jclass fileClass = (*env) .FindClass("java/io/File"); 173 | jmethodID getAbsolutePath_methodID = (*env).GetMethodID(fileClass,"getAbsolutePath","()Ljava/lang/String;"); 174 | jstring odexPath = (jstring)(*env).CallObjectMethod(fileDir,getAbsolutePath_methodID); 175 | const char *path = env -> GetStringUTFChars(odexPath,0); 176 | LOGD("odexPath=%s",path); 177 | jclass stringBufferClass = (*env).FindClass("java/lang/StringBuffer"); 178 | jmethodID initStringBufferMethod = (*env).GetMethodID(stringBufferClass,"","()V"); 179 | jobject stringBufferObj = (*env).NewObject(stringBufferClass,initStringBufferMethod); 180 | jmethodID append_methodId = (*env).GetMethodID(stringBufferClass,"append","(Ljava/lang/String;)Ljava/lang/StringBuffer;"); 181 | 182 | (*env) . CallObjectMethod(stringBufferObj,append_methodId,odexPath); 183 | jstring zip_str = (*env).NewStringUTF("/TargetApk.zip"); 184 | (*env).CallObjectMethod(stringBufferObj,append_methodId,zip_str); 185 | 186 | jmethodID toString_methodId = (*env).GetMethodID(stringBufferClass,"toString","()Ljava/lang/String;"); 187 | jstring targetFileName = (jstring)(*env).CallObjectMethod(stringBufferObj,toString_methodId); 188 | 189 | jmethodID initFile_methodId = (*env).GetMethodID(fileClass,"","(Ljava/lang/String;)V"); 190 | jobject targetApkZipFileObj = (*env).NewObject(fileClass,initFile_methodId,targetFileName); 191 | 192 | jmethodID createNewFile_methodID = (*env).GetMethodID(fileClass,"createNewFile","()Z"); 193 | (*env).CallBooleanMethod(targetApkZipFileObj,createNewFile_methodID); 194 | 195 | jbyteArray classesDexData = readClassesDexFromApk(env,obj); 196 | extraTargetZipFileFromDex(env,obj,classesDexData,targetFileName); 197 | 198 | } 199 | 200 | extern "C" 201 | JNIEXPORT jbyteArray JNICALL 202 | Java_com_sakuqi_steady_SteadyApplication_decrypt(JNIEnv *env, jobject thiz, jbyteArray data) { 203 | jbyteArray text = decrypt(env,data); 204 | return text; 205 | } -------------------------------------------------------------------------------- /steady/src/main/java/com/sakuqi/steady/ClassLoaderUtils.java: -------------------------------------------------------------------------------- 1 | package com.sakuqi.steady; 2 | 3 | import android.app.Application; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.lang.reflect.Array; 8 | import java.lang.reflect.Field; 9 | import java.lang.reflect.Method; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * author: huangDianHua 15 | * time: 2021/7/1 09:29:27 16 | * description: 17 | */ 18 | public class ClassLoaderUtils { 19 | public static void loadDex(Application application,List dexFiles, File versionDir) throws Exception{ 20 | //1.先从 ClassLoader 中获取 pathList 的变量 21 | Field pathListField = ProxyUtils.findField(application.getClassLoader(), "pathList"); 22 | //1.1 得到 DexPathList 类 23 | Object pathList = pathListField.get(application.getClassLoader()); 24 | //1.2 从 DexPathList 类中拿到 dexElements 变量 25 | Field dexElementsField= ProxyUtils.findField(pathList,"dexElements"); 26 | //1.3 拿到已加载的 dex 数组 27 | Object[] dexElements=(Object[])dexElementsField.get(pathList); 28 | 29 | //2. 反射到初始化 dexElements 的方法,也就是得到加载 dex 到系统的方法 30 | Method makeDexElements= ProxyUtils.findMethod(pathList,"makePathElements",List.class,File.class,List.class); 31 | //2.1 实例化一个 集合 makePathElements 需要用到 32 | ArrayList suppressedExceptions = new ArrayList(); 33 | //2.2 反射执行 makePathElements 函数,把已解码的 dex 加载到系统,不然是打不开 dex 的,会导致 crash 34 | Object[] addElements=(Object[])makeDexElements.invoke(pathList,dexFiles,versionDir,suppressedExceptions); 35 | 36 | //3. 实例化一个新数组,用于将当前加载和已加载的 dex 合并成一个新的数组 37 | Object[] newElements= (Object[]) Array.newInstance(dexElements.getClass().getComponentType(),dexElements.length+addElements.length); 38 | //3.1 将系统中的已经加载的 dex 放入 newElements 中 39 | System.arraycopy(dexElements,0,newElements,0,dexElements.length); 40 | //3.2 将解密后已加载的 dex 放入新数组中 41 | System.arraycopy(addElements,0,newElements,dexElements.length,addElements.length); 42 | 43 | //4. 将合并的新数组重新设置给 DexPathList的 dexElements 44 | dexElementsField.set(pathList,newElements); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /steady/src/main/java/com/sakuqi/steady/ProxyUtils.java: -------------------------------------------------------------------------------- 1 | package com.sakuqi.steady; 2 | 3 | import java.io.File; 4 | import java.io.RandomAccessFile; 5 | import java.lang.reflect.Field; 6 | import java.lang.reflect.Method; 7 | import java.util.Arrays; 8 | 9 | 10 | public class ProxyUtils { 11 | 12 | /** 13 | * 读取文件 14 | * @param file 15 | * @return 16 | * @throws Exception 17 | */ 18 | public static byte[] getBytes(File file) throws Exception { 19 | RandomAccessFile r = new RandomAccessFile(file, "r"); 20 | byte[] buffer = new byte[(int) r.length()]; 21 | r.readFully(buffer); 22 | r.close(); 23 | return buffer; 24 | } 25 | 26 | /** 27 | * 反射获得 指定对象(当前-》父类-》父类...)中的 成员属性 28 | * @param instance 29 | * @param name 30 | * @return 31 | * @throws NoSuchFieldException 32 | */ 33 | public static Field findField(Object instance, String name) throws NoSuchFieldException { 34 | Class clazz = instance.getClass(); 35 | //反射获得 36 | while (clazz != null) { 37 | try { 38 | Field field = clazz.getDeclaredField(name); 39 | //如果无法访问 设置为可访问 40 | if (!field.isAccessible()) { 41 | field.setAccessible(true); 42 | } 43 | return field; 44 | } catch (NoSuchFieldException e) { 45 | //如果找不到往父类找 46 | clazz = clazz.getSuperclass(); 47 | } 48 | } 49 | throw new NoSuchFieldException("Field " + name + " not found in " + instance.getClass()); 50 | } 51 | 52 | 53 | /** 54 | * 反射获得 指定对象(当前-》父类-》父类...)中的 函数 55 | * @param instance 56 | * @param name 57 | * @param parameterTypes 58 | * @return 59 | * @throws NoSuchMethodException 60 | */ 61 | public static Method findMethod(Object instance, String name, Class... parameterTypes) 62 | throws NoSuchMethodException { 63 | Class clazz = instance.getClass(); 64 | while (clazz != null) { 65 | try { 66 | Method method = clazz.getDeclaredMethod(name, parameterTypes); 67 | if (!method.isAccessible()) { 68 | method.setAccessible(true); 69 | } 70 | return method; 71 | } catch (NoSuchMethodException e) { 72 | //如果找不到往父类找 73 | clazz = clazz.getSuperclass(); 74 | } 75 | } 76 | throw new NoSuchMethodException("Method " + name + " with parameters " + Arrays.asList 77 | (parameterTypes) + " not found in " + instance.getClass()); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /steady/src/main/java/com/sakuqi/steady/SteadyApplication.java: -------------------------------------------------------------------------------- 1 | package com.sakuqi.steady; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import android.content.pm.ApplicationInfo; 6 | import android.content.pm.PackageManager; 7 | import android.os.Bundle; 8 | import android.os.SystemClock; 9 | import android.text.TextUtils; 10 | import android.util.Log; 11 | 12 | import java.io.File; 13 | import java.io.FileOutputStream; 14 | import java.lang.reflect.Field; 15 | import java.lang.reflect.Method; 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | /** 20 | * author: huangDianHua 21 | * time: 2021/7/13 10:31:44 22 | * description:加固解码入口 23 | */ 24 | public class SteadyApplication extends Application { 25 | public static final String TAG = "SteadyApplication"; 26 | public String app_name; 27 | static { 28 | System.loadLibrary("steady-lib"); 29 | } 30 | @Override 31 | protected void attachBaseContext(Context base) { 32 | super.attachBaseContext(base); 33 | long startTime = SystemClock.currentThreadTimeMillis(); 34 | getMateData(); 35 | //获得加密的 APK 文件 36 | File apkFile = new File(getApplicationInfo().sourceDir); 37 | File versionDir = getDir("SteadyDir",Context.MODE_PRIVATE); 38 | //用于存放解压后的apk文件 39 | File appDir = new File(versionDir,"app"); 40 | //用户存放解密后的dex文件 41 | File dexDir = new File(appDir,"dexDir"); 42 | 43 | List dexFiles = new ArrayList<>(); 44 | if(!dexDir.exists() || dexDir.list().length == 0){ 45 | Zip.unZip(apkFile,appDir); 46 | //获取目录下的所以文件 47 | File[] files = appDir.listFiles(); 48 | for (File file:files){ 49 | String name = file.getName(); 50 | if(name.endsWith(".dex") && !TextUtils.equals(name,"classes.dex")){ 51 | try{ 52 | byte[] bytes = ProxyUtils.getBytes(file); 53 | byte[] decrypt = decrypt(bytes); 54 | if(!dexDir.exists()){ 55 | dexDir.mkdirs(); 56 | } 57 | File file1 = new File(dexDir,name); 58 | FileOutputStream fos = new FileOutputStream(file1); 59 | fos.write(decrypt); 60 | fos.flush(); 61 | fos.close(); 62 | dexFiles.add(file1); 63 | }catch (Exception e){ 64 | e.printStackTrace(); 65 | } 66 | } 67 | } 68 | }else{ 69 | for (File file:dexDir.listFiles()){ 70 | dexFiles.add(file); 71 | } 72 | } 73 | 74 | try{ 75 | ClassLoaderUtils.loadDex(this,dexFiles,versionDir); 76 | long endTime = SystemClock.currentThreadTimeMillis()-startTime; 77 | Log.d(TAG,"解密完成!共耗时:"+endTime+"ms"); 78 | }catch (Exception e){ 79 | e.printStackTrace(); 80 | } 81 | 82 | } 83 | 84 | /** 85 | * 解析项目中原来的 Application 名称 86 | */ 87 | private void getMateData(){ 88 | try{ 89 | ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo(getPackageName(), 90 | PackageManager.GET_META_DATA); 91 | Bundle metaData = applicationInfo.metaData; 92 | if(null != metaData){ 93 | if(metaData.containsKey("app_name")){ 94 | app_name = metaData.getString("app_name"); 95 | } 96 | } 97 | }catch (Exception e){ 98 | e.printStackTrace(); 99 | } 100 | } 101 | 102 | @Override 103 | public void onCreate() { 104 | super.onCreate(); 105 | try { 106 | bindRealApplication(); 107 | } catch (Exception e) { 108 | e.printStackTrace(); 109 | } 110 | } 111 | 112 | boolean isBindReal; 113 | Application delegate; 114 | 115 | private void bindRealApplication() throws Exception{ 116 | if(isBindReal){ 117 | return; 118 | } 119 | if(TextUtils.isEmpty(app_name)){ 120 | return; 121 | } 122 | //1、得到 attachBaseContext(context)传入的上下文 ContextImpl 123 | Context baseContext = getBaseContext(); 124 | //2、拿到真实 APK Application 的 class 125 | Class delegateClass = Class.forName(app_name); 126 | //反射实例化, 127 | delegate = (Application) delegateClass.newInstance(); 128 | //得到 Application attach() 方法 也就是最先初始化的 129 | Method attach = Application.class.getDeclaredMethod("attach",Context.class); 130 | attach.setAccessible(true); 131 | //执行 Application#attach(Context) 132 | attach.invoke(delegate,baseContext); 133 | 134 | // ContextImpl---->mOuterContext(app) 通过Application的attachBaseContext回调参数获取 135 | //4. 拿到 Context 的实现类 136 | Class contextImplClass = Class.forName("android.app.ContextImpl"); 137 | //4.1 获取 mOuterContext Context 属性 138 | Field mOuterContextField = contextImplClass.getDeclaredField("mOuterContext"); 139 | mOuterContextField.setAccessible(true); 140 | //4.2 将真实的 Application 交于 Context 中。这个根据源码执行,实例化 Application 下一个就行调用 setOuterContext 函数,所以需要绑定 Context 141 | // app = mActivityThread.mInstrumentation.newApplication( 142 | // cl, appClass, appContext); 143 | // appContext.setOuterContext(app); 144 | mOuterContextField.set(baseContext, delegate); 145 | 146 | // ActivityThread--->mAllApplications(ArrayList) ContextImpl的mMainThread属性 147 | //5. 拿到 ActivityThread 变量 148 | Field mMainThreadField = contextImplClass.getDeclaredField("mMainThread"); 149 | mMainThreadField.setAccessible(true); 150 | //5.1 拿到 ActivityThread 对象 151 | Object mMainThread = mMainThreadField.get(baseContext); 152 | 153 | // ActivityThread--->>mInitialApplication 154 | //6. 反射拿到 ActivityThread class 155 | Class activityThreadClass=Class.forName("android.app.ActivityThread"); 156 | //6.1 得到当前加载的 Application 类 157 | Field mInitialApplicationField = activityThreadClass.getDeclaredField("mInitialApplication"); 158 | mInitialApplicationField.setAccessible(true); 159 | //6.2 将 ActivityThread 中的 Applicaiton 替换为 真实的 Application 可以用于接收相应的声明周期和一些调用等 160 | mInitialApplicationField.set(mMainThread,delegate); 161 | 162 | 163 | // ActivityThread--->mAllApplications(ArrayList) ContextImpl的mMainThread属性 164 | //7. 拿到 ActivityThread 中所有的 Application 集合对象,这里是多进程的场景 165 | Field mAllApplicationsField = activityThreadClass.getDeclaredField("mAllApplications"); 166 | mAllApplicationsField.setAccessible(true); 167 | ArrayList mAllApplications =(ArrayList) mAllApplicationsField.get(mMainThread); 168 | //7.1 删除 ProxyApplication 169 | mAllApplications.remove(this); 170 | //7.2 添加真实的 Application 171 | mAllApplications.add(delegate); 172 | 173 | // LoadedApk------->mApplication ContextImpl的mPackageInfo属性 174 | //8. 从 ContextImpl 拿到 mPackageInfo 变量 175 | Field mPackageInfoField = contextImplClass.getDeclaredField("mPackageInfo"); 176 | mPackageInfoField.setAccessible(true); 177 | //8.1 拿到 LoadedApk 对象 178 | Object mPackageInfo=mPackageInfoField.get(baseContext); 179 | 180 | //9 反射得到 LoadedApk 对象 181 | // @Override 182 | // public Context getApplicationContext() { 183 | // return (mPackageInfo != null) ? 184 | // mPackageInfo.getApplication() : mMainThread.getApplication(); 185 | // } 186 | Class loadedApkClass=Class.forName("android.app.LoadedApk"); 187 | Field mApplicationField = loadedApkClass.getDeclaredField("mApplication"); 188 | mApplicationField.setAccessible(true); 189 | //9.1 将 LoadedApk 中的 Application 替换为 真实的 Application 190 | mApplicationField.set(mPackageInfo,delegate); 191 | 192 | //修改ApplicationInfo className LooadedApk 193 | 194 | //10. 拿到 LoadApk 中的 mApplicationInfo 变量 195 | Field mApplicationInfoField = loadedApkClass.getDeclaredField("mApplicationInfo"); 196 | mApplicationInfoField.setAccessible(true); 197 | //10.1 根据变量反射得到 ApplicationInfo 对象 198 | ApplicationInfo mApplicationInfo = (ApplicationInfo)mApplicationInfoField.get(mPackageInfo); 199 | //10.2 将我们真实的 APPlication ClassName 名称赋值于它 200 | mApplicationInfo.className=app_name; 201 | 202 | //11. 执行 代理 Application onCreate 声明周期 203 | delegate.onCreate(); 204 | 205 | //解码完成 206 | isBindReal = true; 207 | 208 | } 209 | 210 | /** 211 | * 让代码走入if中的第三段中 212 | * @return 213 | */ 214 | @Override 215 | public String getPackageName() { 216 | if(!TextUtils.isEmpty(app_name)){ 217 | return ""; 218 | } 219 | return super.getPackageName(); 220 | } 221 | 222 | /** 223 | * 这个函数是如果在 AndroidManifest.xml 中定义了 ContentProvider 那么就会执行此处 : installProvider,简介调用该函数 224 | * @param packageName 225 | * @param flags 226 | * @return 227 | * @throws PackageManager.NameNotFoundException 228 | */ 229 | @Override 230 | public Context createPackageContext(String packageName, int flags) throws PackageManager.NameNotFoundException { 231 | if(TextUtils.isEmpty(app_name)){ 232 | return super.createPackageContext(packageName, flags); 233 | } 234 | try { 235 | bindRealApplication(); 236 | } catch (Exception e) { 237 | e.printStackTrace(); 238 | } 239 | return delegate; 240 | 241 | } 242 | 243 | public native byte[] decrypt(byte[] data); 244 | } 245 | -------------------------------------------------------------------------------- /steady/src/main/java/com/sakuqi/steady/Zip.java: -------------------------------------------------------------------------------- 1 | package com.sakuqi.steady; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileOutputStream; 6 | import java.io.InputStream; 7 | import java.util.Enumeration; 8 | import java.util.zip.CRC32; 9 | import java.util.zip.CheckedOutputStream; 10 | import java.util.zip.ZipEntry; 11 | import java.util.zip.ZipFile; 12 | import java.util.zip.ZipOutputStream; 13 | 14 | 15 | public class Zip { 16 | 17 | private static void deleteFile(File file){ 18 | if (file.isDirectory()){ 19 | File[] files = file.listFiles(); 20 | for (File f: files) { 21 | deleteFile(f); 22 | } 23 | }else{ 24 | file.delete(); 25 | } 26 | } 27 | 28 | /** 29 | * 解压zip文件至dir目录 30 | * @param zip 31 | * @param dir 32 | */ 33 | public static void unZip(File zip, File dir) { 34 | try { 35 | //清空存放解压文件的目录 36 | deleteFile(dir); 37 | ZipFile zipFile = new ZipFile(zip); 38 | //zip文件中每一个条目 39 | Enumeration entries = zipFile.entries(); 40 | //遍历 41 | while (entries.hasMoreElements()) { 42 | ZipEntry zipEntry = entries.nextElement(); 43 | //zip中 文件/目录名 44 | String name = zipEntry.getName(); 45 | //原来的签名文件 不需要了 46 | if (name.equals("META-INF/CERT.RSA") || name.equals("META-INF/CERT.SF") || name 47 | .equals("META-INF/MANIFEST.MF")) { 48 | continue; 49 | } 50 | //空目录不管 51 | if (!zipEntry.isDirectory()) { 52 | File file = new File(dir, name); 53 | //创建目录 54 | if (!file.getParentFile().exists()) { 55 | file.getParentFile().mkdirs(); 56 | } 57 | //写文件 58 | FileOutputStream fos = new FileOutputStream(file); 59 | InputStream is = zipFile.getInputStream(zipEntry); 60 | byte[] buffer = new byte[2048]; 61 | int len; 62 | while ((len = is.read(buffer)) != -1) { 63 | fos.write(buffer, 0, len); 64 | } 65 | is.close(); 66 | fos.close(); 67 | } 68 | } 69 | zipFile.close(); 70 | } catch (Exception e) { 71 | e.printStackTrace(); 72 | } 73 | } 74 | 75 | /** 76 | * 压缩目录为zip 77 | * @param dir 待压缩目录 78 | * @param zip 输出的zip文件 79 | * @throws Exception 80 | */ 81 | public static void zip(File dir, File zip) throws Exception { 82 | zip.delete(); 83 | // 对输出文件做CRC32校验 84 | CheckedOutputStream cos = new CheckedOutputStream(new FileOutputStream( 85 | zip), new CRC32()); 86 | ZipOutputStream zos = new ZipOutputStream(cos); 87 | //压缩 88 | compress(dir, zos, ""); 89 | zos.flush(); 90 | zos.close(); 91 | } 92 | 93 | /** 94 | * 添加目录/文件 至zip中 95 | * @param srcFile 需要添加的目录/文件 96 | * @param zos zip输出流 97 | * @param basePath 递归子目录时的完整目录 如 lib/x86 98 | * @throws Exception 99 | */ 100 | private static void compress(File srcFile, ZipOutputStream zos, 101 | String basePath) throws Exception { 102 | if (srcFile.isDirectory()) { 103 | File[] files = srcFile.listFiles(); 104 | for (File file : files) { 105 | // zip 递归添加目录中的文件 106 | compress(file, zos, basePath + srcFile.getName() + "/"); 107 | } 108 | } else { 109 | compressFile(srcFile, zos, basePath); 110 | } 111 | } 112 | 113 | private static void compressFile(File file, ZipOutputStream zos, String dir) 114 | throws Exception { 115 | // temp/lib/x86/libdn_ssl.so 116 | String fullName = dir + file.getName(); 117 | // 需要去掉temp 118 | String[] fileNames = fullName.split("/"); 119 | //正确的文件目录名 (去掉了temp) 120 | StringBuffer sb = new StringBuffer(); 121 | if (fileNames.length > 1){ 122 | for (int i = 1;i 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /steady/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /steady/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /steady/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /steady/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/steady/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /steady/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/steady/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /steady/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/steady/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /steady/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/steady/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /steady/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/steady/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /steady/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/steady/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /steady/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/steady/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /steady/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/steady/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /steady/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/steady/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /steady/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openJK-dev/AppJiagu-Android/c9551d95e34bb4844a0a4bfbadb9f38fde573a82/steady/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /steady/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /steady/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /steady/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | steady 3 | -------------------------------------------------------------------------------- /steady/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /steady/src/test/java/com/sakuqi/steady/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.sakuqi.steady 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } --------------------------------------------------------------------------------