Skip to content

Commit

Permalink
QWORD / AuthInfo / Upgrade Bit / ComboBox
Browse files Browse the repository at this point in the history
  • Loading branch information
Endermanch committed Jun 16, 2023
1 parent 6dca6a1 commit c87069e
Show file tree
Hide file tree
Showing 10 changed files with 469 additions and 173 deletions.
1 change: 1 addition & 0 deletions Keygen.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@
<Media Include="resources\pxiii.wav" />
</ItemGroup>
<ItemGroup>
<Image Include="resources\dropdown.bmp" />
<Image Include="resources\ender.bmp" />
<Image Include="resources\icon.ico" />
<Image Include="resources\logo.bmp" />
Expand Down
3 changes: 3 additions & 0 deletions Keygen.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
<Image Include="resources\musicon.bmp">
<Filter>Resources</Filter>
</Image>
<Image Include="resources\dropdown.bmp">
<Filter>Resources</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc">
Expand Down
52 changes: 26 additions & 26 deletions header.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,28 @@
#define IDC_BUTTON3 1002
#define IDC_BUTTON4 1003

#define IDC_RADIO1 1005
#define IDC_RADIO2 1006
#define IDC_COMBO1 1020

#define IDC_EDIT1 1010
#define IDC_RADIO1 1030
#define IDC_RADIO2 1031

#define IDC_INPUT1 1020
#define IDC_INPUT2 1021
#define IDC_CHECK1 1036

#define IDC_IMAGE1 1050
#define IDC_IMAGE2 1051
#define IDC_EDIT1 1040

#define IDC_LABEL1 1055
#define IDC_LABEL2 1056
#define IDC_LABEL3 1057
#define IDC_LABEL4 1058
#define IDC_LABEL5 1059
#define IDC_INPUT1 1060
#define IDC_INPUT2 1061
#define IDC_INPUT3 1062

#define IDC_IMAGE1 1080
#define IDC_IMAGE2 1081

#define IDC_LABEL1 1105
#define IDC_LABEL2 1106
#define IDC_LABEL3 1107
#define IDC_LABEL4 1108
#define IDC_LABEL5 1109
#define IDC_LABEL6 1110

typedef uint64_t QWORD;

Expand All @@ -67,31 +73,25 @@ extern const char pXP[];
extern const long aXP;
extern const long bXP;


// xp.cpp
VOID unpackXP(
QWORD (&pRaw)[2],
BOOL &pUpgrade,
DWORD &pSerial,
QWORD(&pRaw)[2],
BOOL &pUpgrade,
DWORD &pChannelID,
DWORD &pSequence,
DWORD &pHash,
QWORD &pSignature
);

VOID packXP(
QWORD (&pRaw)[2],
BOOL pUpgrade,
DWORD pSerial,
DWORD pChannelID,
DWORD pSequence,
DWORD pHash,
QWORD pSignature
);

BOOL verifyXPKey(
EC_GROUP *eCurve,
EC_POINT *basePoint,
EC_POINT *publicKey,
CHAR (&pKey)[PK_LENGTH + NULL_TERMINATOR]
);

