Jump to content

Trying To Write A Crackme


Kamikaze_Badger

Recommended Posts

In order to gain some knowledge on Assembly, I download crackme's(programs made to be cracked, as it says in the license) and mess around with their innards. I've decided to try to write one myself, but Dev-C++ dosn't like me.

 

 

 

Code:

 

#include <iostream>
#include <stdlib.h>

using namespace std;

int nOne = 1
int * nOne
int answer

int main();

   {
     cout << "Enter Password: ";
     cin >> answer;
     
     if(answer != *nOne)
     
     { cout << "Wrong one!"; system("pause"); return 0;}
     
     else { cout << "You win!"; system("pause"); return 0;}
     
 return 0;}

 

Error messages:

 

7 D:\TheMormonTrail-src\crackme.cpp syntax error before `int'

 

14 D:\TheMormonTrail-src\crackme.cpp syntax error before `>>' token

 

18 D:\TheMormonTrail-src\crackme.cpp ISO C++ forbids declaration of ` system' with no type

 

18 D:\TheMormonTrail-src\crackme.cpp `int system' redeclared as different kind of symbol

 

362 D:\Dev-Cpp\include\stdlib.h previous declaration of `int system(const char*)'

 

18 D:\TheMormonTrail-src\crackme.cpp invalid conversion from `const char*' to `int'

 

18 D:\TheMormonTrail-src\crackme.cpp syntax error before `return'

 

20 D:\TheMormonTrail-src\crackme.cpp ISO C++ forbids declaration of ` system' with no type

 

20 D:\TheMormonTrail-src\crackme.cpp redefinition of `int system'

 

18 D:\TheMormonTrail-src\crackme.cpp `int system' previously defined here

 

20 D:\TheMormonTrail-src\crackme.cpp invalid conversion from `const char*' to `int'

 

20 D:\TheMormonTrail-src\crackme.cpp syntax error before `return'

 

 

 

 

Btw, crackme's are "made" to be cracked, and cracking is only illegal if it's forbidden by the EULA. In a true crackme, the EULA grants permission for the program to be cracked.

Share this post


Link to post
Share on other sites

Ok, added the semi-colons to it. Updated code:

 

#include <iostream>
#include <stdlib.h>

using namespace std;

int nOne = 1;
//int * nOne
int answer;

int main();

   {
     cout << "Enter Password: ";
     cin >> answer;
     
     if(answer != nOne);
     
     { cout << "Wrong one!"; system("PAUSE") return 0;}
     
     else { cout << "You win!"; system("PAUSE") return 0;}
     
 return 0;}

 

Error messages:

 

12 D:\TheMormonTrail-src\crackme.cpp syntax error before `{' token

 

14 D:\TheMormonTrail-src\crackme.cpp syntax error before `>>' token

 

18 D:\TheMormonTrail-src\crackme.cpp ISO C++ forbids declaration of ` system' with no type

 

18 D:\TheMormonTrail-src\crackme.cpp `int system' redeclared as different kind of symbol

 

362 D:\Dev-Cpp\include\stdlib.h previous declaration of `int system(const char*)'

 

18 D:\TheMormonTrail-src\crackme.cpp invalid conversion from `const char*' to `int'

 

18 D:\TheMormonTrail-src\crackme.cpp syntax error before `return'

 

20 D:\TheMormonTrail-src\crackme.cpp ISO C++ forbids declaration of ` system' with no type

 

20 D:\TheMormonTrail-src\crackme.cpp redefinition of `int system'

 

18 D:\TheMormonTrail-src\crackme.cpp `int system' previously defined here

 

20 D:\TheMormonTrail-src\crackme.cpp invalid conversion from `const char*' to `int'

 

20 D:\TheMormonTrail-src\crackme.cpp syntax error before `return'

Share this post


Link to post
Share on other sites

Here is what I would do, seems more effecient.

#include <iostream>
#include <stdlib.h>

using namespace std;

int nOne = 1;
int answer;

int main(){

cout << "Enter Password: ";
cin >> answer;

if(answer != nOne){
 cout << "Wrong one!\n";
}
else{
 cout << "You win!\n";
}
system("PAUSE");
return 0;
}

Share this post


Link to post
Share on other sites

But incase he's wondering, since his code is nearly identical.. it still didn't compile because you had a ; after the main and if that shouldn't be there:

 

int main(); <<<<<
{

snip snip

if (answer != nOne); <<<<
{

 

and you missed the ;'s needed after system() and before the returns

 

{ cout << "Wrong one!"; system("PAUSE") return 0;}

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...