Jump to content
Sign in to follow this  
Kamikaze_Badger

Trying To Write A Crackme

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

int nOne = 1
int * nOne
int answer

 

you're missing ;'s. You don't really need that int pointer either :P and uhm.. you're declaring nOne twice (can't do that!!!)

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...