Assembly->c언어 변환
글쓴이: qoqkwl6593 / 작성시간: 화, 2015/08/11 - 12:18오후
(gdb) disass main Dump of assembler code for function main: 0x0804852d <+0>: push ebp 0x0804852e <+1>: mov ebp,esp 0x08048530 <+3>: and esp,0xfffffff0 0x08048533 <+6>: sub esp,0x420 0x08048539 <+12>: mov eax,DWORD PTR [ebp+0xc] 0x0804853c <+15>: mov DWORD PTR [esp+0xc],eax 0x08048540 <+19>: mov eax,gs:0x14 0x08048546 <+25>: mov DWORD PTR [esp+0x41c],eax 0x0804854d <+32>: xor eax,eax 0x0804854f <+34>: cmp DWORD PTR [ebp+0x8],0x1 0x08048553 <+38>: jg 0x8048592 <main+101> 0x08048555 <+40>: mov eax,DWORD PTR [ebp+0x8] 0x08048558 <+43>: mov DWORD PTR [esp+0x4],eax 0x0804855c <+47>: mov DWORD PTR [esp],0x8048680 // "argc is %d\n" 0x08048563 <+54>: call 0x80483b0 <printf@plt> 0x08048568 <+59>: mov eax,DWORD PTR [esp+0xc] 0x0804856c <+63>: mov eax,DWORD PTR [eax] 0x0804856e <+65>: mov DWORD PTR [esp],eax 0x08048571 <+68>: call 0x8048400 <strlen@plt> 0x08048576 <+73>: mov edx,DWORD PTR [esp+0xc] 0x0804857a <+77>: mov edx,DWORD PTR [edx] 0x0804857c <+79>: mov DWORD PTR [esp+0x8],eax ---Type <return> to continue, or q <return> to quit--- 0x08048580 <+83>: mov DWORD PTR [esp+0x4],edx 0x08048584 <+87>: lea eax,[esp+0x1c] 0x08048588 <+91>: mov DWORD PTR [esp],eax 0x0804858b <+94>: call 0x80483c0 <memcpy@plt> 0x08048590 <+99>: jmp 0x80485ae <main+129> 0x08048592 <+101>: mov DWORD PTR [esp+0x8],0x400 0x0804859a <+109>: mov DWORD PTR [esp+0x4],0x0 0x080485a2 <+117>: lea eax,[esp+0x1c] 0x080485a6 <+121>: mov DWORD PTR [esp],eax 0x080485a9 <+124>: call 0x8048420 <memset@plt> 0x080485ae <+129>: lea eax,[esp+0x1c] 0x080485b2 <+133>: mov DWORD PTR [esp],eax 0x080485b5 <+136>: call 0x80483e0 <puts@plt> 0x080485ba <+141>: mov DWORD PTR [esp],0x804868c // " buffer over flow\n" 0x080485c1 <+148>: call 0x80483e0 <puts@plt> 0x080485c6 <+153>: mov eax,0x0 0x080485cb <+158>: mov ecx,DWORD PTR [esp+0x41c] 0x080485d2 <+165>: xor ecx,DWORD PTR gs:0x14 0x080485d9 <+172>: je 0x80485e0 <main+179> 0x080485db <+174>: call 0x80483d0 <__stack_chk_fail@plt> 0x080485e0 <+179>: leave 0x080485e1 <+180>: ret End of assembler dump.
int main() { char buf[0x400]; 0x20byte; if(argc > 1) main+34,38 { printf("argc is %d\n", argc); main+47 memcpy(,,strlen()); goto abcd: main+99 } memset(buffer, 0, 400); main+101 puts(); abcd: puts("buffer over flow"); }
어셈 코드를 c언어로 변환시킨건데 if문과 확신이 안드는것들 이몇개 있습니다.
조금 바꿔주시면 감사하겠습니다...
Forums:
자문자답인거 같은데 ㅎㅎ....
if문이 틀렸네여 ㅎㅎ...
if(argc < 2) main+34,38
{
printf("argc is %d\n", argc); main+47
memcpy(,,strlen());
goto abcd: main+99
}
else쓰는거까지 하면은 ㅎㅎ.......
대충 맞는거같네여
댓글 달기