Reputation: 1
Currently I am trying to learn how to create shell code. Right now I have the current code with runs "ls" in Bash in Linux
global _start
section .text
_start:
mov al, 59
xor rdx, rdx
push rdx
mov rdi, '/bin//ls'
push rdi
mov rdi, rsp
push rdx
push rdi
mov rsi, rsp
syscall
Now I need to modify it to run "ls -la" (essentially adding another argument).
Edit: I've tried to to add "-la" to the data that will be moved in rdi (so "mov rdi, 'bin//ls -la'") Which does not work and results in a segmentation fault.
(Note I am using execve(char *command, char *argv[], char *envp[]) here, not any functions from libc)
From what I know, I need to pass my second argument to rsi, so I tried adding:
mov rsi, '-la'
push rsi
xor rsi, rsi
push rsi
Although again it would end up in a segmentation fault. After that, I'm kind of stuck
Upvotes: -4
Views: 75