feat: mvp

This commit is contained in:
root
2024-10-31 18:11:10 +03:00
parent 88e75e848a
commit d7f2db8780
2 changed files with 15 additions and 13 deletions

View File

@ -14,9 +14,7 @@ struct user_regs_struct regs;
void continue_execution(pid_t pid)
{
ptrace(PTRACE_CONT, pid, DONT_CARE, DONT_CARE);
int wait_status;
int options = 0;
waitpid(pid, &wait_status, options);
waitpid(pid, &stats, 0);
return;
}
@ -30,6 +28,7 @@ void print_rax(pid_t pid)
void step(pid_t pid)
{
ptrace(PTRACE_SINGLESTEP, pid, DONT_CARE, DONT_CARE);
waitpid(pid, &stats, 0);
return;
}
@ -49,16 +48,18 @@ int main()
{
char buff;
printf(" -- parrent\n");
continue_execution(pid); // to start app
continue_execution(pid);
do {
waitpid(pid, &stats, 0);
printf("stats - %d", stats);
print_rax(pid);
ptrace(PTRACE_SINGLESTEP, pid, DONT_CARE, DONT_CARE);
printf("enter any: ");
read(0, &buff, 1);
printf("\n");
} while(stats);
if (stats & SIGTRAP)
{
while (stats != 0)
{
read(0, &buff, 1);
print_rax(pid);
step(pid);
}
}
printf("____AFTER_TRACE_PARRENT____\n");
}
return 0;

View File

@ -8,7 +8,7 @@ section .text
_start:
xor rax, rax,
add rax, 1
int3
;int3
add rax, 12
;int3
mov rax, 33
@ -19,6 +19,7 @@ _start:
mov rsi, msg
mov rdx, msg_len
syscall
int3
mov rax, 60
mov rdi, 0