Hook remember one game client

Creating Application Hook

  • Create an application used for purposes Hook
  • Modify app\build.gradle, add warehouse and Xposed module dependencies
apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.seliote.hook4ft"
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

// 加入仓库
repositories {
    jcenter()
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

    // Xposed 依赖
    compileOnly 'de.robv.android.xposed:api:82'
    compileOnly 'de.robv.android.xposed:api:82:sources'
}
  • Modifying app\src\main\AndroidManifest.xmlmetadata is added as a module Xposed
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.seliote.hook4ft">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <!-- 这是一个 Xposed 模块 -->
        <meta-data
            android:name="xposedmodule"
            android:value="true" />

        <!-- 模块描述 -->
        <meta-data
            android:name="xposeddescription"
            android:value="脚本" />

        <!-- 最低 Xposed 版本 -->
        <meta-data
            android:name="xposedminversion"
            android:value="53" />

        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
  • Creating a class Hook
package com.seliote.hook4ft.hook;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

/**
 * Hook 主类
 */
public class MainHook implements IXposedHookLoadPackage {

    @Override
    public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
        // 确认包名
        if (loadPackageParam.packageName.equals("com.seliote.script4ft")) {
            XposedBridge.log("In hook");
            // 创建 Hook 类对象
            Class hookedClazz = loadPackageParam.classLoader.loadClass("com.seliote.script4ft.MainActivity");
            // 创建 Hook
            XposedHelpers.findAndHookMethod(hookedClazz, "getText", new XC_MethodHook() {
                @Override
                protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                    super.beforeHookedMethod(param);
                }

                @Override
                protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                    super.afterHookedMethod(param);
                    param.setResult("Had hook");
                }
            });
        }
    }
}
  • app\src\main\assetsCreate a directory xposed_initfile specifies Hook entrance Xposed
com.seliote.hook4ft.hook.MainHook
  • Xposed module in effect after the restart enabled

Analysis of the original application

  • # adb install app.apk After you install the application to open to see, familiarize yourself with what to do
  • AK was dragged into the App, suggesting APK 反编译失败,无法继续下一步源码反编译!replace the original after downloading the new version of apktool bin\apktool\apktool\ShakaApktool.jar, then retry prompt APK 反编译失败,无法继续下一步源码反编译!to download AndroidKillerPlugin modified WinAkPlugin.exe.configunder akpathfor the installation path of AK then open AndroidKillerPlugin well as merger and then check all the options 执行选中功能, and report the results 解压文件失败, the manual APK extract to \WinAkPlugin\temp\${APP_NAME}the next, clear 解压 APK, click 执行选中功能, and then re-open it and then AK

Guess you like

Origin www.cnblogs.com/seliote/p/12164087.html