Mi sto avvicinando da poco al reversing anche se sapevo già programmare, ecco la mia soluzione
Exe Patchato che accetta qualsiasi serial + Keygen che genera serial per il nome desiderato ---> Download
Niente self-keygen perché non so come si chiama itoa da asm e non credo che il programma in se importi la libreria che contiene itoa.
Codice sorgente del keygen (c++):
#include <iostream>
using namespace std;
// Conta quanti byte è lunga una variabile
#define VALUE_CB(v) (8*sizeof(v))
// Implementazione C++ di ROR e ROL
#define ROL(v, n) ((v<<n)|(v>>(VALUE_CB(v)-n)))
#define ROR(v, n) ((v>>n)|(v<<(VALUE_CB(v)-n)))
void encrypt1(char *src, char *dst, size_t size)
{
size_t i;
for (i=0; i<size; i++)
dst[i] = src[i]^0x40;
dst[i] = '\0';
}
void encrypt2(char *src, char *dst, size_t size, char key, unsigned long &resultingKey)
{
// ResultingKey è un valore usato per generare il serial alla fine
// facendo lo xor coi primi 4 byte della stringa del nome criptata
resultingKey = 0;
size_t i;
for (i=0; i<size; i++) {
*reinterpret_cast<unsigned char *>(&resultingKey) = src[i];
resultingKey = (int)resultingKey*(int)key;
resultingKey += key;
resultingKey = ROL(resultingKey, 4);
resultingKey ^= 0x14;
resultingKey = ROR(resultingKey, 4);
dst[i] = *reinterpret_cast<unsigned char *>(&resultingKey);
}
}
unsigned long generateSerial(char *encrypted, unsigned long key)
{
return (key ^ *reinterpret_cast<unsigned long *>(encrypted));
}
int main()
{
size_t nameLength;
char name[64] = {0};
char encrypt[64] = {0};
unsigned long serial = 0, key = 0;
cout << "Keygen by GunyaGunya\n";
cout << "Name: ";
while (strlen(name) <= 0)
{
fflush(stdin);
gets(name);
}
nameLength = strlen(name);
encrypt1(name, encrypt, nameLength);
encrypt2(encrypt, encrypt, nameLength, name[0], key);
serial = generateSerial(encrypt, key);
cout << "Serial: " << serial << endl << endl;
system("pause");
return EXIT_SUCCESS;
}