Folder refactor

This commit is contained in:
Andrew 2023-06-01 23:09:44 +03:00
parent cc009d0ad4
commit e437cc548a
8 changed files with 23 additions and 17 deletions

View File

@ -1,31 +1,31 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11) CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
PROJECT(WindowsXPKg) PROJECT(WindowsXPKg)
SET(CMAKE_CXX_STANDARD 17) SET(CMAKE_CXX_STANDARD 17)
set(OPENSSL_USE_STATIC_LIBS TRUE) SET(OPENSSL_USE_STATIC_LIBS TRUE)
find_package(PkgConfig REQUIRED) FIND_PACKAGE(PkgConfig REQUIRED)
pkg_search_module(OPENSSL REQUIRED openssl) PKG_SEARCH_MODULE(OPENSSL REQUIRED openssl)
if (!OPENSSL_FOUND) IF(!OPENSSL_FOUND)
message(FATAL_ERROR "OpenSSL Development Libraries Not Found") MESSAGE(FATAL_ERROR "OpenSSL Development Libraries Not Found")
endif() ENDIF()
include(cmake/CPM.cmake) INCLUDE(cmake/CPM.cmake)
# include json runtime library # Include JSON runtime library
CPMAddPackage( CPMAddPackage(
NAME nlohmann_json NAME nlohmann_json
GITHUB_REPOSITORY nlohmann/json GITHUB_REPOSITORY nlohmann/json
VERSION 3.11.2) VERSION 3.11.2)
configure_file(keys.json keys.json COPYONLY) CONFIGURE_FILE(keys.json keys.json COPYONLY)
set(BUILD_SHARED_LIBS OFF) SET(BUILD_SHARED_LIBS OFF)
set(CMAKE_EXE_LINKER_FLAGS "-static") SET(CMAKE_EXE_LINKER_FLAGS "-static")
ADD_EXECUTABLE(xpkey main.cpp xp.cpp key.cpp util.cpp cli.cpp) ADD_EXECUTABLE(xpkey src/main.cpp src/xp.cpp src/key.cpp src/util.cpp src/cli.cpp)
TARGET_INCLUDE_DIRECTORIES(xpkey PUBLIC crypto) TARGET_INCLUDE_DIRECTORIES(xpkey PUBLIC crypto)
TARGET_LINK_LIBRARIES(xpkey PUBLIC crypto nlohmann_json::nlohmann_json) TARGET_LINK_LIBRARIES(xpkey PUBLIC crypto nlohmann_json::nlohmann_json)
ADD_EXECUTABLE(srv2003key server.cpp key.cpp util.cpp cli.cpp) ADD_EXECUTABLE(srv2003key src/server.cpp src/key.cpp src/util.cpp src/cli.cpp)
TARGET_INCLUDE_DIRECTORIES(srv2003key PUBLIC crypto) TARGET_INCLUDE_DIRECTORIES(srv2003key PUBLIC crypto)
TARGET_LINK_LIBRARIES(srv2003key PUBLIC crypto nlohmann_json::nlohmann_json) TARGET_LINK_LIBRARIES(srv2003key PUBLIC crypto nlohmann_json::nlohmann_json)

View File

@ -10,6 +10,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <ctime> #include <ctime>
#include <random>
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <vector> #include <vector>
@ -31,7 +32,7 @@
#define FIELD_BYTES_2003 64 #define FIELD_BYTES_2003 64
typedef unsigned char byte; typedef unsigned char byte;
typedef uint32_t ul32; typedef unsigned int ul32;
extern char charset[]; extern char charset[];

View File

@ -80,7 +80,7 @@ int main() {
ul32 nRaw = 640 * 1000000 ; /* <- change */ ul32 nRaw = 640 * 1000000 ; /* <- change */
//nRaw += rand() & 999999; //nRaw += rand() & 999999;
printf("> PID: %lu\n", nRaw); printf("> PID: %u\n", nRaw);
// generate a key // generate a key
BN_sub(privateKey, genOrder, privateKey); BN_sub(privateKey, genOrder, privateKey);

View File

@ -4,6 +4,11 @@
#include "header.h" #include "header.h"
int randomRange() {
}
/* Convert data between endianness types. */ /* Convert data between endianness types. */
void endian(byte *data, int length) { void endian(byte *data, int length) {
for (int i = 0; i < length / 2; i++) { for (int i = 0; i < length / 2; i++) {

View File

@ -231,7 +231,7 @@ void generateXPKey(char *pKey, EC_GROUP *eCurve, EC_POINT *generator, BIGNUM *or
// Pack product key. // Pack product key.
packXP(bKey, pRaw, &hash, sig); packXP(bKey, pRaw, &hash, sig);
printf("PID: %.8lX\nHash: %.8lX\nSig: %.8lX %.8lX\n", pRaw[0], hash, sig[1], sig[0]); printf("PID: %.8X\nHash: %.8X\nSig: %.8X %.8X\n", pRaw[0], hash, sig[1], sig[0]);
} while (bKey[3] >= 0x40000); } while (bKey[3] >= 0x40000);
// ↑ ↑ ↑ // ↑ ↑ ↑
// bKey[3] can't be longer than 18 bits, else the signature part will make // bKey[3] can't be longer than 18 bits, else the signature part will make