You've already forked ReZygisk
mirror of
https://github.com/PerformanC/ReZygisk.git
synced 2025-09-06 06:37:01 +00:00
Zygisk injector (#1)
* fix x86 * add lsplt * transplant from zygisk * api v4 Signed-off-by: 5ec1cff <ewtqyqyewtqyqy@gmail.com> * Remove redundant logs Signed-off-by: 5ec1cff <ewtqyqyewtqyqy@gmail.com> --------- Signed-off-by: 5ec1cff <ewtqyqyewtqyqy@gmail.com>
This commit is contained in:
@@ -27,7 +27,7 @@ namespace zygiskd {
|
||||
}
|
||||
|
||||
bool PingHeartbeat() {
|
||||
LOGD("Daemon socket: %s", kZygiskSocket);
|
||||
LOGD("Daemon socket: %s", kZygiskSocket.data());
|
||||
auto fd = Connect(5);
|
||||
if (fd == -1) {
|
||||
PLOGE("Connect to zygiskd");
|
||||
@@ -58,14 +58,44 @@ namespace zygiskd {
|
||||
size_t len = socket_utils::read_usize(fd);
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
std::string name = socket_utils::read_string(fd);
|
||||
UniqueFd module_fd = socket_utils::recv_fd(fd);
|
||||
int module_fd = socket_utils::recv_fd(fd);
|
||||
auto handle = DlopenMem(module_fd, RTLD_NOW);
|
||||
if (handle == nullptr) {
|
||||
LOGW("Failed to dlopen module %s: %s", name.data(), dlerror());
|
||||
continue;
|
||||
}
|
||||
modules.emplace_back(name, handle);
|
||||
modules.emplace_back(i, name, handle);
|
||||
}
|
||||
return modules;
|
||||
}
|
||||
|
||||
UniqueFd ConnectCompanion(size_t index) {
|
||||
auto fd = Connect(1);
|
||||
if (fd == -1) {
|
||||
PLOGE("ConnectCompanion");
|
||||
return -1;
|
||||
}
|
||||
socket_utils::write_u8(fd, (uint8_t) SocketAction::RequestCompanionSocket);
|
||||
socket_utils::write_usize(fd, index);
|
||||
if (socket_utils::read_u8(fd) == 1) {
|
||||
return fd;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
UniqueFd GetModuleDir(size_t index) {
|
||||
auto fd = Connect(1);
|
||||
if (fd == -1) {
|
||||
PLOGE("GetModuleDir");
|
||||
return -1;
|
||||
}
|
||||
socket_utils::write_u8(fd, (uint8_t) SocketAction::GetModuleDir);
|
||||
socket_utils::write_usize(fd, index);
|
||||
if (socket_utils::read_u8(fd) == 1) {
|
||||
return fd;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user