I have been trying to manipulate a string in my .s file i want that the variable "pa" that contains "/bin/bash" be transformed into "/bin/sh" and then i want to make a call to the system that executes "/bin/sh" I have written a print mechanism to make sure that "pa" has "/bin/bash"
I have tried to do this
mov eax,pa
mov [eax+5],[eax+7]; /bin/bash becomes /bin/sash\0
mov [eax+6],[eax+8]; /bin/sash becomes /bin/shsh\0
mov [eax+7],[eax+9]; /bin/shsh becomes /bin/sh\0
but i guess thats not the way it works I am new to NASM
Please help me out
the entire code snippet is below
`section .data
%defstr path %!SHELL
pa db path,10
palen equ $-pa
section .text
global _start
_start:
mov eax,pa
mov [eax+5],[eax+7] ; /bin/bash becomes /bin/sash\0
mov [eax+6],[eax+8] ; /bin/sash becomes /bin/shsh\0
mov [eax+7],[eax+9] ; /bin/shsh becomes /bin/sh\0
mov eax,4 ; The system call for write (sys_write)
mov ebx,1 ; File descriptor 1 - standard output
mov ecx,pa
mov edx,palen
int 80h
mov eax,1 ; The system call for exit (sys_exit)
mov ebx,0 ; Exit with return code of 0 (no error)
int 80h
'