-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
license_gen.js
84 lines (78 loc) · 3.63 KB
/
license_gen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
const crypto = require("crypto");
const fs = require("node:fs");
const readline = require("node:readline");
const { stdin: input, stdout: output } = require("node:process");
const rl = readline.createInterface({ input, output });
rl.question("Enter your HWID: ", (user_input) => {
// hwid = user_input;
hwid = "---------Hi-Korepi-Devs---------";
const publicKey = `-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuBti5eEFCv3+qcBnooMF
vNHH2lDD/GjcgNpQNaeow7bCawpHMkyxtUUVQjuhyo5+LT7lMOJ+yoQAE5507Cvn
Ep9tuSJC0qcVT4/07FLblTDJiYxFgsFd5/skmUDTmClgffr8UOPRvJp/q62GTyYa
Pb63jWPHbNhqVjjWCI/ZRnfzqkadiP9uzdTVvyLkLpj6Hr/LpvHRUlK/NGhh1QU7
8lIc87XmNzOVL+uzMAT00AcKzilwg0za/oG5SXeHdac53t0lN3Bge5VxVgyzh0M2
/ADipBfd2JzlElNUL0y45Kx/HopT3nfwoq5PHW3JFXLxg56l3U8LqedK7Q+K7jmP
/QIDAQAB
-----END PUBLIC KEY-----`;
const privateKey = `-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC4G2Ll4QUK/f6p
wGeigwW80cfaUMP8aNyA2lA1p6jDtsJrCkcyTLG1RRVCO6HKjn4tPuUw4n7KhAAT
nnTsK+cSn225IkLSpxVPj/TsUtuVMMmJjEWCwV3n+ySZQNOYKWB9+vxQ49G8mn+r
rYZPJho9vreNY8ds2GpWONYI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lWFBWLgODyBSOxlLsKl3PvneHIs/TWgc2A95dbCfLRzxl1DvDmxoEOVKTz
aR0hq0DHyTKycOfm2YwgF3ateQ3JPKf21kaJk26Dicor8ch55KRE3FnnUKYpPHV1
ILq/q8kUMEUu9FTpr8S/SvbD7LGPko5whZUOG0yhAoGAK4VieEUXlxQeaI2JNQE+
loHWRKnvVCnFUs7qsalQB5yvs/3kr7n9usgGhAtC0IpIwyp1D7v2Om+AjAZLbvXi
EO6b4mHx2yTVODNwlDr1l5yvP20gqTDLIZb/fcIRxvnZKmEn0st7d7+5/NVUsGYv
JuXe/NYkDOj7sJowggbhASU=
-----END PRIVATE KEY-----`;
// const randomBytes = crypto.randomBytes(10);
const randomBytes = Buffer.from("mokPVuACUwR5Qw==", "base64");
const md5 = crypto.createHash("md5").update(randomBytes).digest("hex");
const encryptedMd5 = Buffer.from(randomBytes).toString("base64");
const cipher = crypto.createCipheriv(
"aes-256-cbc",
md5,
Buffer.from("6BCDEF0123456786")
);
let privatekeyPkcs1PemEnc = cipher.update(privateKey, "utf8", "base64");
privatekeyPkcs1PemEnc += cipher.final("base64");
const license = {
cardstr: "micah-oc-00000000000000000000000000000000",
expiry_time: Math.floor((Math.pow(2, 32) - 1) / 2),
hwid: hwid,
role: 25,
data_id: 44262,
user_id: Math.floor(Math.random() * 100000),
};
const encryptedLicense = crypto
.publicEncrypt(
{ key: publicKey, padding: crypto.constants.RSA_PKCS1_PADDING },
JSON.stringify(license)
)
.toString("base64");
const packedLicense = JSON.stringify({
"encrypted.dat": encryptedLicense,
"Encrypted.md5": encryptedMd5,
"privatekey_pkcs1.pem.enc": privatekeyPkcs1PemEnc,
});
fs.writeFileSync("enc.json", packedLicense);
rl.close();
});