Shamrock: 添加native检测绕过模板

This commit is contained in:
WhiteChi 2023-11-26 18:32:55 +08:00
parent 4932b36ee1
commit f63bcabf1b
7 changed files with 44 additions and 9 deletions

View File

@ -18,6 +18,8 @@
android:supportsRtl="true"
android:theme="@style/Theme.Shamrock"
android:zygotePreloadName="@string/app_name"
android:multiArch="true"
android:extractNativeLibs="false"
tools:targetApi="31">
<activity
android:name=".MainActivity"

View File

@ -0,0 +1 @@
libclover.so

View File

@ -10,7 +10,7 @@ cmake_minimum_required(VERSION 3.22.1)
# Since this is the top level CMakeLists.txt, the project name is also accessible
# with ${CMAKE_PROJECT_NAME} (both CMake variables are in-sync within the top level
# build script scope).
project("xposed")
project("clover")
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
@ -27,7 +27,7 @@ project("xposed")
# used in the AndroidManifest.xml file.
add_library(${CMAKE_PROJECT_NAME} SHARED
# List C/C++ source files with relative paths to this CMakeLists.txt.
xposed.cpp)
clover.cpp)
# Specifies libraries CMake should link to your target library. You
# can link libraries from various origins, such as libraries defined in this

View File

@ -0,0 +1,19 @@
#include <jni.h>
#include <string>
#include <utility>
#include <sys/auxv.h>
#include <dlfcn.h>
#include "lsposed.h"
void on_library_loaded(const char *name, void *handle) {
if (std::string(name) == "libc.so") {
void *target = dlsym(handle, "__system_property_get");
}
}
extern "C" [[gnu::visibility("default")]] [[gnu::used]]
NativeOnModuleLoaded native_init(const NativeAPIEntries *entries) {
return on_library_loaded;
}

View File

@ -0,0 +1,20 @@
#ifndef SHAMROCK_LSPOSED_H
#define SHAMROCK_LSPOSED_H
#include "stdint.h"
typedef int (*HookFunType)(void *func, void *replace, void **backup);
typedef int (*UnhookFunType)(void *func);
typedef void (*NativeOnModuleLoaded)(const char *name, void *handle);
typedef struct {
uint32_t version;
HookFunType hook_func;
UnhookFunType unhook_func;
} NativeAPIEntries;
typedef NativeOnModuleLoaded (*NativeInit)(const NativeAPIEntries *entries);
#endif //SHAMROCK_LSPOSED_H

View File

@ -1,5 +0,0 @@
#include <jni.h>
#include <string>
#include <utility>
#include <sys/auxv.h>

View File

@ -16,8 +16,6 @@ internal object NativeLoader {
return externalLibPath.resolve("libffmpegkit.so").exists()
}
private var isInitShamrock = false
/**
* 使目标进程可以使用来自模块的库
*/