TechKnow

Author Topic: [C++] Random CD-Key Generator Example  (Read 1079 times)

0 Members and 1 Guest are viewing this topic.

Offline HcH

  • TechKnow Owner, Ethical Hacker
  • Administrator
  • Uber Member
  • *****
  • Posts: 9933
  • Karma: +2284/-111
[C++] Random CD-Key Generator Example
« on: October 30, 2017, 08:23:17 PM »
[C++] Random CD-Key Generator Example


Compiler: CodeBlocks (download for free: http://codeblocks.org/downloads)
Description: A simple example of randomizing characters and output in a certain format in C++.

Code:
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>

using namespace std;

static const char alphanum[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
;

int stringLength = sizeof(alphanum) - 1;

char genRandom()
{
    return alphanum[rand() % stringLength];
}

int main()
{
    srand(time(0));
    std::string Str;
    for(unsigned int i = 0; i < 25; ++i)
    {
    Str += genRandom();
    }
    //cout << Str << endl;
    cout << Str.substr(0, 5) << '-' << Str.substr(5, 5) << '-' << Str.substr(10, 5) << '-' << Str.substr(15, 5) << '-' << Str.substr(20, 5) << endl;
}

Code: (random_cdkey_generator_example's main.cpp) [Select]
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;

static const char alphanum[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int stringLength = sizeof(alphanum) - 1;

char genRandom()
{
    return alphanum[rand() % stringLength];
}

int main()
{
    srand(time(0));
    std::string Str;
    for(unsigned int i = 0; i < 25; ++i)
    {
    Str += genRandom();
    }
    //cout << Str << endl;
    cout << Str.substr(0, 5) << '-' << Str.substr(5, 5) << '-' << Str.substr(10, 5) << '-' << Str.substr(15, 5) << '-' << Str.substr(20, 5) << endl;
}
« Last Edit: October 30, 2017, 08:26:46 PM by HardcoreHacker »

Offline NotBeyar

  • EHVSN
  • Full Member
  • *
  • Posts: 172
  • Karma: +3/-0
  • Fully stacked developer.
Re: [C++] Random CD-Key Generator Example
« Reply #1 on: July 28, 2018, 06:26:32 PM »
Does this script offer true randomness?

Offline HcH

  • TechKnow Owner, Ethical Hacker
  • Administrator
  • Uber Member
  • *****
  • Posts: 9933
  • Karma: +2284/-111
Re: [C++] Random CD-Key Generator Example
« Reply #2 on: July 30, 2018, 10:32:33 AM »
Does this script offer true randomness?
Nope :(

It relies on time, per second it generates a new code, it could use some tweaking to make it truely random :android-sad:

Offline NotBeyar

  • EHVSN
  • Full Member
  • *
  • Posts: 172
  • Karma: +3/-0
  • Fully stacked developer.
Re: [C++] Random CD-Key Generator Example
« Reply #3 on: August 02, 2018, 05:20:32 PM »
I honestly think your example is more than enough for a CD-Key generator, I does its job. :angel:

Offline HcH

  • TechKnow Owner, Ethical Hacker
  • Administrator
  • Uber Member
  • *****
  • Posts: 9933
  • Karma: +2284/-111
Re: [C++] Random CD-Key Generator Example
« Reply #4 on: August 03, 2018, 09:29:22 AM »
I honestly think your example is more than enough for a CD-Key generator, I does its job. :angel:
For a simple example it's ... minimal :android-ninja:

Would be nice to make some brute forcer that can try a certain amount of keys on some installer though, but I'm using less and less Windows and barely play games :android-nerd:

Anyone who feels like that's a good idea, please be inspired to use this source, improve, and make something better off it :money:

Offline NotBeyar

  • EHVSN
  • Full Member
  • *
  • Posts: 172
  • Karma: +3/-0
  • Fully stacked developer.
Re: [C++] Random CD-Key Generator Example
« Reply #5 on: August 05, 2018, 03:49:03 PM »
Todays CD keys is pretty long, so Idk how effective the brute-forcer would be, but I think you should give it a shot anyways!

Offline HcH

  • TechKnow Owner, Ethical Hacker
  • Administrator
  • Uber Member
  • *****
  • Posts: 9933
  • Karma: +2284/-111
Re: [C++] Random CD-Key Generator Example
« Reply #6 on: August 06, 2018, 01:47:42 PM »
Todays CD keys is pretty long, so Idk how effective the brute-forcer would be, but I think you should give it a shot anyways!
I don't think I can even try those modern activation keys, I think after X wrong attempts the host will prevent you from further attempts.

This theory only applies to older PC games that came with a install key, without online verification :android-smile: the theory is too old to really investigate the possibilities, as about all of those older install/cd keys are leaked and maintained since 2002 by some incredible :android-lame: Lamer, he however managed to get it to 1553 records with 18076 cd-keys, the man even released some 200+ game cdkey registry injector, that manages to "pre-install" cdkeys before you install the game, so it won't ever ask for a key when you install those games :android-wink:

Offline NotBeyar

  • EHVSN
  • Full Member
  • *
  • Posts: 172
  • Karma: +3/-0
  • Fully stacked developer.
Re: [C++] Random CD-Key Generator Example
« Reply #7 on: August 06, 2018, 11:37:57 PM »
Interesting, how did he pull it off?

Offline HcH

  • TechKnow Owner, Ethical Hacker
  • Administrator
  • Uber Member
  • *****
  • Posts: 9933
  • Karma: +2284/-111
Re: [C++] Random CD-Key Generator Example
« Reply #8 on: August 07, 2018, 02:32:43 PM »
Interesting, how did he pull it off?
All we know for sure is, that one can't have a social life while harvesting :android-smile:

I 'think' he managed to pull it off like this::
1. siteripper (harvests serial websites/databases)
2. reversed engineered several other serial database applications and combined all the games of it together
3. regex'd the hell of out of NFORCE.NL after siteripping it to retrieve all key data

Offline NotBeyar

  • EHVSN
  • Full Member
  • *
  • Posts: 172
  • Karma: +3/-0
  • Fully stacked developer.
Re: [C++] Random CD-Key Generator Example
« Reply #9 on: August 07, 2018, 03:58:18 PM »
Wow, that is passion!

Offline HcH

  • TechKnow Owner, Ethical Hacker
  • Administrator
  • Uber Member
  • *****
  • Posts: 9933
  • Karma: +2284/-111
Re: [C++] Random CD-Key Generator Example
« Reply #10 on: August 13, 2018, 11:52:42 AM »
Wow, that is passion!
* obsession with a passion :android-ninja: