GeezerVison is showing github.com — feat: 调整目录结构,兼容Pro版(模块版) · VVeakee/SKRoot-linuxKernelRoot@3550413
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: PermissionManager/app/src/main/cpp/CMakeLists.txt +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,6 +50,12 @@ find_library( # Sets the name of the path variable. | 50 | 50 | # can link multiple libraries, such as libraries you define in this | 51 | 51 | # build script, prebuilt third-party libraries, or system libraries. | 52 | 52 |
| | 53 | +target_include_directories( | | 54 | + permissionmanager | | 55 | + PRIVATE | | 56 | + ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../testRoot/jni/ | | 57 | +) | | 58 | + | 53 | 59 | target_link_libraries( # Specifies the target library. | 54 | 60 | permissionmanager | 55 | 61 |
| |
Collapse file Copy file name to clipboard Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/analyze/base_func.h +17-16Lines changed: 17 additions & 16 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 | #include <fstream> | 5 | 5 | #include <sstream> | 6 | 6 | #include <algorithm> | | 7 | +#include <random> | | 8 | +#include <chrono> | 7 | 9 | #include <vector> | 8 | 10 | #include <math.h> | 9 | | -#define ROOT_KEY_LEN 48 | 10 | | - | 11 | | -static const char HEX[16] = { | 12 | | -'0', '1', '2', '3', | 13 | | -'4', '5', '6', '7', | 14 | | -'8', '9', 'a', 'b', | 15 | | -'c', 'd', 'e', 'f' | 16 | | -}; | 17 | 11 |
| 18 | 12 | static std::vector<char> read_file_buf(const std::string& file_path) { | 19 | 13 | std::ifstream file(file_path, std::ios::binary | std::ios::ate); | @@ -28,15 +22,22 @@ static std::vector<char> read_file_buf(const std::string& file_path) { | 28 | 22 | return {}; | 29 | 23 | } | 30 | 24 |
| 31 | | -static void get_rand_str(char* dest, int n) { | 32 | | - int i, randno; | 33 | | - char stardstring[63] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | 34 | | - srand((unsigned)time(NULL)); | 35 | | - for (i = 0; i < n; i++) { | 36 | | - randno = rand() % 62; | 37 | | - *dest = stardstring[randno]; | 38 | | - dest++; | | 25 | +static std::string generate_random_str(std::size_t len) { | | 26 | + static constexpr char alphabet[] = | | 27 | + "abcdefghijklmnopqrstuvwxyz" | | 28 | + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | | 29 | + "0123456789"; | | 30 | + static constexpr std::size_t alphabet_size = sizeof(alphabet) - 1; | | 31 | + static std::mt19937_64 rng{ | | 32 | + static_cast<unsigned long>(std::chrono::steady_clock::now().time_since_epoch().count()) | | 33 | + }; | | 34 | + std::uniform_int_distribution<std::size_t> dist(0, alphabet_size - 1); | | 35 | + std::string key; | | 36 | + key.reserve(len); | | 37 | + for (std::size_t i = 0; i < len; ++i) { | | 38 | + key += alphabet[dist(rng)]; | 39 | 39 | } | | 40 | + return key; | 40 | 41 | } | 41 | 42 |
| 42 | 43 | static std::string generate_random_root_key(int root_key_len) { | |
Collapse file Copy file name to clipboardExpand all lines: patch_kernel_root/patch_kernel_root.cpp +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -221,7 +221,7 @@ int main(int argc, char* argv[]) { | 221 | 221 | std::cout << std::endl << "请选择是否需要自动随机生成ROOT密匙(1需要;2不需要):" << std::endl; | 222 | 222 | std::cin >> std::dec >> is_need_create_root_key; | 223 | 223 | if (is_need_create_root_key == 1) { | 224 | | - str_root_key = generate_random_root_key(ROOT_KEY_LEN); | | 224 | + str_root_key = generate_random_str(ROOT_KEY_LEN); | 225 | 225 | } else { | 226 | 226 | std::cout << "请输入ROOT密匙(48个字符的字符串,包含大小写和数字):" << std::endl; | 227 | 227 | std::cin >> str_root_key; | |
|