Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <sys/ptrace.h>
- int
- main(int argc, char *argv[]) {
- pid_t pid;
- pid = (int)strtol(argv[1], 0, 10);
- printf("Attaching to PID %d\n", pid);
- if (ptrace(PT_ATTACH, pid, 0,0) < 0) {
- perror("ptrace");
- exit(EXIT_FAILURE);
- }
- printf("Detaching from PID %d\n", pid);
- if (ptrace(PT_DETACH, pid, 0,0) < 0) {
- perror("ptrace");
- exit(EXIT_FAILURE);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment