본문으로 바로가기

ASM to C with IDA - 035

category Reversing/ASM to C 2018. 7. 5. 09:29

C300_035



C300_소스코드



1
2
3
4
5
6
7
8
9
10
#include <stdio.h> 
 
main()
{
    int i = 0;
    int j = 1;
 
    printf("값=%d, 메모리주소=%p \n", i, &i);                
    printf("값=%d, 메모리주소=%p \n", j, &j);    
}
cs



IDA - Layout Graph





IDA - Text View





mov 는 값을 전달하고, lea주소를 전달한다.



pseudo code - 의사코드



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h> 
 
main()
{
    int i;
    int j;
 
    i=0;
    j=1;
 
    eax = &i;
    ecx = i;
    printf(_Format, ecx, eax);
 
    edx = &j
    eax = j
    printf(byte_403020, eax, edx);            
    
    eax = 0;
}    
 
cs



pseudo code - 최종의사코드



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h> 
 
main()
{
    int i;
    int j;
 
    i=0;
    j=1;
 
    printf(_Format, i, &i);
 
    printf(byte_403020, j, &j);                
    
    return 0;
}    
 
cs


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

ASM to C with IDA - 037  (0) 2018.07.05
ASM to C with IDA - 036  (0) 2018.07.05
ASM to C with IDA - 034  (0) 2018.07.04
ASM to C with IDA - 033  (0) 2018.07.04
ASM to C with IDA- 032  (0) 2018.07.04