9 |
10 | extern "C"
11 | JNIEXPORT bool nativeHookNoBackup(void* origin, void* hook);
12 |
13 | extern "C"
14 | JNIEXPORT void* findSym(const char *elf, const char *sym_name);
15 |
16 | #endif //SANDHOOK_SANDHOOK_H
17 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/.cxx/cmake/debug/armeabi-v7a/CMakeFiles/TargetDirectories.txt:
--------------------------------------------------------------------------------
1 | /Users/king/git_src/MikSandHook/MikSdHook/nativehook/.cxx/cmake/debug/armeabi-v7a/CMakeFiles/rebuild_cache.dir
2 | /Users/king/git_src/MikSandHook/MikSdHook/nativehook/.cxx/cmake/debug/armeabi-v7a/CMakeFiles/edit_cache.dir
3 | /Users/king/git_src/MikSandHook/MikSdHook/nativehook/.cxx/cmake/debug/armeabi-v7a/CMakeFiles/sandhook-native.dir
4 |
--------------------------------------------------------------------------------
/MikSdHook/xposedcompat/src/main/java/de/robv/android/xposed/callbacks/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Contains the base classes for callbacks.
3 | *
4 | * For historical reasons, {@link de.robv.android.xposed.MIK_MethodHk} and
5 | * {@link de.robv.android.xposed.XC_MethodReplacement} are directly in the
6 | * {@code de.robv.android.xposed} package.
7 | */
8 | package de.robv.android.xposed.callbacks;
9 |
10 |
--------------------------------------------------------------------------------
/MikSdHook/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/src/main/cpp/includes/native_hook.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by SwiftGan on 2019/4/12.
3 | //
4 |
5 | #ifndef SANDHOOK_NATIVE_HOOK_H
6 | #define SANDHOOK_NATIVE_HOOK_H
7 |
8 | #include "sandhook.h"
9 |
10 | namespace SandHook {
11 |
12 | class NativeHook {
13 | public:
14 | static bool hookDex2oat(bool disableDex2oat);
15 | };
16 |
17 | }
18 |
19 | #endif //SANDHOOK_NATIVE_HOOK_H
20 |
--------------------------------------------------------------------------------
/MikSdHook/xposedcompat_new/src/main/java/de/robv/android/xposed/callbacks/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Contains the base classes for callbacks.
3 | *
4 | *
For historical reasons, {@link de.robv.android.xposed.MIK_MethodHk} and
5 | * {@link de.robv.android.xposed.XC_MethodReplacement} are directly in the
6 | * {@code de.robv.android.xposed} package.
7 | */
8 | package de.robv.android.xposed.callbacks;
9 |
10 |
--------------------------------------------------------------------------------
/MikSdHook/annotation/src/main/java/com/swift/sandhook/annotation/ThisObject.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target({ElementType.PARAMETER})
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface ThisObject {
11 | }
12 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/utils/log.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by SwiftGan on 2019/2/15.
3 | //
4 |
5 | #pragma once
6 |
7 | #include "android/log.h"
8 |
9 | #define TAG "SandHook-Native"
10 |
11 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
12 | #define LOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
13 | #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
--------------------------------------------------------------------------------
/MikSdHook/hooklib/.cxx/cmake/release/arm64-v8a/CMakeFiles/TargetDirectories.txt:
--------------------------------------------------------------------------------
1 | /Users/king/AndroidStudioProjects/MikSandHook/MikSdHook/hooklib/.cxx/cmake/release/arm64-v8a/CMakeFiles/rebuild_cache.dir
2 | /Users/king/AndroidStudioProjects/MikSandHook/MikSdHook/hooklib/.cxx/cmake/release/arm64-v8a/CMakeFiles/edit_cache.dir
3 | /Users/king/AndroidStudioProjects/MikSandHook/MikSdHook/hooklib/.cxx/cmake/release/arm64-v8a/CMakeFiles/sandhook.dir
4 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/java/com/swift/sandhook/nativehook/NativeHook.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.nativehook;
2 |
3 | /**
4 | * @author Swift Gan
5 | * Create: 2019/5/10
6 | * Desc:
7 | */
8 | public class NativeHook {
9 |
10 |
11 | static {
12 | System.loadLibrary("sandhook-native");
13 | }
14 |
15 | public static void dosth() {}
16 |
17 | public static native void test();
18 |
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/app/.cxx/abi_configuration_4o5p5x6f_key.json:
--------------------------------------------------------------------------------
1 | {
2 | "ndkHandlerSupportedAbis": [
3 | "ARMEABI_V7A",
4 | "ARM64_V8A",
5 | "X86",
6 | "X86_64"
7 | ],
8 | "ndkHandlerDefaultAbis": [
9 | "ARMEABI_V7A",
10 | "ARM64_V8A",
11 | "X86",
12 | "X86_64"
13 | ],
14 | "externalNativeBuildAbiFilters": [],
15 | "ndkConfigAbiFilters": [],
16 | "splitsFilterAbis": [],
17 | "ideBuildOnlyTargetAbi": true
18 | }
--------------------------------------------------------------------------------
/MikSdHook/hooklib/.cxx/cmake/release/armeabi-v7a/CMakeFiles/TargetDirectories.txt:
--------------------------------------------------------------------------------
1 | /Users/king/AndroidStudioProjects/MikSandHook/MikSdHook/hooklib/.cxx/cmake/release/armeabi-v7a/CMakeFiles/rebuild_cache.dir
2 | /Users/king/AndroidStudioProjects/MikSandHook/MikSdHook/hooklib/.cxx/cmake/release/armeabi-v7a/CMakeFiles/edit_cache.dir
3 | /Users/king/AndroidStudioProjects/MikSandHook/MikSdHook/hooklib/.cxx/cmake/release/armeabi-v7a/CMakeFiles/sandhook.dir
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 |
--------------------------------------------------------------------------------
/MikSdHook/annotation/src/main/java/com/swift/sandhook/annotation/HookClass.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target({ElementType.TYPE})
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface HookClass {
11 | Class> value();
12 | }
13 |
--------------------------------------------------------------------------------
/MikSdHook/xposedcompat/src/main/java/com/android/internal/util/XmlUtils.java:
--------------------------------------------------------------------------------
1 | package com.android.internal.util;
2 |
3 | import org.xmlpull.v1.XmlPullParserException;
4 |
5 | import java.io.InputStream;
6 | import java.util.HashMap;
7 |
8 | public class XmlUtils {
9 |
10 | public static final HashMap readMapXml(InputStream in) throws XmlPullParserException, java.io.IOException {
11 | return null;
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/MikSdHook/annotation/src/main/java/com/swift/sandhook/annotation/Param.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target({ElementType.PARAMETER})
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface Param {
11 | String value() default "";
12 | }
13 |
--------------------------------------------------------------------------------
/MikSdHook/annotation/src/main/java/com/swift/sandhook/annotation/SkipParamCheck.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target({ElementType.METHOD, ElementType.FIELD})
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface SkipParamCheck {
11 | }
12 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/.cxx/cmake/release/arm64-v8a/CMakeFiles/TargetDirectories.txt:
--------------------------------------------------------------------------------
1 | /Users/king/AndroidStudioProjects/MikSandHook/MikSdHook/nativehook/.cxx/cmake/release/arm64-v8a/CMakeFiles/rebuild_cache.dir
2 | /Users/king/AndroidStudioProjects/MikSandHook/MikSdHook/nativehook/.cxx/cmake/release/arm64-v8a/CMakeFiles/edit_cache.dir
3 | /Users/king/AndroidStudioProjects/MikSandHook/MikSdHook/nativehook/.cxx/cmake/release/arm64-v8a/CMakeFiles/sandhook-native.dir
4 |
--------------------------------------------------------------------------------
/MikSdHook/xposedcompat_new/src/main/java/com/android/internal/util/XmlUtils.java:
--------------------------------------------------------------------------------
1 | package com.android.internal.util;
2 |
3 | import org.xmlpull.v1.XmlPullParserException;
4 |
5 | import java.io.InputStream;
6 | import java.util.HashMap;
7 |
8 | public class XmlUtils {
9 |
10 | public static final HashMap readMapXml(InputStream in) throws XmlPullParserException, java.io.IOException {
11 | return null;
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/MikSdHook/annotation/src/main/java/com/swift/sandhook/annotation/HookReflectClass.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target({ElementType.TYPE})
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface HookReflectClass {
11 | String value();
12 | }
13 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/src/main/java/com/swift/sandhook/ClassNeverCall.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook;
2 |
3 | import android.util.Log;
4 |
5 | public class ClassNeverCall {
6 | private void neverCall() {}
7 | private void neverCall2() {
8 | Log.e("ClassNeverCall", "ClassNeverCall2");
9 | }
10 | private static void neverCallStatic() {}
11 | private native void neverCallNative();
12 | private native void neverCallNative2();
13 | }
14 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/.cxx/cmake/release/armeabi-v7a/CMakeFiles/TargetDirectories.txt:
--------------------------------------------------------------------------------
1 | /Users/king/AndroidStudioProjects/MikSandHook/MikSdHook/nativehook/.cxx/cmake/release/armeabi-v7a/CMakeFiles/rebuild_cache.dir
2 | /Users/king/AndroidStudioProjects/MikSandHook/MikSdHook/nativehook/.cxx/cmake/release/armeabi-v7a/CMakeFiles/edit_cache.dir
3 | /Users/king/AndroidStudioProjects/MikSandHook/MikSdHook/nativehook/.cxx/cmake/release/armeabi-v7a/CMakeFiles/sandhook-native.dir
4 |
--------------------------------------------------------------------------------
/MikSdHook/annotation/src/main/java/com/swift/sandhook/annotation/HookMethod.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target({ElementType.METHOD})
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface HookMethod {
11 | String value() default "";
12 | }
13 |
--------------------------------------------------------------------------------
/MikSdHook/annotation/src/main/java/com/swift/sandhook/annotation/MethodParams.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target({ElementType.METHOD,ElementType.FIELD})
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface MethodParams {
11 | Class>[] value();
12 | }
--------------------------------------------------------------------------------
/MikSdHook/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/MikSdHook/annotation/src/main/java/com/swift/sandhook/annotation/HookMethodBackup.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target({ElementType.METHOD,ElementType.FIELD})
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface HookMethodBackup {
11 | String value() default "";
12 | }
13 |
--------------------------------------------------------------------------------
/app/.cxx/abi_configuration_4c11233e_key.json:
--------------------------------------------------------------------------------
1 | {
2 | "ndkHandlerSupportedAbis": [
3 | "ARMEABI_V7A",
4 | "ARM64_V8A",
5 | "X86",
6 | "X86_64"
7 | ],
8 | "ndkHandlerDefaultAbis": [
9 | "ARMEABI_V7A",
10 | "ARM64_V8A",
11 | "X86",
12 | "X86_64"
13 | ],
14 | "externalNativeBuildAbiFilters": [],
15 | "ndkConfigAbiFilters": [],
16 | "splitsFilterAbis": [],
17 | "ideBuildOnlyTargetAbi": true,
18 | "ideBuildTargetAbi": "arm64-v8a,armeabi-v7a,armeabi"
19 | }
--------------------------------------------------------------------------------
/MikSdHook/hooklib/.cxx/abi_configuration_4jvc6i6b_key.json:
--------------------------------------------------------------------------------
1 | {
2 | "ndkHandlerSupportedAbis": [
3 | "ARMEABI_V7A",
4 | "ARM64_V8A",
5 | "X86",
6 | "X86_64"
7 | ],
8 | "ndkHandlerDefaultAbis": [
9 | "ARMEABI_V7A",
10 | "ARM64_V8A",
11 | "X86",
12 | "X86_64"
13 | ],
14 | "externalNativeBuildAbiFilters": [],
15 | "ndkConfigAbiFilters": [
16 | "armeabi-v7a",
17 | "arm64-v8a"
18 | ],
19 | "splitsFilterAbis": [],
20 | "ideBuildOnlyTargetAbi": true
21 | }
--------------------------------------------------------------------------------
/MikSdHook/hooklib/src/main/cpp/includes/log.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by SwiftGan on 2019/2/15.
3 | //
4 |
5 | #ifndef SANDHOOK_LOG_H
6 | #define SANDHOOK_LOG_H
7 |
8 | #include "android/log.h"
9 |
10 | #define TAG "SandHook-Native"
11 |
12 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
13 | #define LOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
14 | #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
15 |
16 | #endif //SANDHOOK_LOG_H
17 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/.cxx/abi_configuration_6d3n85pz_key.json:
--------------------------------------------------------------------------------
1 | {
2 | "ndkHandlerSupportedAbis": [
3 | "ARMEABI_V7A",
4 | "ARM64_V8A",
5 | "X86",
6 | "X86_64"
7 | ],
8 | "ndkHandlerDefaultAbis": [
9 | "ARMEABI_V7A",
10 | "ARM64_V8A",
11 | "X86",
12 | "X86_64"
13 | ],
14 | "externalNativeBuildAbiFilters": [
15 | "armeabi-v7a",
16 | "arm64-v8a"
17 | ],
18 | "ndkConfigAbiFilters": [],
19 | "splitsFilterAbis": [],
20 | "ideBuildOnlyTargetAbi": true
21 | }
--------------------------------------------------------------------------------
/app/src/test/java/com/mik/miksandhook/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.mik.miksandhook;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/MikSdHook/app/src/test/java/com/swift/sandhook/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/MikSdHook/app/src/main/java/com/swift/sandhook/test/PendingHookTest.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.test;
2 |
3 | import android.util.Log;
4 |
5 | import com.swift.sandhook.MyApp;
6 |
7 | public class PendingHookTest {
8 |
9 | static {
10 | if (!MyApp.initedTest) {
11 | throw new RuntimeException("PendingHookTest.class may can not init this time!");
12 | }
13 | }
14 |
15 | public static void test() {
16 | Log.e("PendingHookTest", "hook failure!");
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/src/main/cpp/includes/dlfcn_nougat.h:
--------------------------------------------------------------------------------
1 | #ifndef DLFCN_NOUGAT_H
2 | #define DLFCN_NOUGAT_H
3 |
4 | //see implementation in https://tech.meituan.com/2017/07/20/android-remote-debug.html
5 | extern "C" {
6 | int fake_dlclose(void *handle);
7 |
8 | void *fake_dlopen(const char *filename, int flags);
9 |
10 | void *fake_dlsym(void *handle, const char *name);
11 |
12 | const char *fake_dlerror();
13 |
14 | void *getSymCompat(const char *filename, const char *name);
15 | }
16 |
17 | #endif //DLFCN_NOUGAT_H
18 |
--------------------------------------------------------------------------------
/MikSdHook/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/MikSdHook/annotation/src/main/java/com/swift/sandhook/annotation/HookMode.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target({ElementType.METHOD})
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface HookMode {
11 |
12 | int AUTO = 0;
13 | int INLINE = 1;
14 | int REPLACE = 2;
15 |
16 | int value() default AUTO;
17 | }
18 |
--------------------------------------------------------------------------------
/MikSdHook/xposedcompat_new/src/main/java/com/swift/sandhook/xposedcompat/HookInfo.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.xposedcompat;
2 |
3 | import java.lang.reflect.Member;
4 | import java.lang.reflect.Method;
5 |
6 | import de.robv.android.xposed.XposedBridge;
7 |
8 | /**
9 | * @author Swift Gan
10 | * Create: 2019/6/3
11 | * Desc:
12 | */
13 | public class HookInfo {
14 | public Member origin;
15 | public Method hook;
16 | public Method backup;
17 | public XposedBridge.AdditionalHookInfo additionalHookInfo;
18 | }
19 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/.cxx/abi_configuration_3v5r342g_key.json:
--------------------------------------------------------------------------------
1 | {
2 | "ndkHandlerSupportedAbis": [
3 | "ARMEABI_V7A",
4 | "ARM64_V8A",
5 | "X86",
6 | "X86_64"
7 | ],
8 | "ndkHandlerDefaultAbis": [
9 | "ARMEABI_V7A",
10 | "ARM64_V8A",
11 | "X86",
12 | "X86_64"
13 | ],
14 | "externalNativeBuildAbiFilters": [],
15 | "ndkConfigAbiFilters": [
16 | "armeabi-v7a",
17 | "arm64-v8a"
18 | ],
19 | "splitsFilterAbis": [],
20 | "ideBuildOnlyTargetAbi": true,
21 | "ideBuildTargetAbi": "arm64-v8a,armeabi-v7a,armeabi"
22 | }
--------------------------------------------------------------------------------
/MikSdHook/nativehook/.cxx/abi_configuration_2g5g2v65_key.json:
--------------------------------------------------------------------------------
1 | {
2 | "ndkHandlerSupportedAbis": [
3 | "ARMEABI_V7A",
4 | "ARM64_V8A",
5 | "X86",
6 | "X86_64"
7 | ],
8 | "ndkHandlerDefaultAbis": [
9 | "ARMEABI_V7A",
10 | "ARM64_V8A",
11 | "X86",
12 | "X86_64"
13 | ],
14 | "externalNativeBuildAbiFilters": [
15 | "armeabi-v7a",
16 | "arm64-v8a"
17 | ],
18 | "ndkConfigAbiFilters": [],
19 | "splitsFilterAbis": [],
20 | "ideBuildOnlyTargetAbi": true,
21 | "ideBuildTargetAbi": "arm64-v8a,armeabi-v7a,armeabi"
22 | }
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/archs/arm/arm64/decoder/decoder_arm64.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/5/6.
3 | //
4 |
5 | #pragma once
6 |
7 | #include "decoder.h"
8 |
9 | namespace SandHook {
10 | namespace Decoder {
11 |
12 | class Arm64Decoder : public InstDecoder {
13 | public:
14 | void Disassemble(void *codeStart, Addr codeLen, InstVisitor &visitor,
15 | bool onlyPcRelInst) override;
16 | public:
17 | static Arm64Decoder* instant;
18 | };
19 |
20 | }
21 | }
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/x86/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "i686")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/x86_64/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "x86_64")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/x86/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "i686")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/arm64-v8a/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "aarch64")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/armeabi-v7a/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "armv7-a")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/arm64-v8a/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "aarch64")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/x86_64/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "x86_64")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/src/main/cpp/includes/cast_compiler_options.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by 甘尧 on 2019/1/12.
3 | //
4 |
5 | #ifndef SANDHOOK_CAST_COMPILER_OPTIONS_H
6 | #define SANDHOOK_CAST_COMPILER_OPTIONS_H
7 |
8 | #include "cast.h"
9 | #include "art_compiler_options.h"
10 |
11 | namespace SandHook {
12 |
13 | class CastCompilerOptions {
14 | public:
15 | static void init(JNIEnv *jniEnv);
16 | static IMember* inlineMaxCodeUnits;
17 | };
18 |
19 |
20 | }
21 |
22 | #endif //SANDHOOK_CAST_COMPILER_OPTIONS_H
23 |
24 |
25 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/utils/lock.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/5/11.
3 | //
4 |
5 | #pragma once
6 |
7 | #include
8 |
9 | namespace SandHook {
10 | namespace Utils {
11 |
12 |
13 | class AutoLock {
14 | public:
15 | inline AutoLock(std::mutex& mutex) : mLock(mutex) { mLock.lock(); }
16 | inline AutoLock(std::mutex* mutex) : mLock(*mutex) { mLock.lock(); }
17 | inline ~AutoLock() { mLock.unlock(); }
18 | private:
19 | std::mutex& mLock;
20 | };
21 |
22 | }
23 | }
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/armeabi-v7a/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "armv7-a")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/.cxx/cmake/debug/arm64-v8a/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "aarch64")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/.cxx/cmake/debug/armeabi-v7a/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "armv7-a")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/.cxx/cmake/release/arm64-v8a/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "aarch64")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/.cxx/cmake/debug/arm64-v8a/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "aarch64")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/.cxx/cmake/release/armeabi-v7a/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "armv7-a")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/.cxx/cmake/debug/armeabi-v7a/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "armv7-a")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/.cxx/cmake/release/arm64-v8a/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "aarch64")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/.cxx/cmake/release/armeabi-v7a/CMakeFiles/3.10.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Darwin-21.1.0")
2 | set(CMAKE_HOST_SYSTEM_NAME "Darwin")
3 | set(CMAKE_HOST_SYSTEM_VERSION "21.1.0")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 | include("/Users/king/Library/Android/sdk/ndk/21.1.6352462/build/cmake/android.toolchain.cmake")
7 |
8 | set(CMAKE_SYSTEM "Android-1")
9 | set(CMAKE_SYSTEM_NAME "Android")
10 | set(CMAKE_SYSTEM_VERSION "1")
11 | set(CMAKE_SYSTEM_PROCESSOR "armv7-a")
12 |
13 | set(CMAKE_CROSSCOMPILING "TRUE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/MikSdHook/xposedcompat/src/main/java/com/swift/sandhook/xposedcompat/methodgen/HookMaker.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.xposedcompat.methodgen;
2 |
3 | import java.lang.reflect.Member;
4 | import java.lang.reflect.Method;
5 |
6 | import de.robv.android.xposed.XposedBridge;
7 |
8 | public interface HookMaker {
9 | void start(Member member, XposedBridge.AdditionalHookInfo hookInfo,
10 | ClassLoader appClassLoader, String dexDirPath) throws Exception;
11 | Method getHookMethod();
12 | Method getBackupMethod();
13 | Method getCallBackupMethod();
14 | }
15 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/src/main/cpp/includes/art_jit.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by 甘尧 on 2019/2/23.
3 | //
4 |
5 | #ifndef SANDHOOK_ART_JIT_H
6 | #define SANDHOOK_ART_JIT_H
7 |
8 | namespace art {
9 | namespace jit {
10 |
11 | //7.0 - 9.0
12 | class JitCompiler {
13 | public:
14 | virtual ~JitCompiler();
15 | std::unique_ptr compilerOptions;
16 | };
17 |
18 | class Jit {
19 | public:
20 | //void* getCompilerOptions();
21 | };
22 |
23 |
24 |
25 | };
26 | }
27 |
28 | #endif //SANDHOOK_ART_JIT_H
29 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/archs/arm/arm64/inst/inst_code_arm64.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/5/8.
3 | //
4 |
5 | #pragma once
6 |
7 | #include "inst_struct_aarch64.h"
8 |
9 | enum class InstCodeA64 : InstCode {
10 | UNKNOW,
11 | MOV_WIDE,
12 | MOV_REG,
13 | ADR_ADRP,
14 | LDR_LIT,
15 | LDR_UIMM,
16 | LDR_IMM,
17 | LDRSW_UIMM,
18 | LDRSW_IMM,
19 | STR_IMM,
20 | STR_UIMM,
21 | B_BL,
22 | B_COND,
23 | BR_BLR_RET,
24 | CBZ_CBNZ,
25 | TBZ_TBNZ,
26 | SUB_EXT_REG,
27 | EXCEPTION_GEN,
28 | SVC,
29 | STP_LDP,
30 | ADD_SUB_IMM,
31 | MSR_MRS
32 | };
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/archs/arm/arm32/decoder/decoder_arm32.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/5/23.
3 | //
4 |
5 | #ifndef SANDHOOK_DECODER_A32_H
6 | #define SANDHOOK_DECODER_A32_H
7 |
8 | #include "decoder.h"
9 |
10 | namespace SandHook {
11 | namespace Decoder {
12 |
13 | class Arm32Decoder : public InstDecoder {
14 | public:
15 | void Disassemble(void *codeStart, Addr codeLen, InstVisitor &visitor,
16 | bool onlyPcRelInst) override;
17 | public:
18 | static Arm32Decoder* instant;
19 | };
20 |
21 | }
22 | }
23 |
24 | #endif //SANDHOOK_DECODER_A32_H
25 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/archs/arm/shellcode_arm.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/6/1.
3 | //
4 |
5 | #pragma once
6 |
7 | //for shell code
8 | #define FUNCTION_START(x) \
9 | .align 4; \
10 | .global x; \
11 | .global x##_END; \
12 | x:
13 |
14 | #define FUNCTION_START_T(x) \
15 | .syntax unified; \
16 | .align 4; \
17 | .thumb; \
18 | .thumb_func; \
19 | .global x; \
20 | .global x##_END; \
21 | x:
22 |
23 | #define FUNCTION_END(x) x##_END: \
24 | .size x, .-x \
25 |
26 | #define IMPORT_SHELLCODE(x) extern "C" void x(); \
27 | extern "C" void x##_END();
28 |
29 | #define IMPORT_LABEL(X,T) extern T X;
30 |
31 | #define SHELLCODE_LEN(x) (Addr)x##_END - (Addr)x
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/archs/arm/arm32/register/register_arm32.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/5/12.
3 | //
4 |
5 | #include "register_arm32.h"
6 | #include "register_list_arm32.h"
7 |
8 | using namespace SandHook::RegistersA32;
9 |
10 | SandHook::Asm::RegisterA32::RegisterA32(U8 code) : Register(code) {
11 | }
12 |
13 | SandHook::Asm::RegisterA32::RegisterA32() {
14 |
15 | }
16 |
17 | U8 SandHook::Asm::RegisterA32::Wide() {
18 | return 4;
19 | }
20 |
21 | RegisterA32* RegisterA32::registers[ARM32_REGISTER_COUNT] = {
22 | #define DEFINE_REGISTERS_X(N) \
23 | &R##N,
24 | ARM32_REGISTER_CODE_LIST(DEFINE_REGISTERS_X)
25 | #undef DEFINE_REGISTERS_X
26 | };
--------------------------------------------------------------------------------
/MikSdHook/annotation/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java-library'
2 |
3 | dependencies {
4 | implementation fileTree(dir: 'libs', include: ['*.jar'])
5 | }
6 |
7 | sourceCompatibility = "1.7"
8 | targetCompatibility = "1.7"
9 |
10 | ext {
11 | bintrayRepo = 'maven'
12 | bintrayName = 'swift-sandhook-annotation'
13 | }
14 |
15 | //apply plugin: 'com.novoda.bintray-release'
16 | //
17 | //publish {
18 | // userOrg = rootProject.userOrg
19 | // groupId = rootProject.groupId
20 | // artifactId = 'hookannotation'
21 | // publishVersion = rootProject.publishVersion
22 | // desc = rootProject.desc
23 | // website = rootProject.website
24 | // licences = rootProject.licences
25 | //}
26 |
--------------------------------------------------------------------------------
/MikSdHook/app/src/main/java/com/swift/sandhook/test/TestClass.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.test;
2 |
3 | import com.swift.sandhook.MainActivity;
4 |
5 | public class TestClass {
6 |
7 | public int a = 1;
8 | int b = 2;
9 |
10 | public TestClass(int a) {
11 | this.a = a + 1;
12 | }
13 |
14 | public void add1 () {
15 | a++;
16 | b++;
17 | throw new RuntimeException("test exception");
18 | }
19 |
20 | public void add2 () {
21 | a++;
22 | b++;
23 | }
24 |
25 | public void testNewHookApi (MainActivity activity, int x) {
26 | x++;
27 | a++;
28 | b++;
29 | }
30 |
31 | public native void jni_test();
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/archs/arm/arm32/register/register_list_arm32.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/5/16.
3 | //
4 |
5 | #include "register_list_arm32.h"
6 |
7 | namespace SandHook {
8 | namespace RegistersA32 {
9 |
10 | #define INIT_REGISTERS(N) \
11 | RegisterA32 R##N = RegisterA32(N);
12 | ARM32_REGISTER_CODE_LIST(INIT_REGISTERS)
13 | #undef INIT_REGISTERS
14 |
15 | enum RegNum {
16 | kIPRegNum = 12, kSPRegNum = 13, kLRRegNum = 14, kPCRegNum = 15
17 | };
18 |
19 | RegisterA32 SP = *Reg(kSPRegNum);
20 | RegisterA32 IP = *Reg(kIPRegNum);
21 | RegisterA32 LR = *Reg(kLRRegNum);
22 | RegisterA32 PC = *Reg(kPCRegNum);
23 | RegisterA32 UnknowRegiser = RegisterA32(38);
24 |
25 | }}
--------------------------------------------------------------------------------
/MikSdHook/annotation/src/main/java/com/swift/sandhook/annotation/MethodReflectParams.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target({ElementType.METHOD,ElementType.FIELD})
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface MethodReflectParams {
11 |
12 | String BOOLEAN = "boolean";
13 | String BYTE = "byte";
14 | String CHAR = "char";
15 | String DOUBLE = "double";
16 | String FLOAT = "float";
17 | String INT = "int";
18 | String LONG = "long";
19 | String SHORT = "short";
20 |
21 | String[] value();
22 | }
--------------------------------------------------------------------------------
/MikSdHook/hookers/src/main/java/com/swift/sandhook/hookers/AbsHooker.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.hookers;
2 |
3 | import android.util.Log;
4 |
5 | import com.swift.sandhook.annotation.HookReflectClass;
6 | import com.swift.sandhook.annotation.HookMethod;
7 | import com.swift.sandhook.annotation.HookMethodBackup;
8 |
9 | @HookReflectClass("com.swift.sandhook.test.Inter")
10 | public class AbsHooker {
11 |
12 | @HookMethod("dosth")
13 | public static void ondosth(Object thiz) {
14 | Log.e("AbsHooker", "dosth hook success ");
15 | ondosthBackup(thiz);
16 | }
17 |
18 | @HookMethodBackup("dosth")
19 | public static void ondosthBackup(Object thiz) {
20 | ondosthBackup(thiz);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/src/main/cpp/includes/offset.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/2/3.
3 | //
4 |
5 | #ifndef SANDHOOK_OFFSET_H
6 | #define SANDHOOK_OFFSET_H
7 |
8 | #include
9 |
10 | namespace SandHook {
11 |
12 | class Offset {
13 | public:
14 |
15 | template
16 | static int findOffset(void *start, size_t len, size_t step, T value);
17 |
18 | template
19 | static int findOffsetWithCB1(void *start, size_t len, size_t step, bool func(int, T));
20 |
21 | template
22 | static int findOffsetWithCB2(void *start1, void *start2, size_t len, size_t step, bool func(T, T));
23 |
24 | };
25 |
26 | }
27 |
28 | #endif //SANDHOOK_OFFSET_H
29 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/src/main/cpp/art/art_compiler_options.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by 甘尧 on 2019/2/24.
3 | //
4 |
5 | #include "../includes/art_compiler_options.h"
6 | #include "../includes/cast_compiler_options.h"
7 | #include "../includes/hide_api.h"
8 |
9 | using namespace SandHook;
10 | using namespace art;
11 |
12 | extern int SDK_INT;
13 |
14 | size_t CompilerOptions::getInlineMaxCodeUnits() {
15 | if (SDK_INT < ANDROID_N)
16 | return 0;
17 | return CastCompilerOptions::inlineMaxCodeUnits->get(this);
18 | }
19 |
20 | bool CompilerOptions::setInlineMaxCodeUnits(size_t units) {
21 | if (SDK_INT < ANDROID_N)
22 | return false;
23 | CastCompilerOptions::inlineMaxCodeUnits->set(this, units);
24 | return true;
25 | }
26 |
--------------------------------------------------------------------------------
/MikSdHook/hookers/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 21
10 | targetSdkVersion 28
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 |
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(include: ['*.jar'], dir: 'libs')
29 | compileOnly project(':MikSdHook:annotation')
30 | }
31 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/archs/arm/arm32/inst/inst_struct_a32.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/5/12.
3 | //
4 |
5 | #pragma once
6 |
7 |
8 | #include "instruction.h"
9 |
10 | #define STRUCT_A32(X) A32_STRUCT_##X
11 | #define OPCODE_A32(X) A32_OPCODE_##X
12 | #define DEFINE_OPCODE(X, V) const U32 OPCODE_A32(X) = V;
13 | #define DEFINE_STRUCT_A32(X) struct STRUCT_A32(X) : public Base
14 |
15 |
16 | DEFINE_OPCODE(STR_IMM, 0b010)
17 | DEFINE_STRUCT_A32(STR_IMM) {
18 | InstA64 imm12:12;
19 | InstA64 rt:4;
20 | InstA64 rn:4;
21 | InstA64 unkown2_0:1;
22 | InstA64 W:1;
23 | InstA64 unkown1_0:1;
24 | InstA64 U:1;
25 | InstA64 P:1;
26 | InstA64 opcode:3;
27 | InstA64 cond:4;
28 | };
--------------------------------------------------------------------------------
/MikSdHook/hooklib/src/main/cpp/utils/lock.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by SwiftGan on 2019/1/21.
3 | //
4 |
5 | #ifndef SANDHOOK_LOCK_H
6 | #define SANDHOOK_LOCK_H
7 |
8 | #include "mutex"
9 | #include "../includes/hide_api.h"
10 |
11 | namespace SandHook {
12 |
13 | class AutoLock {
14 | public:
15 | inline AutoLock(std::mutex& mutex) : mLock(mutex) { mLock.lock(); }
16 | inline AutoLock(std::mutex* mutex) : mLock(*mutex) { mLock.lock(); }
17 | inline ~AutoLock() { mLock.unlock(); }
18 | private:
19 | std::mutex& mLock;
20 | };
21 |
22 | class StopTheWorld {
23 | public:
24 | inline StopTheWorld() { suspendVM(); }
25 | inline ~StopTheWorld() { resumeVM(); }
26 | };
27 |
28 | }
29 |
30 | #endif //SANDHOOK_LOCK_H
31 |
--------------------------------------------------------------------------------
/MikSdHook/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=-Xmx1536m
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 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/src/main/cpp/includes/art_compiler_options.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by 甘尧 on 2019/2/23.
3 | //
4 |
5 | #ifndef ART_COMPILER_OPTIONS_H
6 | #define ART_COMPILER_OPTIONS_H
7 |
8 | #include
9 |
10 | namespace art {
11 | class CompilerOptions {
12 | public:
13 | void* compiler_filter_;
14 | size_t huge_method_threshold_;
15 | size_t large_method_threshold_;
16 | size_t small_method_threshold_;
17 | size_t tiny_method_threshold_;
18 | size_t num_dex_methods_threshold_;
19 | size_t inline_depth_limit_;
20 | size_t inline_max_code_units_;
21 |
22 | size_t getInlineMaxCodeUnits();
23 | bool setInlineMaxCodeUnits(size_t units);
24 |
25 | };
26 | }
27 |
28 | #endif //ART_COMPILER_OPTIONS_H
29 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/archs/arm/arm32/inst/inst_code_arm32.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/5/16.
3 | //
4 |
5 | #pragma once
6 |
7 | enum class InstCodeA32 : InstCode {
8 |
9 | };
10 |
11 | enum class InstCodeT16 : InstCode {
12 | UNKNOW,
13 | BASE_SASMC,
14 | DATA_PROC,
15 | SPDIABE,
16 | MISC,
17 | B,
18 | B_COND,
19 | BX_BLX,
20 | CBZ_CBNZ,
21 | LDR_LIT,
22 | ADD_IMM_RDN,
23 | //rn = pc
24 | ADR,
25 | ADD_REG,
26 | CMP_REG,
27 | CMP_REG_EXT,
28 | MOV_IMM,
29 | MOV_REG,
30 | POP,
31 | PUSH,
32 | ADD_REG_RDN
33 | };
34 |
35 | enum class InstCodeT32 : InstCode {
36 | UNKNOW,
37 | B32,
38 | LDR_LIT,
39 | LDR_IMM,
40 | LDR_UIMM,
41 | MOV_MOVT_IMM,
42 | SUB_IMM,
43 | HVC
44 | };
--------------------------------------------------------------------------------
/app/.cxx/ndk_locator_record_3o456k3p.log:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "level": "INFO",
4 | "message": "android.ndkVersion from module build.gradle is [not set]"
5 | },
6 | {
7 | "level": "INFO",
8 | "message": "android.ndkPath from module build.gradle is not set"
9 | },
10 | {
11 | "level": "INFO",
12 | "message": "ndk.dir in local.properties is not set"
13 | },
14 | {
15 | "level": "INFO",
16 | "message": "Not considering ANDROID_NDK_HOME because support was removed after deprecation period."
17 | },
18 | {
19 | "level": "INFO",
20 | "message": "sdkFolder is /Users/king/Library/Android/sdk"
21 | },
22 | {
23 | "level": "INFO",
24 | "message": "Because no explicit NDK was requested, the default version [21.1.6352462] for this Android Gradle Plugin will be used"
25 | }
26 | ]
--------------------------------------------------------------------------------
/MikSdHook/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/archs/arm/arm32/hook/breakpoint_shellcode.S:
--------------------------------------------------------------------------------
1 | #include "shellcode_arm.h"
2 |
3 | .global callback_addr_s
4 | .global origin_addr_s
5 |
6 |
7 | .data
8 |
9 | FUNCTION_START(BP_SHELLCODE)
10 | push {r0, r1, r2, r3}
11 | mrs r0, cpsr
12 | str r0, [sp, #0xC]
13 | str r14, [sp, #8]
14 | add r14, sp, #0x10
15 | str r14, [sp, #4]
16 | pop {r0}
17 | push {r0-r12}
18 | mov r0, sp
19 | ldr r3, callback_addr_s
20 | blx r3
21 | ldr r0, [sp, #0x3C]
22 | msr cpsr, r0
23 | ldmfd sp!, {r0-r12}
24 | ldr r14, [sp, #4]
25 | ldr sp, [r13]
26 | ldr pc, origin_addr_s
27 | callback_addr_s:
28 | .long 0
29 | origin_addr_s:
30 | .long 0
31 | FUNCTION_END(BP_SHELLCODE)
32 |
33 | .end
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/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
--------------------------------------------------------------------------------
/MikSdHook/app/src/main/java/com/swift/sandhook/testHookers/ObjectHooker.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.testHookers;
2 |
3 | import android.util.Log;
4 |
5 | import com.swift.sandhook.annotation.HookClass;
6 | import com.swift.sandhook.annotation.HookMethod;
7 | import com.swift.sandhook.annotation.HookMethodBackup;
8 | import com.swift.sandhook.annotation.HookMode;
9 | import com.swift.sandhook.wrapper.HookWrapper;
10 |
11 | @HookClass(Object.class)
12 | public class ObjectHooker {
13 |
14 | @HookMethodBackup("toString")
15 | static HookWrapper.HookEntity toStrHook;
16 |
17 | @HookMethod("toString")
18 | @HookMode(HookMode.INLINE)
19 | public static String toStr(Object thiz) throws Throwable {
20 | Log.e("ObjectHooker", "hooked success ");
21 | return (String) toStrHook.callOrigin(thiz);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/archs/arm/arm64/hook/hook_arm64.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/5/23.
3 | //
4 |
5 | #pragma once
6 |
7 | #include "hook.h"
8 | #include
9 |
10 | namespace SandHook {
11 | namespace Hook {
12 | class InlineHookArm64Android : public InlineHook {
13 | public:
14 | void *Hook(void *origin, void *replace) override;
15 |
16 | bool BreakPoint(void *point, void (*callback)(REG[])) override;
17 |
18 | bool SingleBreakPoint(void *point, BreakCallback callback, void *data) override;
19 |
20 | void *SingleInstHook(void *origin, void *replace) override;
21 |
22 | bool ExceptionHandler(int num, sigcontext *context) override;
23 |
24 | private:
25 | std::vector hook_infos;
26 | };
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/archs/arm/arm32/hook/hook_arm32.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/5/23.
3 | //
4 |
5 | #pragma once
6 |
7 | #include "hook.h"
8 | #include
9 |
10 | namespace SandHook {
11 | namespace Hook {
12 |
13 | class InlineHookArm32Android : public InlineHook {
14 | public:
15 | void *Hook(void *origin, void *replace) override;
16 |
17 | bool BreakPoint(void *point, void (*callback)(REG *)) override;
18 |
19 | bool SingleBreakPoint(void *point, BreakCallback callback, void *data) override;
20 |
21 | void *SingleInstHook(void *origin, void *replace) override;
22 |
23 | bool ExceptionHandler(int num, sigcontext *context) override;
24 |
25 | private:
26 | std::vector hook_infos;
27 | };
28 |
29 | }
30 | }
--------------------------------------------------------------------------------
/MikSdHook/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
22 |
--------------------------------------------------------------------------------
/MikSdHook/hookers/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
22 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/src/main/java/com/swift/sandhook/HookLog.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook;
2 |
3 | import android.util.Log;
4 |
5 |
6 | public class HookLog {
7 |
8 | public static final String TAG = "SandHook";
9 |
10 | public static boolean DEBUG = SandHookConfig.DEBUG;
11 |
12 | public static int v(String s) {
13 | return Log.v(TAG, s);
14 | }
15 |
16 | public static int i(String s) {
17 | return Log.i(TAG, s);
18 | }
19 |
20 | public static int d(String s) {
21 | return Log.d(TAG, s);
22 | }
23 |
24 | public static int w(String s) {
25 | return Log.w(TAG, s);
26 | }
27 |
28 | public static int e(String s) {
29 | return Log.e(TAG, s);
30 | }
31 |
32 | public static int e(String s, Throwable t) {
33 | return Log.e(TAG, s, t);
34 | }
35 |
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/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
22 |
--------------------------------------------------------------------------------
/MikSdHook/xposedcompat/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
22 |
--------------------------------------------------------------------------------
/MikSdHook/xposedcompat/src/main/java/com/swift/sandhook/xposedcompat/methodgen/ErrorCatch.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.xposedcompat.methodgen;
2 |
3 | import android.util.Log;
4 |
5 | import com.swift.sandhook.SandHook;
6 | import com.swift.sandhook.xposedcompat.XposedCompat;
7 |
8 | import java.lang.reflect.Member;
9 | import java.lang.reflect.Method;
10 |
11 | public class ErrorCatch {
12 |
13 | public static Object callOriginError(Member originMethod, Method backupMethod, Object thiz, Object[] args) throws Throwable {
14 | if (XposedCompat.retryWhenCallOriginError) {
15 | Log.w("SandHook", "method <" + originMethod.toString() + "> use invoke to call origin!");
16 | return SandHook.callOriginMethod(originMethod, backupMethod, thiz, args);
17 | } else {
18 | return null;
19 | }
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/MikSdHook/xposedcompat_new/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
22 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/x86/build_output.txt:
--------------------------------------------------------------------------------
1 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
2 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -- works
3 | Detecting C compiler ABI info
4 | Detecting C compiler ABI info - done
5 | Detecting C compile features
6 | Detecting C compile features - done
7 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
8 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -- works
9 | Detecting CXX compiler ABI info
10 | Detecting CXX compiler ABI info - done
11 | Detecting CXX compile features
12 | Detecting CXX compile features - done
13 | Configuring done
--------------------------------------------------------------------------------
/MikSdHook/app/src/androidTest/java/com/swift/sandhook/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.swift.sandhook", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/x86_64/build_output.txt:
--------------------------------------------------------------------------------
1 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
2 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -- works
3 | Detecting C compiler ABI info
4 | Detecting C compiler ABI info - done
5 | Detecting C compile features
6 | Detecting C compile features - done
7 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
8 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -- works
9 | Detecting CXX compiler ABI info
10 | Detecting CXX compiler ABI info - done
11 | Detecting CXX compile features
12 | Detecting CXX compile features - done
13 | Configuring done
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/x86/build_output.txt:
--------------------------------------------------------------------------------
1 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
2 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -- works
3 | Detecting C compiler ABI info
4 | Detecting C compiler ABI info - done
5 | Detecting C compile features
6 | Detecting C compile features - done
7 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
8 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -- works
9 | Detecting CXX compiler ABI info
10 | Detecting CXX compiler ABI info - done
11 | Detecting CXX compile features
12 | Detecting CXX compile features - done
13 | Configuring done
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/x86_64/build_output.txt:
--------------------------------------------------------------------------------
1 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
2 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -- works
3 | Detecting C compiler ABI info
4 | Detecting C compiler ABI info - done
5 | Detecting C compile features
6 | Detecting C compile features - done
7 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
8 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -- works
9 | Detecting CXX compiler ABI info
10 | Detecting CXX compiler ABI info - done
11 | Detecting CXX compile features
12 | Detecting CXX compile features - done
13 | Configuring done
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/arm64-v8a/build_output.txt:
--------------------------------------------------------------------------------
1 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
2 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -- works
3 | Detecting C compiler ABI info
4 | Detecting C compiler ABI info - done
5 | Detecting C compile features
6 | Detecting C compile features - done
7 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
8 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -- works
9 | Detecting CXX compiler ABI info
10 | Detecting CXX compiler ABI info - done
11 | Detecting CXX compile features
12 | Detecting CXX compile features - done
13 | Configuring done
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/armeabi-v7a/build_output.txt:
--------------------------------------------------------------------------------
1 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
2 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -- works
3 | Detecting C compiler ABI info
4 | Detecting C compiler ABI info - done
5 | Detecting C compile features
6 | Detecting C compile features - done
7 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
8 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -- works
9 | Detecting CXX compiler ABI info
10 | Detecting CXX compiler ABI info - done
11 | Detecting CXX compile features
12 | Detecting CXX compile features - done
13 | Configuring done
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/x86/compile_commands.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "directory": "/Users/king/git_src/MikSandHook/app/.cxx/cmake/debug/x86",
4 | "command": "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=i686-none-linux-android28 --gcc-toolchain=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dnative_lib_EXPORTS -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++11 -O0 -fno-limit-debug-info -fPIC -o CMakeFiles/native-lib.dir/native-lib.cpp.o -c /Users/king/git_src/MikSandHook/app/src/main/cpp/native-lib.cpp",
5 | "file": "/Users/king/git_src/MikSandHook/app/src/main/cpp/native-lib.cpp"
6 | }
7 | ]
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/arm64-v8a/build_output.txt:
--------------------------------------------------------------------------------
1 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
2 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -- works
3 | Detecting C compiler ABI info
4 | Detecting C compiler ABI info - done
5 | Detecting C compile features
6 | Detecting C compile features - done
7 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
8 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -- works
9 | Detecting CXX compiler ABI info
10 | Detecting CXX compiler ABI info - done
11 | Detecting CXX compile features
12 | Detecting CXX compile features - done
13 | Configuring done
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/armeabi-v7a/build_output.txt:
--------------------------------------------------------------------------------
1 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
2 | Check for working C compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -- works
3 | Detecting C compiler ABI info
4 | Detecting C compiler ABI info - done
5 | Detecting C compile features
6 | Detecting C compile features - done
7 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
8 | Check for working CXX compiler: /Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -- works
9 | Detecting CXX compiler ABI info
10 | Detecting CXX compiler ABI info - done
11 | Detecting CXX compile features
12 | Detecting CXX compile features - done
13 | Configuring done
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/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
22 |
23 | -keep class com.swift.sandhook.** { *; }
24 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/x86_64/compile_commands.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "directory": "/Users/king/git_src/MikSandHook/app/.cxx/cmake/debug/x86_64",
4 | "command": "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=x86_64-none-linux-android28 --gcc-toolchain=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dnative_lib_EXPORTS -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++11 -O0 -fno-limit-debug-info -fPIC -o CMakeFiles/native-lib.dir/native-lib.cpp.o -c /Users/king/git_src/MikSandHook/app/src/main/cpp/native-lib.cpp",
5 | "file": "/Users/king/git_src/MikSandHook/app/src/main/cpp/native-lib.cpp"
6 | }
7 | ]
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/arm64-v8a/compile_commands.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "directory": "/Users/king/git_src/MikSandHook/app/.cxx/cmake/debug/arm64-v8a",
4 | "command": "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android28 --gcc-toolchain=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dnative_lib_EXPORTS -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++11 -O0 -fno-limit-debug-info -fPIC -o CMakeFiles/native-lib.dir/native-lib.cpp.o -c /Users/king/git_src/MikSandHook/app/src/main/cpp/native-lib.cpp",
5 | "file": "/Users/king/git_src/MikSandHook/app/src/main/cpp/native-lib.cpp"
6 | }
7 | ]
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/x86/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/x86_64/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/x86/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/mik/miksandhook/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.mik.miksandhook;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 | assertEquals("com.mik.miksandhook", appContext.getPackageName());
25 | }
26 | }
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/arm64-v8a/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/armeabi-v7a/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/arm64-v8a/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/x86_64/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/src/main/cpp/includes/arch_base.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by SwiftGan on 2019/1/17.
3 | //
4 |
5 | #ifndef SANDHOOK_BASE_H
6 | #define SANDHOOK_BASE_H
7 |
8 | #define FUNCTION_START(x) \
9 | .text; \
10 | .align 4; \
11 | .global x; \
12 | x: \
13 |
14 | #define FUNCTION_START_T(x) \
15 | .syntax unified; \
16 | .text; \
17 | .align 4; \
18 | .thumb; \
19 | .thumb_func; \
20 | .global x; \
21 | x: \
22 |
23 | #define FUNCTION_END(x) .size x, .-x
24 |
25 | #define REPLACEMENT_HOOK_TRAMPOLINE replacement_hook_trampoline
26 | #define INLINE_HOOK_TRAMPOLINE inline_hook_trampoline
27 | #define DIRECT_JUMP_TRAMPOLINE direct_jump_trampoline
28 | #define CALL_ORIGIN_TRAMPOLINE call_origin_trampoline
29 |
30 | #define INLINE_HOOK_TRAMPOLINE_T inline_hook_trampoline_t
31 | #define DIRECT_JUMP_TRAMPOLINE_T direct_jump_trampoline_t
32 | #define CALL_ORIGIN_TRAMPOLINE_T call_origin_trampoline_t
33 |
34 | #endif //SANDHOOK_BASE_H
35 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/relocate/code_relocate.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/5/10.
3 | //
4 |
5 | #include "code_relocate.h"
6 |
7 | using namespace SandHook::Asm;
8 |
9 | //in range of Copy
10 | bool CodeRelocate::InRelocateRange(Off targetOffset, Addr targetLen) {
11 | Off startP = cur_offset + targetOffset;
12 | Off endP = startP + targetLen;
13 | return startP >= 0 && endP <= length;
14 | }
15 |
16 | Label *CodeRelocate::GetLaterBindLabel(Addr offset) {
17 | Label* label_per_unit = nullptr;
18 | std::map::iterator it = later_bind_labels->find(offset);
19 | if (it != later_bind_labels->end()) {
20 | label_per_unit = it->second;
21 | }
22 | if (label_per_unit == nullptr) {
23 | label_per_unit = new Label();
24 | later_bind_labels->insert(std::map::value_type(offset, label_per_unit));
25 | }
26 | return label_per_unit;
27 | }
--------------------------------------------------------------------------------
/MikSdHook/xposedcompat/src/main/java/de/robv/android/xposed/callbacks/IXUnhook.java:
--------------------------------------------------------------------------------
1 | package de.robv.android.xposed.callbacks;
2 |
3 | import de.robv.android.xposed.IXposedHookZygoteInit;
4 |
5 | /**
6 | * Interface for objects that can be used to remove callbacks.
7 | *
8 | * Just like hooking methods etc., unhooking applies only to the current process.
9 | * In other process (or when the app is removed from memory and then restarted), the hook will still
10 | * be active. The Zygote process (see {@link IXposedHookZygoteInit}) is an exception, the hook won't
11 | * be inherited by any future processes forked from it in the future.
12 | *
13 | * @param The class of the callback.
14 | */
15 | public interface IXUnhook {
16 | /**
17 | * Returns the callback that has been registered.
18 | */
19 | T getCallback();
20 |
21 | /**
22 | * Removes the callback.
23 | */
24 | void unhook();
25 | }
26 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/armeabi-v7a/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/MikSdHook/xposedcompat_new/src/main/java/de/robv/android/xposed/callbacks/IXUnhook.java:
--------------------------------------------------------------------------------
1 | package de.robv.android.xposed.callbacks;
2 |
3 | import de.robv.android.xposed.IXposedHookZygoteInit;
4 |
5 | /**
6 | * Interface for objects that can be used to remove callbacks.
7 | *
8 | * Just like hooking methods etc., unhooking applies only to the current process.
9 | * In other process (or when the app is removed from memory and then restarted), the hook will still
10 | * be active. The Zygote process (see {@link IXposedHookZygoteInit}) is an exception, the hook won't
11 | * be inherited by any future processes forked from it in the future.
12 | *
13 | * @param The class of the callback.
14 | */
15 | public interface IXUnhook {
16 | /**
17 | * Returns the callback that has been registered.
18 | */
19 | T getCallback();
20 |
21 | /**
22 | * Removes the callback.
23 | */
24 | void unhook();
25 | }
26 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/.cxx/cmake/debug/arm64-v8a/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/.cxx/cmake/debug/armeabi-v7a/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/.cxx/cmake/release/arm64-v8a/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/.cxx/cmake/debug/arm64-v8a/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/x86/compile_commands.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "directory": "/Users/king/AndroidStudioProjects/MikSandHook/app/.cxx/cmake/release/x86",
4 | "command": "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=i686-none-linux-android28 --gcc-toolchain=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dnative_lib_EXPORTS -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++11 -O2 -DNDEBUG -fPIC -o CMakeFiles/native-lib.dir/native-lib.cpp.o -c /Users/king/AndroidStudioProjects/MikSandHook/app/src/main/cpp/native-lib.cpp",
5 | "file": "/Users/king/AndroidStudioProjects/MikSandHook/app/src/main/cpp/native-lib.cpp"
6 | }
7 | ]
--------------------------------------------------------------------------------
/MikSdHook/app/src/main/java/com/swift/sandhook/testHookers/LogHooker.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.testHookers;
2 |
3 | import android.util.Log;
4 |
5 | import com.swift.sandhook.SandHook;
6 | import com.swift.sandhook.annotation.HookClass;
7 | import com.swift.sandhook.annotation.HookMethod;
8 | import com.swift.sandhook.annotation.HookMethodBackup;
9 | import com.swift.sandhook.annotation.Param;
10 | import com.swift.sandhook.annotation.SkipParamCheck;
11 |
12 | import java.lang.reflect.Method;
13 |
14 | @HookClass(Log.class)
15 | public class LogHooker {
16 |
17 | @HookMethodBackup("w")
18 | @SkipParamCheck
19 | static Method backup;
20 |
21 | @HookMethod("w")
22 | public static int onCreate(String tag, @Param("java.lang.String") Object msg) throws Throwable {
23 | Log.e("LogHooker", "hooked success " + tag);
24 | return (int) SandHook.callOriginByBackup(backup, null, tag, msg);
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/.cxx/cmake/release/armeabi-v7a/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/.cxx/cmake/debug/armeabi-v7a/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/.cxx/cmake/release/arm64-v8a/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/.cxx/cmake/release/armeabi-v7a/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/archs/arm/arm32/register/register_list_arm32.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/5/8.
3 | //
4 |
5 | #pragma once
6 |
7 | #include "register_arm32.h"
8 |
9 | using namespace SandHook::Asm;
10 |
11 | // clang-format off
12 | #define ARM32_REGISTER_COUNT 16
13 |
14 | #define ARM32_REGISTER_CODE_LIST(R) \
15 | R(0) R(1) R(2) R(3) R(4) R(5) R(6) R(7) \
16 | R(8) R(9) R(10) R(11) R(12) R(13) R(14) R(15)
17 |
18 |
19 | namespace SandHook {
20 | namespace RegistersA32 {
21 | #define DEFINE_REGISTERS(N) \
22 | extern RegisterA32 R##N;
23 | ARM32_REGISTER_CODE_LIST(DEFINE_REGISTERS)
24 | #undef DEFINE_REGISTERS
25 |
26 | extern RegisterA32 SP;
27 | extern RegisterA32 IP;
28 | extern RegisterA32 LR;
29 | extern RegisterA32 PC;
30 | extern RegisterA32 UnknowRegiser;
31 | }}
32 | #define Reg(N) RegisterA32::get(N)
--------------------------------------------------------------------------------
/app/.cxx/cmake/debug/armeabi-v7a/compile_commands.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "directory": "/Users/king/git_src/MikSandHook/app/.cxx/cmake/debug/armeabi-v7a",
4 | "command": "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=armv7-none-linux-androideabi28 --gcc-toolchain=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dnative_lib_EXPORTS -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -std=c++11 -O0 -fno-limit-debug-info -fPIC -o CMakeFiles/native-lib.dir/native-lib.cpp.o -c /Users/king/git_src/MikSandHook/app/src/main/cpp/native-lib.cpp",
5 | "file": "/Users/king/git_src/MikSandHook/app/src/main/cpp/native-lib.cpp"
6 | }
7 | ]
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/x86_64/compile_commands.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "directory": "/Users/king/AndroidStudioProjects/MikSandHook/app/.cxx/cmake/release/x86_64",
4 | "command": "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=x86_64-none-linux-android28 --gcc-toolchain=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dnative_lib_EXPORTS -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++11 -O2 -DNDEBUG -fPIC -o CMakeFiles/native-lib.dir/native-lib.cpp.o -c /Users/king/AndroidStudioProjects/MikSandHook/app/src/main/cpp/native-lib.cpp",
5 | "file": "/Users/king/AndroidStudioProjects/MikSandHook/app/src/main/cpp/native-lib.cpp"
6 | }
7 | ]
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/utils/platform.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/5/11.
3 | //
4 |
5 | #include
6 | #include
7 | #include "platform.h"
8 |
9 | bool FlushCache(Addr addr, Off len) {
10 | #if defined(__arm__)
11 | int i = cacheflush(addr, addr + len, 0);
12 | if (i == -1) {
13 | return false;
14 | }
15 | return true;
16 | #elif defined(__aarch64__)
17 | char *begin = reinterpret_cast(addr);
18 | __builtin___clear_cache(begin, begin + len);
19 | #endif
20 | return true;
21 | }
22 |
23 |
24 | extern "C" bool MemUnprotect(Addr addr, Addr len) {
25 | long pagesize = PAGE_SIZE;
26 | unsigned alignment = (unsigned)((unsigned long long)addr % pagesize);
27 | int i = mprotect((void *) (addr - alignment), (size_t) (alignment + len),
28 | PROT_READ | PROT_WRITE | PROT_EXEC);
29 | return i != -1;
30 | }
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/arm64-v8a/compile_commands.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "directory": "/Users/king/AndroidStudioProjects/MikSandHook/app/.cxx/cmake/release/arm64-v8a",
4 | "command": "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android28 --gcc-toolchain=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dnative_lib_EXPORTS -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++11 -O2 -DNDEBUG -fPIC -o CMakeFiles/native-lib.dir/native-lib.cpp.o -c /Users/king/AndroidStudioProjects/MikSandHook/app/src/main/cpp/native-lib.cpp",
5 | "file": "/Users/king/AndroidStudioProjects/MikSandHook/app/src/main/cpp/native-lib.cpp"
6 | }
7 | ]
--------------------------------------------------------------------------------
/MikSdHook/hooklib/src/main/cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.4.1)
2 | project(sandhook)
3 |
4 | ENABLE_LANGUAGE(ASM)
5 |
6 | add_definitions(-std=c++11)
7 |
8 | set(${PROJECT_NAME}_SOURCES
9 | sandhook.cpp
10 | trampoline/trampoline.cpp
11 | trampoline/trampoline_manager.cpp
12 | utils/dlfcn_nougat.cpp
13 | utils/hide_api.cpp
14 | utils/utils.cpp
15 | utils/offset.cpp
16 | utils/elf_util.cpp
17 | casts/cast_art_method.cpp
18 | casts/cast_compiler_options.cpp
19 | art/art_method.cpp
20 | art/art_compiler_options.cpp
21 | trampoline/arch/arm32.S
22 | trampoline/arch/arm64.S
23 | inst/insts_arm32.cpp
24 | inst/insts_arm64.cpp
25 | nativehook/native_hook.cpp
26 | )
27 |
28 | add_library(${PROJECT_NAME}
29 | SHARED
30 | ${${PROJECT_NAME}_SOURCES})
31 |
32 | target_link_libraries(${PROJECT_NAME} log)
--------------------------------------------------------------------------------
/MikSdHook/nativehook/src/main/cpp/archs/arm/arm64/register/register_list_arm64.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by swift on 2019/5/9.
3 | //
4 |
5 | #include "register_list_arm64.h"
6 |
7 |
8 | namespace SandHook {
9 | namespace RegistersA64 {
10 | #define INIT_REGISTERS(N) \
11 | WRegister W##N = WRegister(N); \
12 | XRegister X##N = XRegister(N);
13 | AARCH64_REGISTER_CODE_LIST(INIT_REGISTERS)
14 | #undef INIT_REGISTERS
15 |
16 | WRegister WSP = WRegister(RegisterA64::kSPRegInternalCode);
17 | XRegister SP = XRegister(RegisterA64::kSPRegInternalCode);
18 | XRegister IP0 = X16;
19 | XRegister IP1 = X17;
20 | XRegister LR = X30;
21 | //zero reg_
22 | XRegister XZR = X31;
23 | WRegister WZR = W31;
24 | RegisterA64 UnknowRegiser = RegisterA64(38);
25 |
26 | SystemRegister NZCV = SystemRegister(3, 3, 4, 2, 0);
27 | SystemRegister FPCR = SystemRegister(3, 3, 4, 4, 0);
28 | }
29 | }
--------------------------------------------------------------------------------
/MikSdHook/xposedcompat_new/src/main/java/com/swift/sandhook/xposedcompat/utils/ProxyClassLoader.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.xposedcompat.utils;
2 |
3 | public class ProxyClassLoader extends ClassLoader {
4 |
5 | private final ClassLoader mClassLoader;
6 |
7 | public ProxyClassLoader(ClassLoader parentCL, ClassLoader appCL) {
8 | super(parentCL);
9 | mClassLoader = appCL;
10 | }
11 |
12 | @Override
13 | protected Class> loadClass(String name, boolean resolve) throws ClassNotFoundException {
14 | Class clazz = null;
15 |
16 | try {
17 | clazz = mClassLoader.loadClass(name);
18 | } catch (ClassNotFoundException ignored) {
19 | }
20 |
21 | if (clazz == null) {
22 | clazz = super.loadClass(name, resolve);
23 | if (clazz == null) {
24 | throw new ClassNotFoundException();
25 | }
26 | }
27 |
28 | return clazz;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/.cxx/cmake/release/armeabi-v7a/compile_commands.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "directory": "/Users/king/AndroidStudioProjects/MikSandHook/app/.cxx/cmake/release/armeabi-v7a",
4 | "command": "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=armv7-none-linux-androideabi28 --gcc-toolchain=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dnative_lib_EXPORTS -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -std=c++11 -Oz -DNDEBUG -fPIC -o CMakeFiles/native-lib.dir/native-lib.cpp.o -c /Users/king/AndroidStudioProjects/MikSandHook/app/src/main/cpp/native-lib.cpp",
5 | "file": "/Users/king/AndroidStudioProjects/MikSandHook/app/src/main/cpp/native-lib.cpp"
6 | }
7 | ]
--------------------------------------------------------------------------------
/MikSdHook/xposedcompat/src/main/java/com/swift/sandhook/xposedcompat/classloaders/ProxyClassLoader.java:
--------------------------------------------------------------------------------
1 | package com.swift.sandhook.xposedcompat.classloaders;
2 |
3 | public class ProxyClassLoader extends ClassLoader {
4 |
5 | private final ClassLoader mClassLoader;
6 |
7 | public ProxyClassLoader(ClassLoader parentCL, ClassLoader appCL) {
8 | super(parentCL);
9 | mClassLoader = appCL;
10 | }
11 |
12 | @Override
13 | protected Class> loadClass(String name, boolean resolve) throws ClassNotFoundException {
14 | Class clazz = null;
15 |
16 | try {
17 | clazz = mClassLoader.loadClass(name);
18 | } catch (ClassNotFoundException ignored) {
19 | }
20 |
21 | if (clazz == null) {
22 | clazz = super.loadClass(name, resolve);
23 | if (clazz == null) {
24 | throw new ClassNotFoundException();
25 | }
26 | }
27 |
28 | return clazz;
29 | }
30 | }
--------------------------------------------------------------------------------
/MikSdHook/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
20 |
21 |
--------------------------------------------------------------------------------
/MikSdHook/xposedcompat/src/main/java/de/robv/android/xposed/IXposedHookCmdInit.java:
--------------------------------------------------------------------------------
1 | package de.robv.android.xposed;
2 |
3 |
4 | /**
5 | * Hook the initialization of Java-based command-line tools (like pm).
6 | *
7 | * @hide Xposed no longer hooks command-line tools, therefore this interface shouldn't be
8 | * implemented anymore.
9 | */
10 | public interface IXposedHookCmdInit extends IXposedMod {
11 | /**
12 | * Called very early during startup of a command-line tool.
13 | * @param startupParam Details about the module itself and the started process.
14 | * @throws Throwable Everything is caught, but it will prevent further initialization of the module.
15 | */
16 | void initCmdApp(StartupParam startupParam) throws Throwable;
17 |
18 | /** Data holder for {@link #initCmdApp}. */
19 | final class StartupParam {
20 | /*package*/ StartupParam() {}
21 |
22 | /** The path to the module's APK. */
23 | public String modulePath;
24 |
25 | /** The class name of the tools that the hook was invoked for. */
26 | public String startClassName;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/.cxx/cmake/debug/arm64-v8a/CMakeFiles/3.10.2/CMakeASMCompiler.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_ASM_COMPILER "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang")
2 | set(CMAKE_ASM_COMPILER_ARG1 "")
3 | set(CMAKE_AR "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ar")
4 | set(CMAKE_ASM_COMPILER_AR "CMAKE_ASM_COMPILER_AR-NOTFOUND")
5 | set(CMAKE_RANLIB "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ranlib")
6 | set(CMAKE_ASM_COMPILER_RANLIB "CMAKE_ASM_COMPILER_RANLIB-NOTFOUND")
7 | set(CMAKE_LINKER "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ld")
8 | set(CMAKE_ASM_COMPILER_LOADED 1)
9 | set(CMAKE_ASM_COMPILER_ID "Clang")
10 | set(CMAKE_ASM_COMPILER_VERSION "")
11 | set(CMAKE_ASM_COMPILER_ENV_VAR "ASM")
12 |
13 |
14 | set(CMAKE_ASM_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
15 | set(CMAKE_ASM_LINKER_PREFERENCE 0)
16 |
17 |
18 |
--------------------------------------------------------------------------------
/MikSdHook/hooklib/.cxx/cmake/debug/armeabi-v7a/CMakeFiles/3.10.2/CMakeASMCompiler.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_ASM_COMPILER "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang")
2 | set(CMAKE_ASM_COMPILER_ARG1 "")
3 | set(CMAKE_AR "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar")
4 | set(CMAKE_ASM_COMPILER_AR "CMAKE_ASM_COMPILER_AR-NOTFOUND")
5 | set(CMAKE_RANLIB "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ranlib")
6 | set(CMAKE_ASM_COMPILER_RANLIB "CMAKE_ASM_COMPILER_RANLIB-NOTFOUND")
7 | set(CMAKE_LINKER "/Users/king/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ld")
8 | set(CMAKE_ASM_COMPILER_LOADED 1)
9 | set(CMAKE_ASM_COMPILER_ID "Clang")
10 | set(CMAKE_ASM_COMPILER_VERSION "")
11 | set(CMAKE_ASM_COMPILER_ENV_VAR "ASM")
12 |
13 |
14 | set(CMAKE_ASM_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
15 | set(CMAKE_ASM_LINKER_PREFERENCE 0)
16 |
17 |
18 |
--------------------------------------------------------------------------------