フック1つのゲームクライアントを覚えています

アプリケーションのフックを作成します

  • 目的のフックで使用するアプリケーションを作成します。
  • 変更app\build.gradle、追加倉庫とXposedモジュールの依存関係
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'
}
  • 変更app\src\main\AndroidManifest.xmlメタデータをモジュールとして追加され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>
  • クラスフックを作成します
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\assetsディレクトリの作成xposed_init、ファイルを指定フック入り口をXposed
com.seliote.hook4ft.hook.MainHook
  • 再起動が有効になって後に有効にモジュールをXposed

元のアプリケーションの分析

  • # adb install app.apk あなたが見るために開くためのアプリケーションをインストールした後、何をすべきかを理解
  • AKは示唆、アプリケーションにドラッグしてAPK 反编译失败,无法继续下一步源码反编译!apktoolの新しいバージョンをダウンロードした後、元のを置き換えるbin\apktool\apktool\ShakaApktool.jarのリトライプロンプトその後、APK 反编译失败,无法继续下一步源码反编译!修正AndroidKillerPluginをダウンロードするWinAkPlugin.exe.config下のakpathインストールAKその後、オープンAndroidKillerPluginのパスだけでなく、合併のために、その後、すべてのオプションをチェック执行选中功能し、結果を報告し解压文件失败、手動APKエキス\WinAkPlugin\temp\${APP_NAME}次回、明確な解压 APK、クリック执行选中功能し、次にそれを再度開き、AK

おすすめ

転載: www.cnblogs.com/seliote/p/12164087.html