VOID generateXPKey(
EC_GROUP *eCurve,
EC_POINT *basePoint,
Expand Down Expand Up @@ -184,8 +184,8 @@ int BN_bn2lebin(const BIGNUM *a, unsigned char *to, int tolen);
bool unbase24(BYTE *byteSeq, CHAR (&pKey)[PK_LENGTH + NULL_TERMINATOR]);
void base24(BYTE *byteSeq, CHAR(&pKey)[PK_LENGTH + NULL_TERMINATOR]);

void formatXP(WCHAR *pBSection, WCHAR *pCSection, WCHAR *pText);
void formatServer(WCHAR *pText);
VOID formatXP(BOOL bUpgrade, WCHAR *pBSection, WCHAR *pCSection, WCHAR *pText);
VOID formatServer(BOOL bUpgrade, WCHAR *pBSection, WCHAR *pAuthSection, WCHAR *pText);


// windows.cpp
Expand Down
66 changes: 39 additions & 27 deletions key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,80 +73,92 @@ void base24(BYTE *byteSeq, CHAR(&pKey)[PK_LENGTH + NULL_TERMINATOR]) {
}

/* Formats Windows XP key output. */
void formatXP(WCHAR *pBSection, WCHAR *pCSection, WCHAR *pText) {
void formatXP(BOOL bUpgrade, WCHAR *pBSection, WCHAR *pCSection, WCHAR *pText) {
WCHAR pDashedKey[PK_LENGTH + 4 + NULL_TERMINATOR]{};

int pSSection = 0;
INT pSSection = 0;

for (int i = 0; i < wcslen(pCSection); i++)
pSSection -= pCSection[i] - '0';

while (pSSection < 0)
pSSection += 7;

CHAR pKey[PK_LENGTH + NULL_TERMINATOR]{};
DWORD pChannelID = _wtoi(pBSection),
pSequence = _wtoi(pCSection);
CHAR pKey[PK_LENGTH + NULL_TERMINATOR]{};
DWORD nChannelID = wcstoul(pBSection, nullptr, 10),
nSequence = wcstoul(pCSection, nullptr, 10);

BOOL bValid = keyXP(pKey, nChannelID, nSequence, bUpgrade);

DWORD pHash;
QWORD pRaw[2]{},
pSignature;

bool bValid = keyXP(pKey, pChannelID, pSequence, false);
DWORD pChannelID,
pSequence,
pSerial,
pHash;

DWORD pSerial;
BOOL pUpgrade = false;
BOOL pUpgrade;

unbase24((BYTE *)pRaw, pKey);
unpackXP(pRaw, pUpgrade, pSerial, pHash, pSignature);
unpackXP(pRaw, pUpgrade, pChannelID, pSequence, pHash, pSignature);

pSerial = pChannelID * 1'000'000 + pSequence;

for (int i = 0; i < 5; i++)
wsprintfW(pDashedKey, L"%s%s%.5S", pDashedKey, i != 0 ? L"-" : L"", &pKey[5 * i]);

swprintf(
pText,
L"Product ID:\tPPPPP-%03d-%06d%d-23XXX\r\n\r\nBytecode:\t%016llX %016llX\r\nHash:\t\t%lX\r\nSignature:\t%llX\r\nCurve Point:\t%s\r\n\r\n%s\r\n",
pSerial / 1'000'000,
pSerial % 1'000'000,
L"PRODUCT ID:\tPPPPP-%03d-%06d%d-23XXX\r\n\r\nBYTECODE:\t%016llX %016llX\r\nUPGRADE:\t%s\r\nSERIAL:\t\t0x%lX (%d)\r\nHASH:\t\t0x%lX\r\nSIGNATURE:\t0x%llX\r\nCURVE POINT:\t%s\r\n\r\n\r\n%s\r\n",
pChannelID,
pSequence,
pSSection,
pRaw[1], pRaw[0],
pUpgrade ? L"TRUE" : L"FALSE",
pSerial, pSerial,
pHash,
pSignature,
bValid ? L"True" : L"False",
bValid ? L"TRUE" : L"FALSE",
pDashedKey
);
}

/* Formats Windows Server 2003 key output. */
void formatServer(WCHAR *pText) {
void formatServer(BOOL bUpgrade, WCHAR *pBSection, WCHAR *pAuthSection, WCHAR *pText) {
WCHAR pDashedKey[32]{};

char pKey[PK_LENGTH + NULL_TERMINATOR]{};
DWORD pHash = 0,
pChannelID = 0,
pAuthInfo = 0;
CHAR pKey[PK_LENGTH + NULL_TERMINATOR]{};
DWORD nChannelID = wcstoul(pBSection, nullptr, 10);
DWORD nAuthInfo = wcstoul(pAuthSection, nullptr, 0) % 0x400;

BOOL bValid = keyServer(pKey, nChannelID, nAuthInfo, bUpgrade);

QWORD pRaw[2]{},
pSignature;
pSignature;

DWORD pHash,
pChannelID,
pAuthInfo;

BOOL pUpgrade = false;
bool bValid = keyServer(pKey, 640, 0, pUpgrade);
BOOL pUpgrade;

unbase24((BYTE *)pRaw, pKey);
unpackServer(pRaw, pUpgrade, pChannelID, pHash, pSignature, pAuthInfo);

for (int i = 0; i < 5; i++)
wsprintfW(pDashedKey, L"%s%s%.5S", pDashedKey, i != 0 ? L"-" : L"", &pKey[5 * i]);
swprintf(pDashedKey, L"%s%s%.5S", pDashedKey, i != 0 ? L"-" : L"", &pKey[5 * i]);

swprintf(
pText,
L"Bytecode:\t%016llX %016llX\r\nChannel ID:\t%d\r\nHash:\t\t%lX\r\nSignature:\t%llX\r\nAuthInfo:\t%d\r\nCurve Point:\t%s\r\n\r\n%s\r\n",
pRaw[1], pRaw[0],
L"PRODUCT ID:\tPPPPP-%03d-CCCCCCS-45XXX\r\n\r\nBYTECODE:\t%016llX %016llX\r\nUPGRADE:\t%s\r\nCHANNEL ID:\t0x%lX (%d)\r\nHASH:\t\t0x%lX\r\nSIGNATURE:\t0x%llX\r\nAUTHINFO:\t0x%03lX\r\nCURVE POINT:\t%s\r\n\r\n%s\r\n",
pChannelID,
pRaw[1], pRaw[0],
pUpgrade ? L"TRUE" : L"FALSE",
pChannelID, pChannelID,
pHash,
pSignature,
pAuthInfo,
bValid ? L"True" : L"False",
bValid ? L"TRUE" : L"FALSE",
pDashedKey
);
}
3 changes: 2 additions & 1 deletion resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
#define IDB_BITMAP2 104
#define IDB_BITMAP3 105
#define IDB_BITMAP4 106
#define IDB_BITMAP5 107

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_RESOURCE_VALUE 108
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
Expand Down
Binary file modified resource.rc
Binary file not shown.
Binary file added resources/dropdown.bmp
Binary file not shown.
4 changes: 2 additions & 2 deletions server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const char genOrderSv[] = "4CC5C56529F0237D";
// Computed private key
const char privateKeySv[] = "2606120F59C05118";

/* Windows XP x64
/* Windows XP x64
Public key (-K) = (1989960177638374390878377737764297057685259206834686428253479199374616869742150776410973898745805799780071536831208959469038333664656928533078897351495263; 2680493145252003995204016438404731303203625133293449171132691660710342616258476835192643732221910418645447349019141673820306444587247165566828458285756618)
Order of base point G (n) = 4710798293276956193
Private key (k) = 4699066967014190092 for INVERSE. 11731326262766101
Expand All @@ -43,7 +43,7 @@ const char pubYSv[] = "A186A2C2913E5584F05E97D3CD49E354E6C41BE329877D7FCC7B2BF87
const char genOrderSv[] = "41601E16BF4A1621";
// Computed private key <- CALCULATED ON MY i7-12700K in 5 minutes 40 seconds
const char privateKeySv[] = "4136708280A72C0C";*/
const char privateKeySv[] = "29AD943EA2EA15"; */


/* Windows XP x64 OEM
Expand Down
Loading

0 comments on commit c87069e

Please sign in to comment.