prob2.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | Dump of assembler code for function main: 0x8048470 <main>: push %ebp //새로운 스택프레임 형성 0x8048471 <main+1>: mov %ebp,%esp 0x8048473 <main+3>: sub %esp,16 //16바이트 공간 할당 0x8048476 <main+6>: lea %eax,[%ebp-16] 0x8048479 <main+9>: push %eax //변수의 첫번째 주소 push 0x804847a <main+10>: push 0x8048560 // '%s' push 0x804847f <main+15>: call 0x8048358 <scanf> //파라미터 2개 0x8048484 <main+20>: add %esp,8 //인자 2개 주소(4byte*2)만큼 추가 0x8048487 <main+23>: lea %eax,[%ebp-16] 0x804848a <main+26>: push %eax 0x804848b <main+27>: call 0x8048378 <strlen> 0x8048490 <main+32>: add %esp,4 0x8048493 <main+35>: mov %eax,%eax 0x8048495 <main+37>: cmp %eax,4 0x8048498 <main+40>: jbe 0x80484b0 <main+64> 0x804849a <main+42>: lea %eax,[%ebp-16] 0x804849d <main+45>: push %eax 0x804849e <main+46>: call 0x8048378 <strlen> 0x80484a3 <main+51>: add %esp,4 //strlen(str)>4 0x80484a6 <main+54>: mov %eax,%eax 0x80484a8 <main+56>: cmp %eax,15 0x80484ab <main+59>: ja 0x80484b0 <main+64> 0x80484ad <main+61>: jmp 0x80484b4 <main+68> 0x80484af <main+63>: nop 0x80484b0 <main+64>: xor %eax,%eax // 0x80484b2 <main+66>: jmp 0x804850d <main+157> 0x80484b4 <main+68>: push 6 //6 0x80484b6 <main+70>: push 0x8048563 //"impossXXXX" 0x80484bb <main+75>: lea %eax,[%ebp-16] 0x80484be <main+78>: push %eax //16byte 0x80484bf <main+79>: call 0x8048388 <strncmp> //strncmp(str) 0x80484c4 <main+84>: add %esp,12 0x80484c7 <main+87>: mov %eax,%eax 0x80484c9 <main+89>: test %eax,%eax //같으면 0 0x80484cb <main+91>: je 0x80484d1 <main+97> // 0x80484cd <main+93>: xor %eax,%eax //초기화 0x80484cf <main+95>: jmp 0x804850d <main+157> 0x80484d1 <main+97>: cmp BYTE PTR [%ebp-7],0x45 //9번째 자리랑 69(e) 0x80484d5 <main+101>: je 0x80484e0 <main+112> 0x80484d7 <main+103>: xor %eax,%eax //초기화 0x80484d9 <main+105>: jmp 0x804850d <main+157> 0x80484db <main+107>: nop //필요 x 0x80484dc <main+108>: lea %esi,[%esi*1] // 필요x 0x80484e0 <main+112>: cmp BYTE PTR [%ebp-10],0x21 //6index 33(!) 0x80484e4 <main+116>: jne 0x80484f8 <main+136> //리턴 0x80484e6 <main+118>: cmp BYTE PTR [%ebp-9],0x42 //7index B 0x80484ea <main+122>: jne 0x80484f2 <main+130> //리턴 0x80484ec <main+124>: mov BYTE PTR [%ebp-8],0x31 //8index 1 0x80484f0 <main+128>: jmp 0x80484f6 <main+134> //성공 0x80484f2 <main+130>: xor %eax,%eax 0x80484f4 <main+132>: jmp 0x804850d <main+157> 0x80484f6 <main+134>: jmp 0x8048500 <main+144> 0x80484f8 <main+136>: xor %eax,%eax //초기화 0x80484fa <main+138>: jmp 0x804850d <main+157> 0x80484fc <main+140>: lea %esi,[%esi*1] 0x8048500 <main+144>: push 0x804856e //success 0x8048505 <main+149>: call 0x80483a8 <printf> 0x804850a <main+154>: add %esp,4 0x804850d <main+157>: leave 0x804850e <main+158>: ret 0x804850f <main+159>: nop End of assembler dump. (gdb) x/s 0x8048560 0x8048560 <_IO_stdin_used+4>: "%s" (gdb) x/s 0x8048563 0x8048563 <_IO_stdin_used+7>: "impossXXXX" (gdb) x/s 0x804856e 0x804856e <_IO_stdin_used+18>: "Success\n" | cs |
핸드레이
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include<stdio.h> #include<string.h> void main(){ char str[16]; scanf("%s",str); if(strlen(str)<=4&&strlen(str)>15){ return 0; } if(strncmp(str,"impossXXXX",6)==0){ if(str[9]=='E'){ if(str[6]=='!'){ if(str[7]=='B'){ str[8]='1'; } } } }else{ return 0; } } | cs |
'Study > reversing' 카테고리의 다른 글
PE란? (0) | 2017.10.11 |
---|---|
prob3.c 핸드레이 (0) | 2017.09.21 |
prob1.c 핸드레이 (0) | 2017.09.19 |
abex Crackme 1번 Line By Line (0) | 2017.09.19 |
인터럽트에 대해 알아보자 (0) | 2017.08.24 |