diff options
| author | Orfeas <38209077+0xfea5@users.noreply.github.com> | 2024-04-16 03:33:40 +0300 |
|---|---|---|
| committer | Orfeas <38209077+0xfea5@users.noreply.github.com> | 2024-04-16 04:09:21 +0300 |
| commit | 7de6d2226b9746e2a2d90a00aa130282cb23605d (patch) | |
| tree | d98fd7dbdc816ced520e92a3be202d0ce0b32bbd /src/main.c | |
| parent | Parse /proc/pid/maps (diff) | |
| download | linux-game-trainer-7de6d2226b9746e2a2d90a00aa130282cb23605d.tar.gz linux-game-trainer-7de6d2226b9746e2a2d90a00aa130282cb23605d.zip | |
Memory scanning to find byte patterns
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 18 |
1 files changed, 16 insertions, 2 deletions
| @@ -23,9 +23,23 @@ int main(int argc, char *argv[]) | |||
| 23 | waitpid(pid, NULL, __WALL); | 23 | waitpid(pid, NULL, __WALL); |
| 24 | LOG("Attached to process %d\n", pid); | 24 | LOG("Attached to process %d\n", pid); |
| 25 | 25 | ||
| 26 | /* Do stuff ... */ | 26 | char *byte_seq = "secret text"; |
| 27 | parse_vmmap(pid); | 27 | size_t byte_seq_len = strlen(byte_seq); |
| 28 | MemscanResult *head = memscan(pid, (uint8_t*)byte_seq, byte_seq_len); | ||
| 29 | MemscanResult *cur = head; | ||
| 28 | 30 | ||
| 31 | printf("\n\n\nMemory scan results:\n"); | ||
| 32 | printf("%-16s|%-16s|%-10s|%-s\n", "Address", "Base", "Offset", "Name"); | ||
| 33 | puts("--------------------------------------------------"); | ||
| 34 | while (cur) { | ||
| 35 | printf("%-16p|%-16p|%#-10lx|%-s\n", | ||
| 36 | cur->mapping->begin + cur->offset, | ||
| 37 | cur->mapping->begin, | ||
| 38 | cur->offset, | ||
| 39 | cur->mapping->name); | ||
| 40 | cur = cur->next; | ||
| 41 | } | ||
| 42 | printf("\n\n"); | ||
| 29 | ptrace(PTRACE_DETACH, pid, NULL, NULL); | 43 | ptrace(PTRACE_DETACH, pid, NULL, NULL); |
| 30 | LOG("Detached from process %d\n", pid); | 44 | LOG("Detached from process %d\n", pid); |
| 31 | 45 | ||
