From 074e03ca15fd56c0794a9785f5bdfd765d69d089 Mon Sep 17 00:00:00 2001 From: jiqiu2021 Date: Fri, 15 Nov 2024 15:27:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0riru=E6=B3=A8=E5=85=A5?= =?UTF-8?q?=E9=9A=90=E8=97=8F=EF=BC=8C=E6=89=8B=E4=B8=8A=E6=B2=A1=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=EF=BC=8C=E6=B2=A1=E6=B3=95=E6=B3=A8=E5=85=A5=EF=BC=8C?= =?UTF-8?q?=E6=9C=89=E9=97=AE=E9=A2=98=E5=86=8D=E4=BF=AE=E5=90=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/src/main/cpp/CMakeLists.txt | 2 + module/src/main/cpp/hack.cpp | 2 + module/src/main/cpp/pmparser.h | 99 ++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 module/src/main/cpp/pmparser.h diff --git a/module/src/main/cpp/CMakeLists.txt b/module/src/main/cpp/CMakeLists.txt index 4549504..659cb82 100644 --- a/module/src/main/cpp/CMakeLists.txt +++ b/module/src/main/cpp/CMakeLists.txt @@ -36,6 +36,8 @@ aux_source_directory(xdl xdl-src) add_library(${MODULE_NAME} SHARED main.cpp hack.cpp + newriruhide.cpp + pmparser.cpp ${xdl-src}) target_link_libraries(${MODULE_NAME} log) diff --git a/module/src/main/cpp/hack.cpp b/module/src/main/cpp/hack.cpp index 28ef6f0..e816a74 100644 --- a/module/src/main/cpp/hack.cpp +++ b/module/src/main/cpp/hack.cpp @@ -18,6 +18,7 @@ #include //#include #include +#include "newriruhide.h" void load_so(const char *game_data_dir, JavaVM *vm, const char *soname) { bool load = false; LOGI("hack_start %s", game_data_dir); @@ -76,6 +77,7 @@ void load_so(const char *game_data_dir, JavaVM *vm, const char *soname) { if (handle) { LOGI("Successfully loaded %s", new_so_path); load = true; + riru_hide({"libriru.so"}); break; } else { LOGE("Failed to load %s: %s", new_so_path, dlerror()); diff --git a/module/src/main/cpp/pmparser.h b/module/src/main/cpp/pmparser.h new file mode 100644 index 0000000..7874215 --- /dev/null +++ b/module/src/main/cpp/pmparser.h @@ -0,0 +1,99 @@ +/* + @Author : ouadimjamal@gmail.com + @date : December 2015 + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. No representations are made about the suitability of this +software for any purpose. It is provided "as is" without express or +implied warranty. + + */ + +#ifndef H_PMPARSER +#define H_PMPARSER +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//maximum line length in a procmaps file +#define PROCMAPS_LINE_MAX_LENGTH (PATH_MAX + 100) +/** + * procmaps_struct + * @desc hold all the information about an area in the process's VM + */ +typedef struct procmaps_struct{ + void* addr_start; //< start address of the area + void* addr_end; //< end address + unsigned long length; //< size of the range + + char perm[5]; //< permissions rwxp + short is_r; //< rewrote of perm with short flags + short is_w; + short is_x; + short is_p; + + long offset; //< offset + char dev[12]; //< dev major:minor + int inode; //< inode of the file that backs the area + + char pathname[600]; //< the path of the file that backs the area + //chained list + struct procmaps_struct* next; //