diff --git a/README.md b/README.md index 098cd4c..be36675 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ - handlers > 基础处理类 - BaseHandler + > 测试类 + - KuaishouHandler > 初始化管理类 - initialization > 基础初始化类 @@ -40,10 +42,14 @@ - Register > 工具类 - utils + > 类查询助手 + - ClassesReaderAssistant > 通信助手 - CommunicationAssistant > 算法助手 - AlgorithmAssistant + > 配置文件助手 + - PropertiesAssistant - Config ## Install diff --git a/headwolf/app/src/main/assets/config b/headwolf/app/src/main/assets/config new file mode 100644 index 0000000..0d79166 --- /dev/null +++ b/headwolf/app/src/main/assets/config @@ -0,0 +1,6 @@ +remote_server=192.144.152.23 +wechat_remote_server=182.92.212.44 +group_kuaishou_name=ks_group2 +group_taobao_name=tb_group2 +group_douyin_name=dy_group2 +group_wechat_name=wc_group2 diff --git a/headwolf/app/src/main/assets/xposed_init b/headwolf/app/src/main/assets/xposed_init new file mode 100644 index 0000000..68c1f85 --- /dev/null +++ b/headwolf/app/src/main/assets/xposed_init @@ -0,0 +1 @@ +com.lateautumn4lin.sign.entry.HookLoader \ No newline at end of file diff --git a/headwolf/app/src/main/java/com/lateautumn4lin/headwolf/handlers/KuaishouHandler.java b/headwolf/app/src/main/java/com/lateautumn4lin/headwolf/handlers/KuaishouHandler.java new file mode 100644 index 0000000..f62c1f7 --- /dev/null +++ b/headwolf/app/src/main/java/com/lateautumn4lin/headwolf/handlers/KuaishouHandler.java @@ -0,0 +1,11 @@ +package com.lateautumn4lin.headwolf.handlers; +/* + * KuaishouHandler + * + * @author lateautumn4lin + * @github https://github.com/lateautumn4lin + * @date 2020/9/10 15:39 + */ + +public class KuaishouHandler { +} diff --git a/headwolf/app/src/main/java/com/lateautumn4lin/headwolf/utils/ClassesReaderAssistant.java b/headwolf/app/src/main/java/com/lateautumn4lin/headwolf/utils/ClassesReaderAssistant.java new file mode 100644 index 0000000..b3d2476 --- /dev/null +++ b/headwolf/app/src/main/java/com/lateautumn4lin/headwolf/utils/ClassesReaderAssistant.java @@ -0,0 +1,124 @@ +package com.lateautumn4lin.headwolf.utils; +/* + * ClassesReaderAssistant + * + * @author lateautumn4lin + * @github https://github.com/lateautumn4lin + * @date 2020/9/11 11:03 + */ + + +import android.content.Context; + + +import java.io.File; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import dalvik.system.DexFile; + +/** + * 类读取器
+ * 读取某个包下所有类
+ */ +public final class ClassesReaderAssistant { + + /** + * 获取应用程序下的所有Dex文件 + * + * @param context 上下文 + * @return Set set + */ + public static Set applicationDexFile(Context context) { + return applicationDexFile(context.getPackageCodePath()); + } + + /** + * 获取应用程序下的所有Dex文件 + * + * @param packageCodePath 包路径 + * @return Set set + */ + public static Set applicationDexFile(String packageCodePath) { + Set dexFiles = new HashSet<>(); + File dir = new File(packageCodePath).getParentFile(); + File[] files = dir.listFiles(); + for (File file : files) { + try { + String absolutePath = file.getAbsolutePath(); + if (!absolutePath.contains(".")) continue; + String suffix = absolutePath.substring(absolutePath.lastIndexOf(".")); + if (!suffix.equals(".apk")) continue; + DexFile dexFile = createDexFile(file.getAbsolutePath()); + if (dexFile == null) continue; + dexFiles.add(dexFile); + } catch (Exception e) { + e.printStackTrace(); + } + } + return dexFiles; + } + + /** + * 创建DexFile文件 + * + * @param path 路径 + * @return DexFile dex file + */ + public static DexFile createDexFile(String path) { + try { + return new DexFile(path); + } catch (IOException e) { + return null; + } + } + + /** + * 读取类路径下的所有类 + * + * @param packageName 包名 + * @param context 包路径 + * @return List list + */ + public static List> reader(String packageName, Context context) { + return reader(packageName, context.getPackageCodePath()); + } + + /** + * 读取类路径下的所有类 + * + * @param packageName 包名 + * @param packageCodePath 上下文 + * @return List list + */ + public static List> reader(String packageName, String packageCodePath) { + List> classes = new ArrayList<>(); + Set dexFiles = applicationDexFile(packageCodePath); + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + for (DexFile dexFile : dexFiles) { + if (dexFile == null) continue; + Enumeration entries = dexFile.entries(); + while (entries.hasMoreElements()) { + try { + String currentClassPath = entries.nextElement(); + if (currentClassPath == null || currentClassPath.isEmpty() || currentClassPath.indexOf(packageName) != 0) + continue; + Class entryClass = Class.forName(currentClassPath, true, classLoader); + if (entryClass == null) continue; + classes.add(entryClass); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + return classes; + } + +} + + diff --git a/headwolf/app/src/main/java/com/lateautumn4lin/headwolf/utils/PropertiesAssistant.java b/headwolf/app/src/main/java/com/lateautumn4lin/headwolf/utils/PropertiesAssistant.java new file mode 100644 index 0000000..51f183d --- /dev/null +++ b/headwolf/app/src/main/java/com/lateautumn4lin/headwolf/utils/PropertiesAssistant.java @@ -0,0 +1,17 @@ +package com.lateautumn4lin.headwolf.utils; + +import java.io.InputStream; +import java.util.Properties; + +public class ProperTies { + public static Properties getProperties() { + Properties props = new Properties(); + InputStream in = ProperTies.class.getResourceAsStream("/assets/config"); + try { + props.load(in); + } catch (Exception e) { + Logger.loge(e.toString()); + } + return props; + } +}