Jump to content


Photo
- - - - -

Trying To Write A Crackme


  • Please log in to reply
5 replies to this topic

#1 Kamikaze_Badger

Kamikaze_Badger

    (⌐■_■)

  • Members
  • PipPipPipPipPipPip
  • 8337 posts
  • Gender:Male
  • Location:Somewhere

Posted 05 December 2004 - 05:13 PM

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.
Is my Razer Diamondback retro yet?
s

Graciously recommended from KB, is some muffricken Christian death metal. It is a must hear, it pushes envelopes, explores new ground. Words can't describe just now incredibly awesome this is. Cue the alter smashing, bench flipping, and bible reading while thrashing away at guitars and drums.

I witnessed regional Special Olympics and Challenge Day; there's far more intellect there than there is in internet arguments.

#2 markiemrboo

markiemrboo

    BSD Fiend

  • Members
  • PipPipPipPipPipPip
  • 5955 posts
  • Gender:Male
  • Location:Gt Yarmouth, UK

Posted 06 December 2004 - 07:55 AM

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!!!)
( Intel C2Q9300 + Scythe Zipang (400 x 7.5 = 3GHz @ 1.3v) ) ( Gigabyte GA-P35C-DS3R v2.1 ) ( 2 x 2GB OCZ OCZ2N800SR4GK PC2-6400 (400 x 5-5-5-15 @ 2.1v) ) ( Sapphire 4890 OC 1GB ) ( 4 x 1TB Samsung F1, 1 x 500GB Samsung T ) ( Pioneer DVR-109XL ) ( X-fi XtremeMusic ) ( Corsair HX 520 ) ( Enermax Pandora CA-3030 ) ( 2 x Benq G2400W ) ( Cherry CyMotion Expert ) ( Windows Vista Ultimate x64 SP1 )

Posted Image

#3 Kamikaze_Badger

Kamikaze_Badger

    (⌐■_■)

  • Members
  • PipPipPipPipPipPip
  • 8337 posts
  • Gender:Male
  • Location:Somewhere

Posted 06 December 2004 - 06:31 PM

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'
Is my Razer Diamondback retro yet?
s

Graciously recommended from KB, is some muffricken Christian death metal. It is a must hear, it pushes envelopes, explores new ground. Words can't describe just now incredibly awesome this is. Cue the alter smashing, bench flipping, and bible reading while thrashing away at guitars and drums.

I witnessed regional Special Olympics and Challenge Day; there's far more intellect there than there is in internet arguments.

#4 c0ld

c0ld

    Member

  • Members
  • PipPip
  • 122 posts
  • Gender:Male

Posted 06 December 2004 - 08:56 PM

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;
}

5^.5*.5+.5

#5 markiemrboo

markiemrboo

    BSD Fiend

  • Members
  • PipPipPipPipPipPip
  • 5955 posts
  • Gender:Male
  • Location:Gt Yarmouth, UK

Posted 07 December 2004 - 04:06 AM

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;}

( Intel C2Q9300 + Scythe Zipang (400 x 7.5 = 3GHz @ 1.3v) ) ( Gigabyte GA-P35C-DS3R v2.1 ) ( 2 x 2GB OCZ OCZ2N800SR4GK PC2-6400 (400 x 5-5-5-15 @ 2.1v) ) ( Sapphire 4890 OC 1GB ) ( 4 x 1TB Samsung F1, 1 x 500GB Samsung T ) ( Pioneer DVR-109XL ) ( X-fi XtremeMusic ) ( Corsair HX 520 ) ( Enermax Pandora CA-3030 ) ( 2 x Benq G2400W ) ( Cherry CyMotion Expert ) ( Windows Vista Ultimate x64 SP1 )

Posted Image

#6 lt_navvara

lt_navvara

    Member

  • Members
  • PipPip
  • 396 posts
  • Location:Transylvania

Posted 08 December 2004 - 10:31 PM

     
     if(answer != nOne);
     
     { cout << "Wrong one!"; system("PAUSE") return 0;}
     
     else { cout << "You win!"; system("PAUSE") return 0;}
     
 return 0;}[/CODE]

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'

1. no ; after if
2. u forgot the ; after sistem
3. and the main function cannot do return us exit instead