Added maps parser and fixed child zygote namespaces

This commit is contained in:
snake-4
2024-04-09 22:35:40 +02:00
parent 08547864cd
commit 6f4d78b0fc
8 changed files with 180 additions and 46 deletions

29
module/jni/utils.cpp Normal file
View File

@@ -0,0 +1,29 @@
#include <string>
#include "map_parser.hpp"
#include "utils.hpp"
#include "android_filesystem_config.h"
#include "zygisk.hpp"
bool hook_plt_by_name(zygisk::Api *api, const std::string &libName, const std::string &symbolName, void *hookFunc, void **origFunc)
{
for (const auto &map : parseMapsFromPath("/proc/self/maps"))
{
if (map.getPathname().ends_with("/" + libName))
{
api->pltHookRegister(map.getDevice(), map.getInode(), symbolName.c_str(), hookFunc, origFunc);
return true;
}
}
return false;
}
int is_userapp_uid(int uid)
{
int appid = uid % AID_USER_OFFSET;
if (appid >= AID_APP_START && appid <= AID_APP_END)
return true;
if (appid >= AID_ISOLATED_START && appid <= AID_ISOLATED_END)
return true;
return false;
}