LOGE("开始读取maps");
int fd = syscall(__NR_openat, AT_FDCWD, "/proc/self/maps", O_RDONLY);
if (fd == -1) {
LOGE("Failed to open maps file");
}
char buf[BUF_SIZE];
char byte;
int bytesRead;
int i = 0;
while ((bytesRead = syscall(__NR_read, fd, &byte, 1)) > 0) {
buf[i++] = byte;
if (byte == '\n') {
buf[i] = '\0';
LOGE("%s", buf);
i = 0;
}
}
if (bytesRead == -1) {
LOGE("Error while reading file");
close(fd);
}
close(fd);
LOGE("开始读取maps");
int fd = syscall(__NR_openat, AT_FDCWD, "/proc/self/maps", O_RDONLY);
if (fd == -1) {
LOGE("Failed to open maps file");
}
char buf[BUF_SIZE];
char byte;
int bytesRead;
int i = 0;
while ((bytesRead = syscall(__NR_read, fd, &byte, 1)) > 0) {
buf[i++] = byte;
if (byte == '\n') {
buf[i] = '\0';
LOGE("%s", buf);
i = 0;
}
}
if (bytesRead == -1) {
LOGE("Error while reading file");
close(fd);
}
close(fd);
#define BUF_SIZE 1024
static int count = 0;
int checkFd(int fd) {
if (count == 0) {
char buf[BUF_SIZE] = {0};
char byte;
int i = 0;
while (syscall(__NR_read, fd, &byte, 1) > 0) {
buf[i++] = byte;
if (byte == '\n') {
buf[i] = '\0';
if (strstr(buf, "libart.so")) {
return fd;
} else {
off_t current_pos = lseek(fd, 0, SEEK_CUR);
syscall(__NR_lseek, fd, current_pos - i, SEEK_SET);
count = i;
return fd;
}
}
}
}
count--;
return fd;
}
#define BUF_SIZE 1024
static int count = 0;
int checkFd(int fd) {
if (count == 0) {
char buf[BUF_SIZE] = {0};
char byte;
int i = 0;
while (syscall(__NR_read, fd, &byte, 1) > 0) {
buf[i++] = byte;
if (byte == '\n') {
[培训]Windows内核深度攻防:从Hook技术到Rootkit实战!
最后于 2024-2-20 10:28
被肉蚌葱鸡编辑
,原因: 内容编辑