본문으로 바로가기

ASM to C with IDA - 044

category Reversing/ASM to C 2018. 7. 9. 11:04

C300_044



C300_소스코드



1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
#include <conio.h>
 
void main(void)
{
    int ch;
 
    printf("아무키나 누르세요...\n");
 
    ch = getch();
 
    printf("%c 키가 눌려졌습니다. ", ch);
}
 
cs



IDA - Layout Graph




IDA - Text View




자주 보이는 코드는 초반부에 보이는 push ecx이다.

왜 push ecx를 하지..?


pseudo code - 의사코드



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
 
void main(void)
{
    int var_4;
    
    printf(_Format);
 
    var_4 = getch();
    eax = var_4;
 
    printf(aC, eax);                
 
    eax = 0;
}    
 
cs



pseudo code - 최종 의사코드



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>
 
void main(void)
{
    int var_4;
    
    printf(_Format);
 
    var_4 = getch();
 
    printf(aC, var_4);                
 
    return 0;
}    
 
cs









'Reversing > ASM to C' 카테고리의 다른 글

ASM to C with IDA - 046  (0) 2018.07.09
ASM to C with IDA - 045  (0) 2018.07.09
ASM to C with IDA - 043  (0) 2018.07.08
ASM to C with IDA - 042  (0) 2018.07.08
ASM to C with IDA - 041  (0) 2018.07.08