Skip to content

Commit 770cf49

Browse files
first commit
1 parent ab8bae0 commit 770cf49

31 files changed

+2803
-1
lines changed

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
1-
# Il2cppTraceModule
1+
# Il2cpp-Trace-Module
22
一个用于对unity il2cpp框架开发的安卓端手游进行trace的so模块
3+
4+
5+
# 如何使用?
6+
使用方法目前和[frida-il2cpp-trace-module](https://github.com/AndroidReverser-Test/frida-il2cpp-trace-module)保持一致
7+
8+
9+
# 已知的问题
10+
部分游戏可能会在trace时崩溃,这与hook框架有关
11+
12+
13+
# 感谢
14+
[Zygisk-Il2CppDumper](https://github.com/Perfare/Zygisk-Il2CppDumper)
15+
[Dobby](https://github.com/jmpews/Dobby)
16+
[Android_InlineHook](https://github.com/zhuotong/Android_InlineHook)

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle.kts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
}
4+
5+
android {
6+
namespace = "com.test.check.il2cpp_trace_module"
7+
compileSdk = 35
8+
9+
defaultConfig {
10+
applicationId = "com.test.check.il2cpp_trace_module"
11+
minSdk = 29
12+
targetSdk = 35
13+
versionCode = 1
14+
versionName = "1.0"
15+
16+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
17+
ndk {
18+
abiFilters.add("arm64-v8a") // 只编译 arm64 架构
19+
}
20+
}
21+
22+
buildTypes {
23+
release {
24+
isMinifyEnabled = false
25+
proguardFiles(
26+
getDefaultProguardFile("proguard-android-optimize.txt"),
27+
"proguard-rules.pro"
28+
)
29+
}
30+
}
31+
compileOptions {
32+
sourceCompatibility = JavaVersion.VERSION_11
33+
targetCompatibility = JavaVersion.VERSION_11
34+
}
35+
externalNativeBuild {
36+
cmake {
37+
path = file("src/main/cpp/CMakeLists.txt")
38+
version = "3.22.1"
39+
}
40+
}
41+
buildFeatures {
42+
viewBinding = true
43+
prefab = true
44+
}
45+
}
46+
47+
dependencies {
48+
implementation("io.github.vvb2060.ndk:dobby:+")
49+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.test.check.il2cpp_trace_module;
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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
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.test.check.il2cpp_trace_module", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
</manifest>

app/src/main/cpp/CMakeLists.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# For more information about using CMake with Android Studio, read the
2+
# documentation: https://d.android.com/studio/projects/add-native-code.html.
3+
# For more examples on how to use CMake, see https://github.com/android/ndk-samples.
4+
5+
# Sets the minimum CMake version required for this project.
6+
cmake_minimum_required(VERSION 3.22.1)
7+
8+
# Declares the project name. The project name can be accessed via ${ PROJECT_NAME},
9+
# Since this is the top level CMakeLists.txt, the project name is also accessible
10+
# with ${CMAKE_PROJECT_NAME} (both CMake variables are in-sync within the top level
11+
# build script scope).
12+
project("il2cpp_trace_module")
13+
14+
# Creates and names a library, sets it as either STATIC
15+
# or SHARED, and provides the relative paths to its source code.
16+
# You can define multiple libraries, and CMake builds them for you.
17+
# Gradle automatically packages shared libraries with your APK.
18+
#
19+
# In this top level CMakeLists.txt, ${CMAKE_PROJECT_NAME} is used to define
20+
# the target library name; in the sub-module's CMakeLists.txt, ${PROJECT_NAME}
21+
# is preferred for the same purpose.
22+
#
23+
# In order to load a library into your app from Java/Kotlin, you must call
24+
# System.loadLibrary() and pass the name of the library defined here;
25+
# for GameActivity/NativeActivity derived applications, the same library name must be
26+
# used in the AndroidManifest.xml file.
27+
28+
include_directories(
29+
xdl/include
30+
)
31+
32+
aux_source_directory(xdl xdl-src)
33+
34+
35+
add_library(${CMAKE_PROJECT_NAME} SHARED
36+
# List C/C++ source files with relative paths to this CMakeLists.txt.
37+
il2cpp_trace.cpp
38+
${xdl-src})
39+
40+
find_package(dobby REQUIRED CONFIG)
41+
42+
43+
# Specifies libraries CMake should link to your target library. You
44+
# can link libraries from various origins, such as libraries defined in this
45+
# build script, prebuilt third-party libraries, or Android system libraries.
46+
target_link_libraries(${CMAKE_PROJECT_NAME}
47+
# List libraries link to the target library
48+
dobby::dobby
49+
log)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifndef DO_API_NO_RETURN
2+
#define DO_API_NO_RETURN(r, n, p) DO_API(r,n,p)
3+
#endif
4+
5+
DO_API(const MethodInfo*, il2cpp_class_get_methods, (void * klass, void* *iter));
6+
DO_API(Il2CppManagedMemorySnapshot*, il2cpp_capture_memory_snapshot, ());
7+
DO_API(void, il2cpp_free_captured_memory_snapshot, (Il2CppManagedMemorySnapshot * snapshot));
8+
DO_API(const char*, il2cpp_method_get_name, (const MethodInfo * method));
9+
DO_API(void, il2cpp_stop_gc_world, ());
10+
DO_API(void, il2cpp_start_gc_world, ());

0 commit comments

Comments
 (0)