Skip to content

Commit

Permalink
精简工具
Browse files Browse the repository at this point in the history
  • Loading branch information
HChenX committed Jun 17, 2024
1 parent ea87563 commit ed24add
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 113 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android {
defaultConfig {
minSdk 29
targetSdk 34
//noinspection HighAppVersionCode
// noinspection HighAppVersionCode
versionCode defVersionCode
versionName defVersion
// ndk {
Expand Down Expand Up @@ -64,8 +64,8 @@ tasks.register('androidSourcesJar', Jar) {

dependencies {
compileOnly libs.xposed
implementation libs.dexkit
implementation libs.annotation
// implementation libs.dexkit
// implementation libs.jetbrains.annotations
// compileOnly libs.systems.manifold.ext
// implementation libs.annotations
Expand Down
4 changes: 3 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

-keep class * extends com.hchen.hooktool.BaseHC
3 changes: 0 additions & 3 deletions app/src/main/java/com/hchen/hooktool/BaseHC.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.hchen.hooktool.itool.IMember;
import com.hchen.hooktool.itool.IStatic;
import com.hchen.hooktool.tool.ClassTool;
import com.hchen.hooktool.tool.DexkitTool;
import com.hchen.hooktool.tool.ExpandTool;
import com.hchen.hooktool.tool.FieldTool;
import com.hchen.hooktool.tool.MethodTool;
Expand All @@ -48,7 +47,6 @@ public abstract class BaseHC implements IMember, IDynamic, IStatic {
public static ClassTool classTool;
public static MethodTool methodTool;
public static FieldTool fieldTool;
public static DexkitTool dexkitTool;
public static ExpandTool expandTool;

public abstract void init();
Expand All @@ -58,7 +56,6 @@ public BaseHC() {
BaseHC.classTool = hcHook.classTool();
BaseHC.methodTool = hcHook.methodTool();
BaseHC.fieldTool = hcHook.fieldTool();
BaseHC.dexkitTool = hcHook.dexkitTool();
BaseHC.expandTool = hcHook.expandTool();
BaseHC.hcHook.setThisTag(TAG);
lpparam = hcHook.getLpparam();
Expand Down
13 changes: 3 additions & 10 deletions app/src/main/java/com/hchen/hooktool/HCHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import com.hchen.hooktool.tool.ActionTool;
import com.hchen.hooktool.tool.ClassTool;
import com.hchen.hooktool.tool.DexkitTool;
import com.hchen.hooktool.tool.ExpandTool;
import com.hchen.hooktool.tool.FieldTool;
import com.hchen.hooktool.tool.MethodTool;
Expand All @@ -36,7 +35,6 @@
*/
public class HCHook {
private final DataUtils utils;
private final DexkitTool dexkitTool;

static {
initSafe();
Expand All @@ -63,7 +61,6 @@ public HCHook() {
utils.fieldTool = new FieldTool(utils);
utils.methodTool = new MethodTool(utils);
utils.expandTool = new ExpandTool(utils);
dexkitTool = new DexkitTool(utils);
}

public HCHook setThisTag(String tag) {
Expand All @@ -80,7 +77,7 @@ public ClassTool findClass(Object label, String className, ClassLoader classLoad
return utils.getClassTool().findClass(label, className, classLoader);
}

/* 因为 class tool 是本工具基准入口,所以初始化使用必须进入此类。 */
/* 因为 ClassTool 是本工具基准入口,所以初始化使用必须进入此类。 */
public ClassTool classTool() {
return utils.getClassTool();
}
Expand All @@ -97,17 +94,13 @@ public ExpandTool expandTool() {
return utils.getExpandTool();
}

public DexkitTool dexkitTool() {
return dexkitTool;
}

/* 设置自定义 ClassLoader
* 这应该是在使用工具开始就指定的,设置后不能更改。 */
/* 设置自定义 class loader */
public HCHook setClassLoader(ClassLoader classLoader) {
utils.mCustomClassLoader = classLoader;
return utils.getHCHook();
}

/* 设置自定义 lpparam */
public HCHook setLpparam(XC_LoadPackage.LoadPackageParam lpparam) {
utils.mCustomLpparam = lpparam;
setClassLoader(lpparam.classLoader);
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/java/com/hchen/hooktool/itool/IMember.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This file is part of HookTool.
* HookTool is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* Copyright (C) 2023-2024 HookTool Contributions
*/
package com.hchen.hooktool.itool;

import com.hchen.hooktool.callback.IAction;
Expand Down
97 changes: 0 additions & 97 deletions app/src/main/java/com/hchen/hooktool/tool/DexkitTool.java

This file was deleted.

0 comments on commit ed24add

Please sign in to comment.