Skip to content

Commit

Permalink
Hide for zygisk denied processes
Browse files Browse the repository at this point in the history
  • Loading branch information
HuskyDG committed Nov 30, 2023
1 parent 8a5036c commit 57ad898
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions magisk-module/module.prop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=zygisk-maphide
name=Zygisk Maphide
author=HuskyDG
version=1.0
versionCode=1
description=Hide memory path from maps
version=2.0
versionCode=2
description=Wipe out the traces of mounted files of Magisk module
14 changes: 7 additions & 7 deletions native/jni/zygisk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
#define LOGF(...) __android_log_print(ANDROID_LOG_FATAL, LOG_TAG, __VA_ARGS__)


#define CONFIG_PATH "/data/adb/maphide"
#define PKG_LIST CONFIG_PATH "/packages.list"
#define MAP_LIST CONFIG_PATH "/mapname.list"

static void hide_from_maps(std::vector<lsplt::MapInfo> maps) {
for (auto &info : maps) {
LOGI("hide: %s\n", info.path.data());
Expand Down Expand Up @@ -54,7 +49,8 @@ class MapHide : public zygisk::ModuleBase {
}

void preAppSpecialize(AppSpecializeArgs *args) override {
if (args->uid > 1000) {
uint32_t flags = api->getFlags();
if ((flags & zygisk::PROCESS_ON_DENYLIST) && args->uid > 1000) {
DoHide();
}
api->setOption(zygisk::Option::DLCLOSE_MODULE_LIBRARY);
Expand All @@ -76,7 +72,11 @@ class MapHide : public zygisk::ModuleBase {
// detection: https://github.com/vvb2060/MagiskDetector/blob/master/README_ZH.md
// hide all maps with path is data partition but path is not /data/*
for (auto iter = maps.begin(); iter != maps.end();) {
if (iter->dev != st.st_dev || (iter->path).starts_with("/data/")) {
if (iter->dev != st.st_dev ||
(!(iter->path).starts_with("/system/") &&
!(iter->path).starts_with("/vendor/") &&
!(iter->path).starts_with("/product/") &&
!(iter->path).starts_with("/system_ext/"))) {
iter = maps.erase(iter);
} else {
++iter;
Expand Down

0 comments on commit 57ad898

Please sign in to comment.