-
Notifications
You must be signed in to change notification settings - Fork 0
/
mathematica auto keygen v2.0.0.cpp
280 lines (265 loc) · 8.94 KB
/
mathematica auto keygen v2.0.0.cpp
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
#include <string>
#include <iostream>
#include <cmath>
#include <fstream>
#include <io.h>
#include <direct.h>
using namespace std;
int f1(int n, char abyte, int c) {
for (int ibit = 0; ibit < 8; ibit++) {
int bit = (abyte >> ibit) & 1;
if (bit + ((n - bit) & ~1) == n) {
n = (n - bit) >> 1;
}
else {
n = ((c - bit) ^ n) >> 1;
}
}
return n;
}
string genPassword(string str, int hash) {
for (int ibyte = str.size() - 1; ibyte >= 0; ibyte--) {
hash = f1(hash, str[ibyte], 0x105C3);
}
int n1 = 0;
while (f1(f1(hash, n1 & 0xFF, 0x105C3), n1 >> 8, 0x105C3) != 0xA5B6) {
if (++n1 >= 0xFFFF) {
return "Error";
}
}
n1 = floor(((n1 + 0x72FA) & 0xFFFF) * 99999.0 / 0xFFFF);
string n1strtmp = (string("0000") + to_string(n1));
string n1str = n1strtmp.substr(n1strtmp.size() - 5, 5);
int temp = stoi(
n1str.substr(0, n1str.size() - 3)
+ n1str.substr(n1str.size() - 2, 2)
+ n1str.substr(n1str.size() - 3, 1));
temp = ceil((temp / 99999.0) * 0xFFFF);
temp = f1(f1(0, temp & 0xFF, 0x1064B), temp >> 8, 0x1064B);
for (int ibyte = str.size() - 1; ibyte >= 0; ibyte--) {
temp = f1(temp, str[ibyte], 0x1064B);
}
int n2 = 0;
while (f1(f1(temp, n2 & 0xFF, 0x1064B), n2 >> 8, 0x1064B) != 0xA5B6) {
if (++n2 >= 0xFFFF) {
return "Error";
}
}
n2 = floor((n2 & 0xFFFF) * 99999.0 / 0xFFFF);
string n2strtmp = (string("0000") + to_string(n2));
string n2str = n2strtmp.substr(n2strtmp.size() - 5, 5);
string password;
password.push_back(n2str[3]);
password.push_back(n1str[3]);
password.push_back(n1str[1]);
password.push_back(n1str[0]);
password.push_back('-');
password.push_back(n2str[4]);
password.push_back(n1str[2]);
password.push_back(n2str[0]);
password.push_back('-');
password.push_back(n2str[2]);
password.push_back(n1str[4]);
password.push_back(n2str[1]);
password.append("::1");
return password;
}
string genFromMathId(string mathId, string activationKey, int magicnumber) {
string password = genPassword(mathId + "$1&" + activationKey, magicnumber);
return password;
}
//6469-027-086::1
void mmagen(string mathId = "", string activationKey = "")
{
int magicNumbers[] = { 10690, 12251, 17649, 24816, 33360, 35944, 36412, 42041, 42635, 44011, 53799, 56181, 58536, 59222, 61041 };
for (int i = 0; i < 15; i++)
{
cout << genFromMathId(mathId, activationKey, magicNumbers[i]) << endl;
}
}
void systemmodelergen(string mathId = "", string activationKey = "")
{
int magicNumbers[] = { 4912, 4961, 22384, 24968, 30046, 31889, 42446, 43787, 48967, 61182, 62774 };
for (int i = 0; i < 11; i++)
{
cout << genFromMathId(mathId, activationKey, magicNumbers[i]) << endl;
}
}
string mmagenwrite(string mathId = "", string activationKey = "")
{
int magicNumbers[] = { 10690, 12251, 17649, 24816, 33360, 35944, 36412, 42041, 42635, 44011, 53799, 56181, 58536, 59222, 61041 };
return genFromMathId(mathId, activationKey, 10690);
}
string mmagenwrite2(int magicNumber, string mathId = "", string activationKey = "")
{
return genFromMathId(mathId, activationKey, magicNumber);
}
string systemmodelergenwrite(string mathId = "", string activationKey = "")
{
int magicNumbers[] = { 4912, 4961, 22384, 24968, 30046, 31889, 42446, 43787, 48967, 61182, 62774 };
return genFromMathId(mathId, activationKey, 4912);
}
bool checkmathId(string mathId)
{
if (mathId.size() != 16) return 0;
for (int i = 0; i < 4; i++)
{
if (mathId[i] > '9' || mathId[i] < '0') return 0;
}
if (mathId[4] != '-') return 0;
for (int i = 5; i < 10; i++)
{
if (mathId[i] > '9' || mathId[i] < '0') return 0;
}
if (mathId[10] != '-') return 0;
for (int i = 11; i < 16; i++)
{
if (mathId[i] > '9' || mathId[i] < '0') return 0;
}
return 1;
}
bool checkact(string actkey)
{
if (actkey.size() != 16) return 0;
for (int i = 0; i < 4; i++)
{
if (actkey[i] > '9' || actkey[i] < '0') return 0;
}
if (actkey[4] != '-') return 0;
for (int i = 5; i < 9; i++)
{
if (actkey[i] > '9' || actkey[i] < '0') return 0;
}
if (actkey[9] != '-') return 0;
for (int i = 10; i < 16; i += 2)
{
if (actkey[i] > '9' || actkey[i] < '0') return 0;
}
return 1;
}
string genact()
{
srand(time(0));
string actkey;
for (int i = 0; i < 4; i++)
{
actkey.push_back('0' + rand() % 10);
}
actkey.push_back('-');
for (int i = 5; i < 9; i++)
{
actkey.push_back('0' + rand() % 10);
}
actkey.push_back('-');
for (int i = 10; i < 16; i += 2)
{
actkey.push_back('0' + rand() % 10);
actkey.push_back('A' + rand() % 26);
}
return actkey;
}
int main()
{
int k = 0;
cout << "Welcome to wolfram mathematica keygenerator(press 0 to start ,press 1 for help)" << endl;
int num;
cin >> num;
if (num == 1)
{
cout << "Hello" << endl;
cout << "To get the mathId,please do the following steps¡ý" << endl;
cout << "Step1,Open wolfram mathematica" << endl;
cout << "Step 2,if your product is registered , it will take you to the welcome screen" << endl;
cout << "you can press 2 below if your product is registered if not press other numbers" << endl;
cout << "to continue , press 1 " << endl;
cin >> num;
if (num == 2) return 0;
cout << "Step3,if your product is not activated , it will take you to wolfram product activate screen" << endl;
cout << "Step 4,choose manual activation" << endl;
cout << "Step 5,copy the mathid(it's format in xxxx-xxxxx-xxxxx)" << endl;
cout << "Step 6,paste it under 'Please input your mathId below¡ý¡ý¡ý¡ý¡ý¡ý(In the correct format:xxxx-xxxxx-xxxxx)'here" << endl;
cout << "Step 7,if you have a activation key or you want to use your own activation key," << endl;
cout << "type it under 'Input your activation key¡ý¡ý¡ý¡ý¡ý¡ý(in this format:xxxx-xxxx-xxxxxx)'here";
cout << "If no,press any thing you want" << endl;
cout << "Step 8,press ENTER" << endl;
cout << "Step 9,there are 15 passwords with an activation key" << endl;
cout << "Step 10,copy a random password and and paste it into the registration screen" << endl;
cout << "Step 11,paste the activation key into the registration screen" << endl;
cout << "WOW,you've finished reading the tutorial,press enter to pass";
string code;
cin >> code;
}
cout << "Please input your mathId below¡ý¡ý¡ý¡ý¡ý¡ý(In the correct format:xxxx-xxxxx-xxxxx)" << endl;
string mathid, actkey;
cin >> mathid;
while (checkmathId(mathid) != 1)
{
cout << "I'm sorry.Your mathid is not valid,please enter it in this format:xxxx-xxxxx-xxxxx" << endl;
cin >> mathid;
}
cout << "Input your activation key¡ý¡ý¡ý¡ý¡ý¡ý(in this format:xxxx-xxxx-xxxxxx)" << endl;
cin >> actkey;
if (checkact(actkey) != 1)
{
cout << "Sorry , your input activation key is invalid , I'll generated one for you" << endl;
actkey = genact();
}
cout << "Your activation key is:" << actkey << endl;
cout << "pick one of the keys below for mathematica" << endl;
mmagen(mathid, actkey);
cout << "pick one of the keys below for system modeler" << endl;
systemmodelergen(mathid, actkey);
string m;
cout << "Do you want me to activate for you?(type Yes or No)" << endl;
cin >> m;
if (m == "Yes")
{
/*
cout << "Please do the following steps" << endl;
cout << "Step1.Go to program data" << endl;
cout << "Step2.Find something like Wolfram Desktop" << endl;
cout << "Step3.Find Licensing" << endl;
cout << "Step4.If you've registered wolfram desktop you'll find a file called mathpass";
cout << "Step5.If not you need to create one named mathpass " << endl;
cout << "Step6.copy the address of the mathpass" << endl;
*/
cout << "And IMPORTANTLY,MAKEY SURE YOUR MATHID IS GIVEN BY THE PRODUCT!!!" << endl;
cout << "If it's not given by the product,press 0 and exit" << endl;
int question = 1;
cin >> question;
if (question == 0)
{
return 0;
}
cout << "Now,Please enter your product((0 for mathematica) or (1 for wolfram desktop))" << endl;
int product = 0;
cin >> product;
string address = "C://ProgramData/Mathematica/Licensing";
if (product == 0) address = "C://ProgramData/Mathematica/Licensing";
else address = "C://ProgramData/WolframDesktop/Licensing";
if (_access(address.c_str(), 0) == -1)
{
cout << "Sorry your product license file is not found,I'll create the path for you." << endl;
cout << " So you don't need to go to the activation page again." << endl;
_mkdir(address.c_str());
}
ofstream q;
q.open((address+"/mathpass").c_str());
if (q)
{
int magicNumbers[] = { 10690, 12251, 17649, 24816, 33360, 35944, 36412, 42041, 42635, 44011, 53799, 56181, 58536, 59222, 61041 };
for (int i = 0; i < 15; i++)
{
q << "MY_DESKTOP" << " " << mathid << " " << actkey << " " << mmagenwrite2(magicNumbers[i], mathid, actkey) << endl;
}
q.close();
}
else
{
cout << "Wrong address" << endl;
}
}
cout << "Thanks for using,feel free to email [email protected]" << endl;
cout << "press 1 to stop" << endl;
cin >> k;
}