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

View File

@@ -0,0 +1,27 @@
#include <sstream>
#include <string>
#include <vector>
#include <sys/types.h>
class map_entry_t
{
public:
map_entry_t(uintptr_t address_start, uintptr_t address_end, uintptr_t offset,
const std::string &perms, const std::string &pathname, dev_t device, ino_t inode);
uintptr_t getAddressStart() const;
uintptr_t getAddressEnd() const;
const std::string &getPerms() const;
uintptr_t getOffset() const;
dev_t getDevice() const;
ino_t getInode() const;
const std::string &getPathname() const;
private:
uintptr_t address_start, address_end, offset;
std::string perms, pathname;
dev_t device;
ino_t inode;
};
std::vector<map_entry_t> parseMapsFromPath(const char *path);

View File

@@ -12,10 +12,10 @@ public:
const std::string &filesystem_type, const std::string &mount_source,
const std::string &super_options);
const int &getMountId() const;
const int &getParentId() const;
const int &getMajor() const;
const int &getMinor() const;
int getMountId() const;
int getParentId() const;
int getMajor() const;
int getMinor() const;
const std::string &getRoot() const;
const std::string &getMountPoint() const;
const std::unordered_map<std::string, std::string> &getMountOptions() const;

View File

@@ -0,0 +1,10 @@
#pragma once
#include <string>
#include "zygisk.hpp"
#define DCL_HOOK_FUNC(ret, func, ...) \
ret (*old_##func)(__VA_ARGS__); \
ret new_##func(__VA_ARGS__)
int is_userapp_uid(int uid);
bool hook_plt_by_name(zygisk::Api *api, const std::string &libName, const std::string &symbolName, void *hookFunc, void **origFunc);