 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Thu May 15, 2008 9:40 pm Post subject: [CrackMe] Source |
|
|
This is the source to my crackme. It's in C++.
It mainly uses inline assembly.
| Quote: | // KeyGenMe.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
#include <iostream>
#include <windows.h>
using namespace std;
DWORD str;
char string_win[] = {0x43, 0x4F, 0x52, 0x52, 0x45, 0x43, 0x54};
char string_lose[] = {0x49, 0x4E, 0x43, 0x4F, 0x52, 0x52, 0x45, 0x43, 0x54};
char Get_Input[] = "Password : ";
DWORD array_check[] = {0x31, 0x34, 0x4A, 0x5A, 0x43, 0x30, 0x33,
0x50, 0x40, 0x51, 0x33, 0x35, 0x4A, 0x35,
0x36, 0x4F, 0x31, 0x33, 0x40, 0x4A, 0x00};
void main(void)
{
_asm
{
mov eax, OFFSET Get_Input
push eax
call printf
}
cin >> str;
_asm
{
pushad
mov eax, eax
mov ebx, ebx
mov edx, edx
mov ecx, ecx
xor eax, eax
xor ebx, ebx
xor edx, edx
xor ecx, ecx
shr eax, 0x1F
shl ebx, 0x5A
shl edx, 0x13
shr ecx, 0xA1
xchg eax, ebx
ror eax, 12
xchg ebx, ecx
ror ebx, 13
add ecx, 12
rol ecx, 12
xchg edx, ecx
popad
jmp Next
Next: //Store Pass
push eax
mov eax, array_check
shr eax, 12
ror eax, 13
add eax, 12
push edx
mov edx, eax
pop eax
jmp GetP
GetP: //GetPass
push eax
lea eax, str
add eax, 1
shl eax, 13
add eax, eax
xchg ebx, eax
pop eax
jmp Scramble
Scramble:
mov eax, eax
shl eax, 3
sub eax, 2
xor eax, esi
mov ecx, eax
shl ecx, 1
add ecx, 3
ror ecx, 13
xor eax, ecx
jmp Check
Check:
cmp edx, ebx
jnz BadBoy
jmp GoodBoy
BadBoy:
mov eax, OFFSET string_lose
jmp End
GoodBoy:
mov eax, OFFSET string_win
jmp End
End:
push eax
call printf
}
//edx = stored pass
//ebx = Inputted Pass
Sleep(INFINITE);
}
|
|
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Fri May 16, 2008 9:59 am Post subject: |
|
|
You should've just posted this in your crackme thread. I don't think it's going to be useful to much of anybody in this section. Especially since it doesn't have any kind of protection or strategies to prevent cracking.
_________________
|
|
| Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Fri May 16, 2008 8:49 pm Post subject: |
|
|
| To me, i find this useful because it shows how to use printf in inline assembly.
|
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Fri May 16, 2008 10:23 pm Post subject: |
|
|
It's also misleading because you're doing things completely wrong in ASM.
_________________
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8588 Location: 127.0.0.1
|
Posted: Sat May 17, 2008 10:10 am Post subject: |
|
|
| slippppppppp wrote: | | To me, i find this useful because it shows how to use printf in inline assembly. |
Just so you know, beings that you used VC5/6 for this theres a reason why it actually compiled in worked. If you tried doing this in 2003+ it wouldn't work because the inline asm is wrong.
For example, your code of:
| Code: | _asm
{
mov eax, OFFSET Get_Input
push eax
call printf
} |
Will give the following error:
error C2415: improper operand type
On the line of: mov eax, OFFSET Get_Input
OFFSET has been removed.
Next, you cannot directly call API like that in newer versions, instead, you need to use 'DWORD PTR' in the call such as:
call DWORD PTR [printf]
Then your ESP is not realigned and will toss an exception after the call.
Working example:
| Code: | char* szString = "Something to output\n";
_asm
{
push szString
call dword ptr [printf]
add esp, 4
} |
_________________
- Retired. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|