E D R , A S I H C RSS

Cracking Program

7/26일 두번째로 발표한 주제입니다
발표자료 : Upload:CrackingProgram.ppt

간단한 프로그램

~cpp 
#include <iostream> 
using namespace std; 

int add(int a, int b);

int main()
{
	int a, b, c;
	a = 1;
	b = 2;
	c = add(a, b);

	return 0;
}

int add(int a, int b)
{
	int c;
	c = a + b;
	return c;
}

~cpp 
1:    #include <iostream>
2:    using namespace std;
3:
4:    int add(int a, int b);
5:
6:    int main()
7:    {
00401030   push        ebp
00401031   mov         ebp,esp
00401033   sub         esp,4Ch
00401036   push        ebx
00401037   push        esi
00401038   push        edi
00401039   lea         edi,[ebp-4Ch]
0040103C   mov         ecx,13h
00401041   mov         eax,0CCCCCCCCh
00401046   rep stos    dword ptr [edi]
8:        int a, b, c;
9:        a = 1;
00401048   mov         dword ptr [ebp-4],1
10:       b = 2;
0040104F   mov         dword ptr [ebp-8],2
11:       c = add(a, b);
00401056   mov         eax,dword ptr [ebp-8]
00401059   push        eax
0040105A   mov         ecx,dword ptr [ebp-4]
0040105D   push        ecx
0040105E   call        @ILT+0(add) (00401005)
00401063   add         esp,8
00401066   mov         dword ptr [ebp-0Ch],eax
12:
13:       return 0;
00401069   xor         eax,eax
14:   }
0040106B   pop         edi
0040106C   pop         esi
0040106D   pop         ebx
0040106E   add         esp,4Ch
00401071   cmp         ebp,esp
00401073   call        __chkesp (004081a0)
00401078   mov         esp,ebp
0040107A   pop         ebp
0040107B   ret
----------------------------------------------------------------------------------
15:
16:   int add(int a, int b)
17:   {
00401090   push        ebp
00401091   mov         ebp,esp
00401093   sub         esp,44h
00401096   push        ebx
00401097   push        esi
00401098   push        edi
00401099   lea         edi,[ebp-44h]
0040109C   mov         ecx,11h
004010A1   mov         eax,0CCCCCCCCh
004010A6   rep stos    dword ptr [edi]
18:       int c;
19:       c = a + b;
004010A8   mov         eax,dword ptr [ebp+8]
004010AB   add         eax,dword ptr [ebp+0Ch]
004010AE   mov         dword ptr [ebp-4],eax
20:       return c;
004010B1   mov         eax,dword ptr [ebp-4]
21:   }
004010B4   pop         edi
004010B5   pop         esi
004010B6   pop         ebx
004010B7   mov         esp,ebp
004010B9   pop         ebp
004010BA   ret

간단한 암호입력 프로그램

~cpp 
#include <iostream>
using namespace std;

void main()
{
	char pass[8];
	cout << "input password : ";
	cin >> pass;
	if (!strcmp(pass, "12345"))
		cout << "correct passwd" << endl;
	else
		cout << "wrong passwd" << endl;
}

~cpp 
1:    #include <iostream>
2:    using namespace std;
3:
4:    void main()
5:    {
00401340   push        ebp
00401341   mov         ebp,esp
00401343   sub         esp,48h
00401346   push        ebx
00401347   push        esi
00401348   push        edi
00401349   lea         edi,[ebp-48h]
0040134C   mov         ecx,12h
00401351   mov         eax,0CCCCCCCCh
00401356   rep stos    dword ptr [edi]
6:        char pass[8];
7:        cout << "input password : ";
00401358   push        offset string "input password : " (0046c048)
0040135D   push        offset std::cout (00479e88)
00401362   call        @ILT+370(std::operator<<) (00401177)
00401367   add         esp,8
8:        cin >> pass;
0040136A   lea         eax,[ebp-8]
0040136D   push        eax
0040136E   push        offset std::cin (00479f18)
00401373   call        @ILT+55(std::operator>>) (0040103c)
00401378   add         esp,8
9:        if (!strcmp(pass, "12345"))
0040137B   push        offset string "12345" (0046c040)
00401380   lea         ecx,[ebp-8]
00401383   push        ecx
00401384   call        strcmp (0041f9e0)
00401389   add         esp,8
0040138C   test        eax,eax
0040138E   jne         main+70h (004013b0)
10:           cout << "correct passwd" << endl;
00401390   push        offset @ILT+120(std::endl) (0040107d)
00401395   push        offset string "correct passwd" (0046c02c)
0040139A   push        offset std::cout (00479e88)
0040139F   call        @ILT+370(std::operator<<) (00401177)
004013A4   add         esp,8
004013A7   mov         ecx,eax
004013A9   call        @ILT+295(std::basic_ostream<char,std::char_traits<char> >::operator<<) (0040112c)
11:       else
004013AE   jmp         main+8Eh (004013ce)
12:           cout << "wrong passwd" << endl;
004013B0   push        offset @ILT+120(std::endl) (0040107d)
004013B5   push        offset string "wrong passwd" (0046c01c)
004013BA   push        offset std::cout (00479e88)
004013BF   call        @ILT+370(std::operator<<) (00401177)
004013C4   add         esp,8
004013C7   mov         ecx,eax
004013C9   call        @ILT+295(std::basic_ostream<char,std::char_traits<char> >::operator<<) (0040112c)
13:   }
004013CE   pop         edi
004013CF   pop         esi
004013D0   pop         ebx
004013D1   add         esp,48h
004013D4   cmp         ebp,esp
004013D6   call        __chkesp (0041fa70)
004013DB   mov         esp,ebp
004013DD   pop         ebp
004013DE   ret
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:02
Processing time 0.0151 sec