2018. 7. 13. 15:34ㆍ0x02 Reverse Engineer
#include <stdio.h>
#define INIT (1)
char format[] ="result = %d x %d = %d\n";
char end_print[] = "good bye\n";
int j = 1;
int i = 2;
int result = 0;
int main()
{
__asm
{
jmp _init
_init:
xor eax,eax
xor ecx,ecx
xor edx,edx
xor edi,edi
jmp row_init
row_init:
mov ecx, i // x
jmp row_comp
row_comp:
cmp ecx, 0x9 // 9단인지 비교
jle column_set // 2~9단이면
jmp end
column_set:
mov edi, j // y
jmp column_comp
column_comp:
cmp edi, 0x9
jle calc
// 여기서 ecx는 고정인지 보자 printf에서 ECX값이 바뀌어버려서 백업한거 이용
add ecx, 0x1
jmp row_comp
calc:
mov eax, INIT
push ecx // 백업 (x)
push edi // 백업 (y)
mul ecx
mul edi
jmp _call_printf
_call_printf:
// pop ecx (x)
// pop edi (y)
push eax
push edi
push ecx
mov edx, offset format
push edx
call printf
add esp, 0x10
pop edi // y
add edi, 0x1
pop ecx // x
jmp column_comp
end:
mov edx, offset end_print
push edx
call printf
add esp, 0x4
mov esp, ebp
pop ebp
retn
}
}
'0x02 Reverse Engineer' 카테고리의 다른 글
HTB DebugMe (0) | 2020.07.10 |
---|---|
ANTIDEBUG Problems (0) | 2019.02.18 |
HACKINGCAMP 19 Can You Login ? (0) | 2019.02.18 |
어셈 64비트 구구단 (0) | 2018.07.13 |
행 역순 정렬 문제 (0) | 2018.07.07 |