Modification program's memory using ptrace unix built-in tool in C.
This version is an alternative to the version done by using python.
For more information about this program go to the reference link:
https://github.com/leo385/Procwrite-on-arm64
In this version, I have used some C unix built-in libraries:
- -> stdio.h, to use popen() due to read output from pip stream:
- -> popen() helped me with getting process's PID and get base address of memory where main is being executed.
- -> stdint.h for using 32-bit integer type for memory addresses on ARM64.
- -> stdlib.h for converting string to unsigned long long.
- -> errno.h for handling input errors.
- -> sys/ptrace.h to use ptrace function due to observing the other process's memory.
- -> sys/wait.h to use waitpid to wait for attaching correct PID, before we use PTRACE_PEEKTEXT.
- -> sched.h to use pid_t type needed for ptrace methods.
- -> string.h to use memcpy.
- -> inttypes.h to save hexadecimal address in buffer array.