mingW
cl (visual studio)
#include <stdio.h>get_sp(int *eip){asm ("mov %esp, %eax\n""mov 4(%ebp), %ebx\n" // ebx isi eip"lea 8(%ebp), %ecx\n""mov (%ecx), %ecx\n""mov %ebx, (%ecx)\n");}void main(){int x = 5;asm( "int3");printf ("StackPointer (ESP): 0x%x\n", get_sp(&x));printf ("EIP: 0x%x\n", x);}
cl (visual studio)
#include <stdio.h>get_sp(int *eip){__asm{mov eax, espmov ebx, [ebp+4]lea ecx,[ebp+8]mov ecx, [ecx]mov [ecx], ebx}}void main(){int x = 5;__asm {int 3};printf ("StackPointer (ESP): 0x%x\n", get_sp(&x));printf ("EIP: 0x%x\n", x);}
No comments:
Post a Comment
Terima kasih