forked from duyphan2502/moon-modeler-keygen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
128 lines (113 loc) · 3.02 KB
/
index.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
const { app } = require("electron");
const crypto = require("crypto");
const moment = require("moment");
const fs = require("fs");
const algorithm = "aes-256-ctr";
const password = "mmM0t3k";
const encryption_key = "BUA9VFNtbRQM85BODcCbXlrUtXXH3D3x";
const initialization_vector = "665UHDQ5qdBnI777";
function encrypt(text) {
const cipher = crypto.createCipheriv(
"aes-256-cbc",
Buffer.from(encryption_key),
Buffer.from(initialization_vector)
);
var crypted = cipher.update(text, "utf8", "hex");
crypted += cipher.final("hex");
return crypted;
}
function decrypt(encryptedText) {
const decipher = crypto.createDecipheriv(
"aes-256-cbc",
Buffer.from(encryption_key),
Buffer.from(initialization_vector)
);
let dec = decipher.update(encryptedText, "hex", "utf8");
dec += decipher.final("utf8");
return dec;
}
function saveLicense(content, path) {
const fileName = `${path}dts.asar.sys`;
const encryptedContent = encrypt(JSON.stringify(content));
fs.writeFileSync(fileName, encryptedContent);
}
// Get product name from argument
const productName = process.argv[2];
let pathName = "LunaModeler";
if (
productName !== "luna" &&
productName !== "meteor" &&
productName !== "perseid" &&
productName !== "galaxy" &&
productName !== "moon"
) {
}
switch (productName) {
default:
console.log("Invalid product name:");
console.log("Usage: node index.js <product_name>");
console.log(
"Where <product_name> is one of: luna, meteor, perseid, galaxy, moon"
);
process.exit(1);
break;
case "luna":
pathName = "LunaModeler";
break;
case "meteor":
pathName = "MeteorModeler";
break;
case "perseid":
pathName = "PerseidModeler";
break;
case "galaxy":
pathName = "GalaxyModeler";
break;
case "moon":
pathName = "MoonModeler";
break;
}
let licPath = "";
if (process.platform === "win32") {
// Path of app userData
username = process.env.USERNAME;
licPath = "C:\\Users\\" + username + "\\AppData\\Roaming\\";
} else if (process.platform === "darwin") {
// Path of app userData
username = process.env.USER;
licPath = "/Users/" + username + "/Library/Application Support/";
} else if (process.platform === "linux") {
// Path of app userData
username = process.env.USER;
licPath = "/home/" + username + "/.config/";
} else {
console.log("Unsupported platform");
process.exit(1);
}
licPath += pathName + "/";
const fileName = `${licPath}dt.asar.sys`;
let expires = moment().add(60, "years").unix();
fs.writeFileSync(fileName, expires.toString() + "963");
let stamp = new Date();
let randomKey = crypto.randomBytes(33).toString("hex");
let randomMail =
crypto.randomBytes(10).toString("hex") +
"@" +
crypto.randomBytes(10).toString("hex") +
".com";
let randomId = crypto.randomBytes(10).toString("hex");
const licData = {
licType: "commercial",
key: randomKey,
purchase: {
seller_id: randomId,
short_product_id: "gjpdud",
product_name: productName,
email: randomMail,
},
created: moment(stamp).subtract(1, "days").unix(),
uses: 999999,
};
saveLicense(licData, licPath);
console.log("ok");
process.exit(0);