GeezerVison is showing github.com — feat: 更新Pro版本4.2.6 新增大量功能 · gstjee/SKRoot-linuxKernelRoot@f588728
File treeExpand file treeCollapse file tree Open diff view settings kernel_module_kit/include
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: Pro(众测开放中)/SKRoot(Pro)功能介绍.txt +2-4Lines changed: 2 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 | 支持的特质: | 4 | 4 | 一、支持动态的Linux内核模块功能,一个模块跨所有内核运行。(SKRoot内核模块) | 5 | 5 | 二、支持热修改Hook内核,最高支持10万个Hook位置,且无性能损耗(不使用kprobe) | 6 | | -三、包含隐藏Bootloader模块 | 7 | | -四、包含隐藏目录模块 | 8 | | -五、包含Linux内存读写模块 | 9 | | -六、可管理授权Root程序 | | 6 | +三、可管理授权Root程序 | | 7 | +四、包含模块:隐藏Bootloader模块、隐藏目录模块、Linux内存读写模块 | 10 | 8 |
| 11 | 9 | 环境特质: | 12 | 10 | 1.不需要Linux内核源码 | |
Collapse file Copy file name to clipboard Collapse file Copy file name to clipboardExpand all lines: Pro(众测开放中)/sources/PermissionManager/app/build.gradle +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,7 +10,7 @@ android { | 10 | 10 | minSdk 26 | 11 | 11 | targetSdk 31 | 12 | 12 | versionCode 1 | 13 | | - versionName "4.2.5" | | 13 | + versionName "4.2.6" | 14 | 14 |
| 15 | 15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | 16 | 16 | externalNativeBuild { | |
Collapse file Copy file name to clipboardExpand all lines: Pro(众测开放中)/sources/testModule/kernel_module_kit/include/kernel_offset_file.h +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,4 +28,18 @@ KModErr get_file_f_inode_offset(uint32_t & offset); | 28 | 28 | * 返回: OK 表示成功;其它值为错误码 | 29 | 29 | ***************************************************************************/ | 30 | 30 | KModErr get_file_f_op_offset(uint32_t & offset); | | 31 | + | | 32 | +/*************************************************************************** | | 33 | +* 获取 file 结构体中 struct cred *f_cred; 字段的偏移量 | | 34 | +* 参数: offset 输出参数,返回 f_cred 字段相对于 file 起始的偏移量(字节) | | 35 | +* 返回: OK 表示成功;其它值为错误码 | | 36 | +***************************************************************************/ | | 37 | +KModErr get_file_f_cred_offset(uint32_t & offset); | | 38 | + | | 39 | +/*************************************************************************** | | 40 | +* 获取 file 结构体中 void* private_data; 字段的偏移量 | | 41 | +* 参数: offset 输出参数,返回 private_data 字段相对于 file 起始的偏移量(字节) | | 42 | +* 返回: OK 表示成功;其它值为错误码 | | 43 | +***************************************************************************/ | | 44 | +KModErr get_file_private_data_offset(uint32_t & offset); | 31 | 45 | } |
Collapse file Copy file name to clipboardExpand all lines: Pro(众测开放中)/sources/testModule/kernel_module_kit_test/kernel_module_kit_test.cpp +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -174,7 +174,6 @@ KModErr Test_install_kernel_function_after_hook() { | 174 | 174 | int main(int argc, char *argv[]) { | 175 | 175 | //TODO: 在此修改你的Root key值。 | 176 | 176 | fake_skroot_module_main("vzXtDKDAltAGxHtMGRZZfVouy90dgNqFsLM6UGeqb6OgH0VX"); | 177 | | - | 178 | 177 | // 单元测试:内核模块基础能力 | 179 | 178 | int idx = 1; | 180 | 179 | TEST(idx++, Test_execute_kernel_asm_func); // 执行shellcode并获取返回值 | @@ -227,6 +226,8 @@ int main(int argc, char *argv[]) { | 227 | 226 | TEST(idx++, Test_get_file_f_path_offset); // 获取 file 结构体中 f_path 字段的偏移量 | 228 | 227 | TEST(idx++, Test_get_file_f_inode_offset); // 获取 file 结构体中 f_inode 字段的偏移量 | 229 | 228 | TEST(idx++, Test_get_file_f_op_offset); // 获取 file 结构体中 f_op 字段的偏移量 | | 229 | + TEST(idx++, Test_get_file_f_cred_offset); // 获取 file 结构体中 f_cred 字段的偏移量 | | 230 | + TEST(idx++, Test_get_file_private_data_offset); // 获取 file 结构体中 private_data 字段的偏移量 | 230 | 231 | TEST(idx++, Test_get_vm_area_struct_vm_offset); // 获取 vm_area_struct 结构体中 vm 字段的偏移量 | 231 | 232 | TEST(idx++, Test_get_vm_area_struct_vm_flags_offset); // 获取 vm_area_struct 结构体中 vm_flags 字段的偏移量 | 232 | 233 | TEST(idx++, Test_get_vm_area_struct_vm_file_offset); // 获取 vm_area_struct 结构体中 vm_file 字段的偏移量 | |
Collapse file Copy file name to clipboardExpand all lines: Pro(众测开放中)/sources/testModule/kernel_module_kit_test/test_linux_kernel_offset.h +19Lines changed: 19 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -125,26 +125,45 @@ KModErr Test_get_dentry_d_iname_offset() { | 125 | 125 | } | 126 | 126 |
| 127 | 127 | KModErr Test_get_file_f_path_offset() { | | 128 | + REQUIRE_ROOT_OR_RETURN(); | 128 | 129 | uint32_t offset = 0; | 129 | 130 | RETURN_IF_ERROR(kernel_module::get_file_f_path_offset(offset)); | 130 | 131 | printf("Output offset: 0x%x\n", offset); | 131 | 132 | return KModErr::OK; | 132 | 133 | } | 133 | 134 |
| 134 | 135 | KModErr Test_get_file_f_inode_offset() { | | 136 | + REQUIRE_ROOT_OR_RETURN(); | 135 | 137 | uint32_t offset = 0; | 136 | 138 | RETURN_IF_ERROR(kernel_module::get_file_f_inode_offset(offset)); | 137 | 139 | printf("Output offset: 0x%x\n", offset); | 138 | 140 | return KModErr::OK; | 139 | 141 | } | 140 | 142 |
| 141 | 143 | KModErr Test_get_file_f_op_offset() { | | 144 | + REQUIRE_ROOT_OR_RETURN(); | 142 | 145 | uint32_t offset = 0; | 143 | 146 | RETURN_IF_ERROR(kernel_module::get_file_f_op_offset(offset)); | 144 | 147 | printf("Output offset: 0x%x\n", offset); | 145 | 148 | return KModErr::OK; | 146 | 149 | } | 147 | 150 |
| | 151 | +KModErr Test_get_file_f_cred_offset() { | | 152 | + REQUIRE_ROOT_OR_RETURN(); | | 153 | + uint32_t offset = 0; | | 154 | + RETURN_IF_ERROR(kernel_module::get_file_f_cred_offset(offset)); | | 155 | + printf("Output offset: 0x%x\n", offset); | | 156 | + return KModErr::OK; | | 157 | +} | | 158 | + | | 159 | +KModErr Test_get_file_private_data_offset() { | | 160 | + REQUIRE_ROOT_OR_RETURN(); | | 161 | + uint32_t offset = 0; | | 162 | + RETURN_IF_ERROR(kernel_module::get_file_private_data_offset(offset)); | | 163 | + printf("Output offset: 0x%x\n", offset); | | 164 | + return KModErr::OK; | | 165 | +} | | 166 | + | 148 | 167 | KModErr Test_get_vm_area_struct_vm_offset() { | 149 | 168 | REQUIRE_ROOT_OR_RETURN(); | 150 | 169 | uint32_t vm_start_offset = 0, vm_end_offset = 0; | |
Collapse file Copy file name to clipboard +33Lines changed: 33 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +#include "idle_killer.h" | | 2 | + | | 3 | +static int64_t now_ns() { | | 4 | + using namespace std::chrono; | | 5 | + return duration_cast<nanoseconds>(steady_clock::now().time_since_epoch()).count(); | | 6 | +} | | 7 | +static int64_t to_ns(std::chrono::seconds s) { | | 8 | + using namespace std::chrono; | | 9 | + return duration_cast<nanoseconds>(s).count(); | | 10 | +} | | 11 | + | | 12 | +void IdleKiller::start(std::chrono::seconds timeout, OnTimeout cb) { | | 13 | + m_timeout_ns = to_ns(timeout); | | 14 | + m_on_timeout = std::move(cb); | | 15 | + touch(); | | 16 | + bool expected = false; | | 17 | + if (!m_started.compare_exchange_strong(expected, true, std::memory_order_acq_rel)) return; | | 18 | + std::thread([this] { | | 19 | + for (;;) { | | 20 | + const auto last = m_last_activity_ns.load(std::memory_order_acquire); | | 21 | + const auto now = now_ns(); | | 22 | + | | 23 | + if (last != 0 && (now - last) > m_timeout_ns.load(std::memory_order_acquire)) { | | 24 | + // 先取出回调再执行,避免回调里 _exit 导致奇怪竞态 | | 25 | + auto cb = m_on_timeout; // copy | | 26 | + if (cb) cb(); | | 27 | + return; | | 28 | + } | | 29 | + std::this_thread::sleep_for(std::chrono::seconds(1)); | | 30 | + } | | 31 | + }).detach(); | | 32 | +} | | 33 | +void IdleKiller::touch() { m_last_activity_ns.store(now_ns(), std::memory_order_release); } |
Collapse file Copy file name to clipboard +18Lines changed: 18 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +#pragma once | | 2 | +#include <atomic> | | 3 | +#include <chrono> | | 4 | +#include <functional> | | 5 | +#include <thread> | | 6 | +#include <utility> | | 7 | + | | 8 | +class IdleKiller { | | 9 | +public: | | 10 | + using OnTimeout = std::function<void()>; | | 11 | + void start(std::chrono::seconds timeout, OnTimeout cb); | | 12 | + void touch(); | | 13 | +private: | | 14 | + std::atomic<bool> m_started{false}; | | 15 | + std::atomic<int64_t> m_last_activity_ns{0}; | | 16 | + std::atomic<int64_t> m_timeout_ns{0}; | | 17 | + OnTimeout m_on_timeout; | | 18 | +}; |
Collapse file Copy file name to clipboard +16Lines changed: 16 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +LOCAL_PATH := $(call my-dir) | | 2 | + | | 3 | +include $(CLEAR_VARS) | | 4 | +LOCAL_MODULE := module_hide_sh_exec | | 5 | + | | 6 | +LOCAL_SRC_FILES := ../module_hide_sh_exec.cpp ../su_interactive.cpp ../idle_killer.cpp | | 7 | + | | 8 | +KERNEL_MODULE_KIT := $(LOCAL_PATH)/../../kernel_module_kit | | 9 | +LOCAL_C_INCLUDES += $(KERNEL_MODULE_KIT)/include | | 10 | +LOCAL_LDFLAGS += $(KERNEL_MODULE_KIT)/lib/libkernel_module_kit_static.a | | 11 | + | | 12 | +include $(LOCAL_PATH)/build_macros.mk | | 13 | + | | 14 | +include $(BUILD_SHARED_LIBRARY) | | 15 | + | | 16 | + |
Collapse file Copy file name to clipboard +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +APP_ABI := arm64-v8a | | 2 | +APP_STL := c++_static |
|