Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a2ab0d873 | ||
|
|
f77ce971d8 | ||
|
|
36e21bd944 | ||
|
|
7186cfe151 |
No files matched your search
@@ -9,15 +9,26 @@ namespace FrappeMocha
|
|||||||
|
|
||||||
public enum LicenseTypes
|
public enum LicenseTypes
|
||||||
{
|
{
|
||||||
License3270 = 140,
|
LicenseWindows3270 = 0x8c,
|
||||||
License5250 = 128,
|
LicenseWindows5250 = 0x80,
|
||||||
License3812 = 160,
|
LicenseWindows3812 = 0xa0,
|
||||||
LicenseTelnet = 155,
|
LicenseWindowsTelnet = 0x9b,
|
||||||
LicenseJava3270 = 30,
|
LicenseJava3270 = 0x1e,
|
||||||
LicenseJava5250 = 30,
|
LicenseJava5250 = 0x1e,
|
||||||
LicenseJavaTelnet = 0x1b,
|
LicenseJavaTelnet = 0x1b,
|
||||||
LicenseMac3270 = 0x5d,
|
LicenseMac3270 = 0x5d,
|
||||||
LicenseMac5250 = 0x16,
|
LicenseMac5250 = 0x16,
|
||||||
|
LicenseMac3812 = 0x22,
|
||||||
|
LicenseMacTelnet = 0x5e,
|
||||||
|
LicenseMacKeyboard = 0xa5,
|
||||||
|
LicenseChrome3270 = 0xb3,
|
||||||
|
LicenseChrome5250 = 0xb2,
|
||||||
|
LicenseChromeTelnet = 0xb4,
|
||||||
|
LicenseAndroid3270 = 0x94,
|
||||||
|
LicenseAndroid5250 = 0x91,
|
||||||
|
LicenseAndroidTelnet = 0x96,
|
||||||
|
LicenseAndroidVnc = 0x92,
|
||||||
|
LicenseAndroidBarcode = 0x9c,
|
||||||
}
|
}
|
||||||
|
|
||||||
public Keygen()
|
public Keygen()
|
||||||
@@ -25,33 +36,370 @@ namespace FrappeMocha
|
|||||||
this.param_encoding = 0;
|
this.param_encoding = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public string GenLicense(int type, string param_company, LicenseTypes license)
|
||||||
|
{
|
||||||
|
switch (license)
|
||||||
|
{
|
||||||
|
case LicenseTypes.LicenseWindows3270:
|
||||||
|
case LicenseTypes.LicenseWindows3812:
|
||||||
|
case LicenseTypes.LicenseWindows5250:
|
||||||
|
case LicenseTypes.LicenseWindowsTelnet:
|
||||||
|
return GenLicenseWindows(type, param_company, license);
|
||||||
|
|
||||||
|
case LicenseTypes.LicenseJavaTelnet:
|
||||||
|
case LicenseTypes.LicenseJava3270:
|
||||||
|
// case LicenseTypes.LicenseJava5250:
|
||||||
|
return GenLicenseJava(type, param_company, license);
|
||||||
|
|
||||||
|
case LicenseTypes.LicenseMac3270:
|
||||||
|
case LicenseTypes.LicenseMac5250:
|
||||||
|
return GenLicenseMacAlpha(type, param_company, license);
|
||||||
|
|
||||||
|
case LicenseTypes.LicenseMac3812:
|
||||||
|
case LicenseTypes.LicenseMacTelnet:
|
||||||
|
case LicenseTypes.LicenseMacKeyboard:
|
||||||
|
return GenLicenseMacNum(type, param_company, license);
|
||||||
|
|
||||||
|
case LicenseTypes.LicenseChrome3270:
|
||||||
|
case LicenseTypes.LicenseChrome5250:
|
||||||
|
case LicenseTypes.LicenseChromeTelnet:
|
||||||
|
return GenLicenseJavascript(type, param_company, license);
|
||||||
|
|
||||||
|
case LicenseTypes.LicenseAndroid3270:
|
||||||
|
case LicenseTypes.LicenseAndroid5250:
|
||||||
|
case LicenseTypes.LicenseAndroidTelnet:
|
||||||
|
case LicenseTypes.LicenseAndroidVnc:
|
||||||
|
case LicenseTypes.LicenseAndroidBarcode:
|
||||||
|
return GenLicenseAndroid(type, param_company, license);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By far the easiest implemntation, everything was already in .NET :P
|
||||||
|
*/
|
||||||
|
public string GenLicenseWindows(int type, string param_company, LicenseTypes license)
|
||||||
|
{
|
||||||
|
string param_lickey = type.ToString();
|
||||||
|
uint num1 = 0;
|
||||||
|
byte[] byteArray = this.StrToByteArray(param_company);
|
||||||
|
for (int index = 0; index < byteArray.Length; ++index)
|
||||||
|
{
|
||||||
|
if ((int) byteArray[index] >= 65 && (int) byteArray[index] <= 90)
|
||||||
|
byteArray[index] += (byte) 32; // this is basically str.toLower()
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int index = 0; index < byteArray.Length; ++index)
|
||||||
|
{
|
||||||
|
if ((int) byteArray[index] >= 65) // 'A'
|
||||||
|
num1 += (uint) byteArray[index] + (uint) license;
|
||||||
|
}
|
||||||
|
uint num2 = num1 * (uint) param_lickey[0];
|
||||||
|
uint num3 = (uint) ((int) num2 * ((int) num2 & (int) byte.MaxValue) & (int) ushort.MaxValue);
|
||||||
|
if (num3 < 100U)
|
||||||
|
num3 = 2728U;
|
||||||
|
|
||||||
|
param_lickey = (param_lickey[0].ToString() + (object) num3) + '-' +
|
||||||
|
(Int32) (DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
||||||
|
|
||||||
|
|
||||||
|
return param_lickey;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pretty stright forward implementation as well
|
||||||
|
* .NET is just a copy of Java afterall
|
||||||
|
*/
|
||||||
|
public string GenLicenseJava(int itype, string param_company, LicenseTypes license)
|
||||||
|
{
|
||||||
|
char type = (char) (itype + (int) 'A');
|
||||||
|
string param_lickey = type.ToString() + '@';
|
||||||
|
byte[] byteArray = this.StrToByteArray(param_company);
|
||||||
|
uint num1 = 0;
|
||||||
|
|
||||||
|
for (int b = 0; b < byteArray.Length; b++)
|
||||||
|
{
|
||||||
|
if (param_company.ToCharArray()[b] > ' ')
|
||||||
|
num1 += param_company.ToCharArray()[b] + (uint) license;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint num2 = num1 * (uint) param_lickey[0];
|
||||||
|
uint num3 = (uint) ((int) num2 * ((int) num2 & (int) byte.MaxValue) & (int) ushort.MaxValue);
|
||||||
|
param_lickey += (object) num3;
|
||||||
|
return param_lickey;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now the fun stuff..
|
||||||
|
*
|
||||||
|
* Beware! the Mac versions rely on datatype truncation
|
||||||
|
* It's a real pain in the ass to make sure the datatypes are all accurate
|
||||||
|
*/
|
||||||
|
public string GenLicenseMacAlpha(int itype, string param_company, LicenseTypes license)
|
||||||
|
{
|
||||||
|
// must start with an 'a' or 'b;
|
||||||
|
char type = (char) (itype + (int) 'a');
|
||||||
|
string param_lickey = type.ToString();
|
||||||
|
byte[] byteArray = this.StrToByteArray(param_company);
|
||||||
|
short num1 = 0;
|
||||||
|
|
||||||
|
for (int b = 0; b < byteArray.Length; b++)
|
||||||
|
{
|
||||||
|
if (param_company.ToCharArray()[b] >= 0x21)
|
||||||
|
num1 += (short) (param_company.ToCharArray()[b] + license);
|
||||||
|
}
|
||||||
|
|
||||||
|
ushort num2 = (ushort) (num1 * (short) param_lickey[0]);
|
||||||
|
param_lickey += (ushort) ((num2 & byte.MaxValue) * num2);
|
||||||
|
return param_lickey;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Beware! the Mac versions rely on datatype truncation
|
||||||
|
* It's a real pain in the ass to make sure the datatypes are all accurate
|
||||||
|
*
|
||||||
|
* There's a special case for the MacKeyboard as it deviates from the rest of the algoritm
|
||||||
|
* The (byte) cast is extmely important
|
||||||
|
*/
|
||||||
|
public string GenLicenseMacNum(int itype, string param_company, LicenseTypes license)
|
||||||
|
{
|
||||||
|
char type = (char) (itype + (int) '0');
|
||||||
|
string param_lickey = type.ToString();
|
||||||
|
uint num1 = 0;
|
||||||
|
byte[] byteArray = this.StrToByteArray(param_company);
|
||||||
|
for (int index = 0; index < byteArray.Length; ++index)
|
||||||
|
{
|
||||||
|
if (license == LicenseTypes.LicenseMacKeyboard && (byte) (byteArray[index] + 0xbf) < 0x1a)
|
||||||
|
{
|
||||||
|
byteArray[index] += 32;
|
||||||
|
}
|
||||||
|
else if (license != LicenseTypes.LicenseMacKeyboard && byteArray[index] + 0xbf < 0x1a)
|
||||||
|
{
|
||||||
|
byteArray[index] += 32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int index = 0; index < byteArray.Length; ++index)
|
||||||
|
{
|
||||||
|
if ((int) byteArray[index] >= 0x41) // 'A'
|
||||||
|
num1 += (uint) byteArray[index] + (uint) license;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint num2 = (uint) (num1 * (int) param_lickey[0]);
|
||||||
|
num2 = (uint) (num2 * (num2 & byte.MaxValue) & ushort.MaxValue);
|
||||||
|
ulong num3 = 0xaa8;
|
||||||
|
if (99 < num2)
|
||||||
|
{
|
||||||
|
num3 = (ulong) num2;
|
||||||
|
}
|
||||||
|
|
||||||
|
param_lickey = param_lickey[0].ToString() + (object) num3;
|
||||||
|
|
||||||
|
|
||||||
|
return param_lickey;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This one was fun as well
|
||||||
|
* Found out that the license must end with "45" in order to validate
|
||||||
|
*/
|
||||||
|
public string GenLicenseJavascript(int itype, string param_company, LicenseTypes license)
|
||||||
|
{
|
||||||
|
char type = (char) (itype + (int) '0');
|
||||||
|
string param_lickey = type.ToString();
|
||||||
|
ulong sum = 0;
|
||||||
|
byte[] byteArray = this.StrToByteArray(param_company);
|
||||||
|
for (int index = 0; index < byteArray.Length; ++index)
|
||||||
|
{
|
||||||
|
if ((ulong) byteArray[index] >= 65 && (ulong) byteArray[index] <= 90)
|
||||||
|
byteArray[index] += 32; // this is basically str.toLower()
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int index = 0; index < byteArray.Length; ++index)
|
||||||
|
{
|
||||||
|
if ((ulong) byteArray[index] >= 65 && (ulong) byteArray[index] <= 122)
|
||||||
|
{
|
||||||
|
sum += byteArray[index] + (uint) license;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sum = sum * param_lickey[0];
|
||||||
|
sum = sum * (sum & byte.MaxValue) & ushort.MaxValue;
|
||||||
|
if (sum < 100U)
|
||||||
|
sum = 2728U;
|
||||||
|
|
||||||
|
param_lickey = (param_lickey[0].ToString() + (object) sum) + '-' +
|
||||||
|
(Int32) (DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds
|
||||||
|
+ "45"; // a little salt, as a treat
|
||||||
|
|
||||||
|
return param_lickey;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public string GenLicenseAndroid(int itype, string param_company, LicenseTypes license)
|
||||||
|
{
|
||||||
|
char type = (char) (itype + (int) '0');
|
||||||
|
string param_lickey = type.ToString();
|
||||||
|
long sum = 0;
|
||||||
|
byte[] byteArray = this.StrToByteArray(param_company);
|
||||||
|
for (int index = 0; index < byteArray.Length; ++index)
|
||||||
|
{
|
||||||
|
if ((long) byteArray[index] >= 65 && (long) byteArray[index] <= 90)
|
||||||
|
byteArray[index] += 32; // this is basically str.toLower()
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int index = 0; index < byteArray.Length; ++index)
|
||||||
|
{
|
||||||
|
if ((ulong) byteArray[index] >= 65 && (ulong) byteArray[index] <= 122)
|
||||||
|
{
|
||||||
|
sum += byteArray[index] + (uint) license;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sum = sum * param_lickey[0];
|
||||||
|
sum = sum * (sum & byte.MaxValue) & ushort.MaxValue;
|
||||||
|
if (sum < 100U)
|
||||||
|
sum = 2728U;
|
||||||
|
|
||||||
|
param_lickey = (param_lickey[0].ToString() + (object) sum) + '-' +
|
||||||
|
(Int32) (DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
||||||
|
|
||||||
|
return param_lickey;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool CheckLicense(string param_lickey, string param_company, LicenseTypes license)
|
public bool CheckLicense(string param_lickey, string param_company, LicenseTypes license)
|
||||||
{
|
{
|
||||||
switch (license)
|
switch (license)
|
||||||
{
|
{
|
||||||
case LicenseTypes.License3270:
|
case LicenseTypes.LicenseWindows3270:
|
||||||
case LicenseTypes.License3812:
|
case LicenseTypes.LicenseWindows3812:
|
||||||
case LicenseTypes.License5250:
|
case LicenseTypes.LicenseWindows5250:
|
||||||
case LicenseTypes.LicenseTelnet:
|
case LicenseTypes.LicenseWindowsTelnet:
|
||||||
return CheckLicenseWindows(param_lickey, param_company, license);
|
return CheckLicenseWindows(param_lickey, param_company, license);
|
||||||
|
|
||||||
case LicenseTypes.LicenseJavaTelnet:
|
case LicenseTypes.LicenseJavaTelnet:
|
||||||
case LicenseTypes.LicenseJava3270:
|
case LicenseTypes.LicenseJava3270:
|
||||||
// case LicenseTypes.LicenseJava5250:
|
// case LicenseTypes.LicenseJava5250:
|
||||||
return CheckLicenseJava(param_lickey, param_company, license);
|
return CheckLicenseJava(param_lickey, param_company, license);
|
||||||
|
|
||||||
case LicenseTypes.LicenseMac3270:
|
case LicenseTypes.LicenseMac3270:
|
||||||
case LicenseTypes.LicenseMac5250:
|
case LicenseTypes.LicenseMac5250:
|
||||||
|
case LicenseTypes.LicenseMac3812:
|
||||||
|
case LicenseTypes.LicenseMacTelnet:
|
||||||
|
case LicenseTypes.LicenseMacKeyboard:
|
||||||
return CheckLicenseMac(param_lickey, param_company, license);
|
return CheckLicenseMac(param_lickey, param_company, license);
|
||||||
|
|
||||||
|
case LicenseTypes.LicenseChrome3270:
|
||||||
|
case LicenseTypes.LicenseChrome5250:
|
||||||
|
case LicenseTypes.LicenseChromeTelnet:
|
||||||
|
return CheckLicenseJavaScript(param_lickey, param_company, license);
|
||||||
|
|
||||||
|
case LicenseTypes.LicenseAndroid3270:
|
||||||
|
case LicenseTypes.LicenseAndroid5250:
|
||||||
|
case LicenseTypes.LicenseAndroidTelnet:
|
||||||
|
case LicenseTypes.LicenseAndroidVnc:
|
||||||
|
case LicenseTypes.LicenseAndroidBarcode:
|
||||||
|
return CheckLicenseAndroid(param_lickey, param_company, license);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @todo: write some sanity checks
|
||||||
|
*/
|
||||||
|
public bool CheckLicenseAndroid(string param_lickey, string param_company, LicenseTypes license)
|
||||||
|
{
|
||||||
|
byte[] bArr = new byte[255];
|
||||||
|
byte[] bArr2 = new byte[255];
|
||||||
|
if (param_company.Length < 2 || param_lickey.Length < 2)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < param_lickey.Length; i++)
|
||||||
|
{
|
||||||
|
bArr2[i] = (byte) param_lickey[i];
|
||||||
|
}
|
||||||
|
for (int i2 = 0; i2 < param_company.Length; i2++)
|
||||||
|
{
|
||||||
|
bArr[i2] = (byte) param_company[i2];
|
||||||
|
if (param_company[i2] >= 'A' && param_company[i2] <= 'Z')
|
||||||
|
{
|
||||||
|
bArr[i2] = (byte) (bArr[i2] + 32);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
long j = 0;
|
||||||
|
for (int i3 = 0; i3 < param_company.Length; i3++)
|
||||||
|
{
|
||||||
|
if (bArr[i3] >= 65 && bArr[i3] <= 122)
|
||||||
|
{
|
||||||
|
j += (bArr[i3] + (long) license);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
long j2 = j * bArr2[0];
|
||||||
|
long j3 = (j2 * (j2 & 255)) & 65535;
|
||||||
|
if (j3 < 100)
|
||||||
|
{
|
||||||
|
j3 = 2728;
|
||||||
|
}
|
||||||
|
string sb = "";
|
||||||
|
sb += param_lickey[0];
|
||||||
|
sb += (object) j3;
|
||||||
|
if (param_lickey.StartsWith(sb))
|
||||||
|
{
|
||||||
|
// lictype = bArr2[0] - 48;
|
||||||
|
// is_lite2 = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// lictype = -1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All Javascript licenses need to end with "45" in order to validate
|
||||||
|
*/
|
||||||
|
public bool CheckLicenseJavaScript(string param_lickey, string param_company, LicenseTypes license)
|
||||||
|
{
|
||||||
|
ulong sum = 0;
|
||||||
|
byte[] byteArray = this.StrToByteArray(param_company);
|
||||||
|
for (int index = 0; index < byteArray.Length; ++index)
|
||||||
|
{
|
||||||
|
if ((ulong) byteArray[index] >= 65 && (ulong) byteArray[index] <= 90)
|
||||||
|
byteArray[index] += 32; // this is basically str.toLower()
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int index = 0; index < byteArray.Length; ++index)
|
||||||
|
{
|
||||||
|
if ((ulong) byteArray[index] >= 65 && (ulong) byteArray[index] <= 122)
|
||||||
|
{
|
||||||
|
sum += byteArray[index] + (uint) license;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sum = sum * param_lickey[0];
|
||||||
|
sum = sum * (sum & byte.MaxValue) & ushort.MaxValue;
|
||||||
|
if (sum < 100U)
|
||||||
|
sum = 2728U;
|
||||||
|
|
||||||
|
if (!param_lickey.StartsWith(param_lickey[0].ToString() + (object) sum) || !param_lickey.EndsWith("45"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @todo: write some sanity checks
|
||||||
|
*/
|
||||||
public bool CheckLicenseJava(string param_lickey, string param_company, LicenseTypes license)
|
public bool CheckLicenseJava(string param_lickey, string param_company, LicenseTypes license)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @todo: write some sanity checks
|
||||||
|
*/
|
||||||
public bool CheckLicenseMac(string param_lickey, string param_company, LicenseTypes license)
|
public bool CheckLicenseMac(string param_lickey, string param_company, LicenseTypes license)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -68,20 +416,20 @@ namespace FrappeMocha
|
|||||||
for (int index = 0; index < byteArray.Length; ++index)
|
for (int index = 0; index < byteArray.Length; ++index)
|
||||||
{
|
{
|
||||||
// >= 'A' && <= 'Z'
|
// >= 'A' && <= 'Z'
|
||||||
if ((int)byteArray[index] >= 65 && (int)byteArray[index] <= 90)
|
if ((int) byteArray[index] >= 65 && (int) byteArray[index] <= 90)
|
||||||
byteArray[index] += (byte)32;
|
byteArray[index] += (byte) 32;
|
||||||
}
|
}
|
||||||
for (int index = 0; index < byteArray.Length; ++index)
|
for (int index = 0; index < byteArray.Length; ++index)
|
||||||
{
|
{
|
||||||
if ((int)byteArray[index] >= 65) // 'A'
|
if ((int) byteArray[index] >= 65) // 'A'
|
||||||
num1 += (uint)byteArray[index] + (uint)license;
|
num1 += (uint) byteArray[index] + (uint) license;
|
||||||
}
|
}
|
||||||
uint num2 = num1 * (uint)param_lickey[0];
|
uint num2 = num1 * (uint) param_lickey[0];
|
||||||
uint num3 = (uint)((int)num2 * ((int)num2 & (int)byte.MaxValue) & (int)ushort.MaxValue);
|
uint num3 = (uint) ((int) num2 * ((int) num2 & (int) byte.MaxValue) & (int) ushort.MaxValue);
|
||||||
if (num3 < 100U)
|
if (num3 < 100U)
|
||||||
num3 = 2728U;
|
num3 = 2728U;
|
||||||
|
|
||||||
if (param_lickey.StartsWith((param_lickey[0].ToString() ?? "") + (object)num3))
|
if (param_lickey.StartsWith((param_lickey[0].ToString() ?? "") + (object) num3))
|
||||||
{
|
{
|
||||||
//this.aa = param_lickey.Substring(0, 1);
|
//this.aa = param_lickey.Substring(0, 1);
|
||||||
return true;
|
return true;
|
||||||
@@ -90,94 +438,6 @@ namespace FrappeMocha
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GenLicense(int type, string param_company, LicenseTypes license)
|
|
||||||
{
|
|
||||||
switch (license)
|
|
||||||
{
|
|
||||||
case LicenseTypes.License3270:
|
|
||||||
case LicenseTypes.License3812:
|
|
||||||
case LicenseTypes.License5250:
|
|
||||||
case LicenseTypes.LicenseTelnet:
|
|
||||||
return GenLicenseWindows(type, param_company, license);
|
|
||||||
|
|
||||||
case LicenseTypes.LicenseJavaTelnet:
|
|
||||||
case LicenseTypes.LicenseJava3270:
|
|
||||||
// case LicenseTypes.LicenseJava5250:
|
|
||||||
return GenLicenseJava(type, param_company, license);
|
|
||||||
|
|
||||||
case LicenseTypes.LicenseMac3270:
|
|
||||||
case LicenseTypes.LicenseMac5250:
|
|
||||||
return GenLicenseMac(type, param_company, license);
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GenLicenseWindows(int type, string param_company, LicenseTypes license)
|
|
||||||
{
|
|
||||||
string param_lickey = type.ToString();
|
|
||||||
uint num1 = 0;
|
|
||||||
byte[] byteArray = this.StrToByteArray(param_company);
|
|
||||||
for (int index = 0; index < byteArray.Length; ++index)
|
|
||||||
{
|
|
||||||
if ((int)byteArray[index] >= 65 && (int)byteArray[index] <= 90)
|
|
||||||
byteArray[index] += (byte)32; // this is basically str.toLower()
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int index = 0; index < byteArray.Length; ++index)
|
|
||||||
{
|
|
||||||
if ((int)byteArray[index] >= 65) // 'A'
|
|
||||||
num1 += (uint)byteArray[index] + (uint)license;
|
|
||||||
}
|
|
||||||
uint num2 = num1 * (uint)param_lickey[0];
|
|
||||||
uint num3 = (uint)((int)num2 * ((int)num2 & (int)byte.MaxValue) & (int)ushort.MaxValue);
|
|
||||||
if (num3 < 100U)
|
|
||||||
num3 = 2728U;
|
|
||||||
|
|
||||||
param_lickey = ((param_lickey[0].ToString() ?? "") + (object)num3) + '-' +
|
|
||||||
(Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
|
||||||
|
|
||||||
|
|
||||||
return param_lickey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GenLicenseJava(int itype, string param_company, LicenseTypes license)
|
|
||||||
{
|
|
||||||
char type = (char)(itype + (int)'A');
|
|
||||||
string param_lickey = type.ToString() + '@';
|
|
||||||
byte[] byteArray = this.StrToByteArray(param_company);
|
|
||||||
uint num1 = 0;
|
|
||||||
|
|
||||||
for (int b = 0; b < byteArray.Length; b++)
|
|
||||||
{
|
|
||||||
if (param_company.ToCharArray()[b] > ' ')
|
|
||||||
num1 += param_company.ToCharArray()[b] + (uint)license;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint num2 = num1 * (uint)param_lickey[0];
|
|
||||||
uint num3 = (uint)((int)num2 * ((int)num2 & (int)byte.MaxValue) & (int)ushort.MaxValue);
|
|
||||||
param_lickey += (object) num3;
|
|
||||||
return param_lickey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GenLicenseMac(int itype, string param_company, LicenseTypes license)
|
|
||||||
{
|
|
||||||
char type = (char)(itype + (int)'a');
|
|
||||||
string param_lickey = type.ToString() + '@';
|
|
||||||
byte[] byteArray = this.StrToByteArray(param_company);
|
|
||||||
uint num1 = 0;
|
|
||||||
|
|
||||||
for (int b = 0; b < byteArray.Length; b++)
|
|
||||||
{
|
|
||||||
if (param_company.ToCharArray()[b] > ' ')
|
|
||||||
num1 += param_company.ToCharArray()[b] + (uint)license;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint num2 = num1 * (uint)param_lickey[0];
|
|
||||||
uint num3 = (uint)((int)num2 * ((int)num2 & (int)byte.MaxValue) & (int)ushort.MaxValue);
|
|
||||||
param_lickey += (object)num3;
|
|
||||||
return param_lickey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] StrToByteArray(string str)
|
public byte[] StrToByteArray(string str)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -192,7 +452,7 @@ namespace FrappeMocha
|
|||||||
}
|
}
|
||||||
catch (Exception ex2)
|
catch (Exception ex2)
|
||||||
{
|
{
|
||||||
return new byte[1] { (byte)63 };
|
return new byte[1] {(byte) 63};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,6 +475,5 @@ namespace FrappeMocha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Generated
+18
-3
@@ -56,7 +56,7 @@
|
|||||||
// companytext
|
// companytext
|
||||||
//
|
//
|
||||||
this.companytext.Location = new System.Drawing.Point(12, 105);
|
this.companytext.Location = new System.Drawing.Point(12, 105);
|
||||||
this.companytext.MaxLength = 512;
|
this.companytext.MaxLength = 80;
|
||||||
this.companytext.Name = "companytext";
|
this.companytext.Name = "companytext";
|
||||||
this.companytext.Size = new System.Drawing.Size(146, 20);
|
this.companytext.Size = new System.Drawing.Size(146, 20);
|
||||||
this.companytext.TabIndex = 1;
|
this.companytext.TabIndex = 1;
|
||||||
@@ -96,6 +96,7 @@
|
|||||||
this.licensebox.ReadOnly = true;
|
this.licensebox.ReadOnly = true;
|
||||||
this.licensebox.Size = new System.Drawing.Size(146, 20);
|
this.licensebox.Size = new System.Drawing.Size(146, 20);
|
||||||
this.licensebox.TabIndex = 5;
|
this.licensebox.TabIndex = 5;
|
||||||
|
this.licensebox.Click += new System.EventHandler(this.licensebox_Click);
|
||||||
//
|
//
|
||||||
// submit
|
// submit
|
||||||
//
|
//
|
||||||
@@ -129,7 +130,18 @@
|
|||||||
"TN5250 for Java",
|
"TN5250 for Java",
|
||||||
"Telnet for Java",
|
"Telnet for Java",
|
||||||
"TN3270 for Mac OS X",
|
"TN3270 for Mac OS X",
|
||||||
"TN5250 for Mac OS X"});
|
"TN5250 for Mac OS X",
|
||||||
|
"TN3812 for Mac OS X",
|
||||||
|
"Telnet for Mac OS X",
|
||||||
|
"Keyboard for Mac OS X",
|
||||||
|
"TN3270 for Google Chrome",
|
||||||
|
"TN5250 for Google Chrome",
|
||||||
|
"Telnet for Google Chrome",
|
||||||
|
"TN3270 for Android",
|
||||||
|
"TN5250 for Android",
|
||||||
|
"Telnet for Android",
|
||||||
|
"VNC for Android",
|
||||||
|
"Barcode for Android"});
|
||||||
this.productSelect.Location = new System.Drawing.Point(12, 25);
|
this.productSelect.Location = new System.Drawing.Point(12, 25);
|
||||||
this.productSelect.Name = "productSelect";
|
this.productSelect.Name = "productSelect";
|
||||||
this.productSelect.Size = new System.Drawing.Size(146, 21);
|
this.productSelect.Size = new System.Drawing.Size(146, 21);
|
||||||
@@ -152,12 +164,15 @@
|
|||||||
this.Controls.Add(this.label1);
|
this.Controls.Add(this.label1);
|
||||||
this.Controls.Add(this.companytext);
|
this.Controls.Add(this.companytext);
|
||||||
this.Controls.Add(this.TypeDropDown);
|
this.Controls.Add(this.TypeDropDown);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
|
this.KeyPreview = true;
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "MainForm";
|
this.Name = "MainForm";
|
||||||
this.Text = "FrappeMocha";
|
this.Text = "FrappeMocha";
|
||||||
|
this.Shown += new System.EventHandler(this.MainForm_Shown);
|
||||||
|
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.MainForm_KeyPress);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
|
|||||||
+107
-11
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
@@ -11,8 +12,9 @@ namespace FrappeMocha
|
|||||||
public partial class MainForm : Form
|
public partial class MainForm : Form
|
||||||
{
|
{
|
||||||
protected Keygen frappeKeygen;
|
protected Keygen frappeKeygen;
|
||||||
|
private char[] ficus = new char[6];
|
||||||
private object[] windowsLicenseTypeItems = new object[2];
|
private object[] windowsLicenseTypeItems = new object[2];
|
||||||
private object[] macLicenseTypeItems = new object[2];
|
private object[] macLicenseTypeItems = new object[1];
|
||||||
private object[] javaLicenseTypeItems = new object[5];
|
private object[] javaLicenseTypeItems = new object[5];
|
||||||
|
|
||||||
public MainForm()
|
public MainForm()
|
||||||
@@ -49,9 +51,9 @@ namespace FrappeMocha
|
|||||||
private void initMacLicenseTypeItems()
|
private void initMacLicenseTypeItems()
|
||||||
{
|
{
|
||||||
TypeDropDown.Items.Clear();
|
TypeDropDown.Items.Clear();
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 1; i++)
|
||||||
{
|
{
|
||||||
TypeDropDown.Items.Add((char)('a' + i));
|
TypeDropDown.Items.Add((char) ('0' + i));
|
||||||
}
|
}
|
||||||
TypeDropDown.Items.CopyTo(this.macLicenseTypeItems, 0);
|
TypeDropDown.Items.CopyTo(this.macLicenseTypeItems, 0);
|
||||||
}
|
}
|
||||||
@@ -61,19 +63,19 @@ namespace FrappeMocha
|
|||||||
switch (productSelect.SelectedIndex)
|
switch (productSelect.SelectedIndex)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
this.keygen(Keygen.LicenseTypes.License3270);
|
this.keygen(Keygen.LicenseTypes.LicenseWindows3270);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
this.keygen(Keygen.LicenseTypes.License5250);
|
this.keygen(Keygen.LicenseTypes.LicenseWindows5250);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
this.keygen(Keygen.LicenseTypes.License3812);
|
this.keygen(Keygen.LicenseTypes.LicenseWindows3812);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
this.keygen(Keygen.LicenseTypes.LicenseTelnet);
|
this.keygen(Keygen.LicenseTypes.LicenseWindowsTelnet);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
@@ -95,6 +97,50 @@ namespace FrappeMocha
|
|||||||
case 8:
|
case 8:
|
||||||
this.keygen(Keygen.LicenseTypes.LicenseMac5250);
|
this.keygen(Keygen.LicenseTypes.LicenseMac5250);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
this.keygen(Keygen.LicenseTypes.LicenseMac3812);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
this.keygen(Keygen.LicenseTypes.LicenseMacTelnet);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 11:
|
||||||
|
this.keygen(Keygen.LicenseTypes.LicenseMacKeyboard);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 12:
|
||||||
|
this.keygen(Keygen.LicenseTypes.LicenseChrome3270);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 13:
|
||||||
|
this.keygen(Keygen.LicenseTypes.LicenseChrome5250);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 14:
|
||||||
|
this.keygen(Keygen.LicenseTypes.LicenseChromeTelnet);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 15:
|
||||||
|
this.keygen(Keygen.LicenseTypes.LicenseAndroid3270);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
this.keygen(Keygen.LicenseTypes.LicenseAndroid5250);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 17:
|
||||||
|
this.keygen(Keygen.LicenseTypes.LicenseAndroidTelnet);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 18:
|
||||||
|
this.keygen(Keygen.LicenseTypes.LicenseAndroidVnc);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 19:
|
||||||
|
this.keygen(Keygen.LicenseTypes.LicenseAndroidBarcode);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +161,8 @@ namespace FrappeMocha
|
|||||||
{
|
{
|
||||||
companyusernamelabel.Text = "Name";
|
companyusernamelabel.Text = "Name";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AcceptButton.PerformClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void keygen(Keygen.LicenseTypes license)
|
private void keygen(Keygen.LicenseTypes license)
|
||||||
@@ -129,6 +177,16 @@ namespace FrappeMocha
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (companytext.Text.Length > 80)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
(TypeDropDown.SelectedIndex == 0
|
||||||
|
? "Company Name"
|
||||||
|
: "User Name") + " must not be greater than eighty characters", "Error",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string genlicense = frappeKeygen.GenLicense(TypeDropDown.SelectedIndex, companytext.Text, license);
|
string genlicense = frappeKeygen.GenLicense(TypeDropDown.SelectedIndex, companytext.Text, license);
|
||||||
if (!frappeKeygen.CheckLicense(genlicense, companytext.Text, license))
|
if (!frappeKeygen.CheckLicense(genlicense, companytext.Text, license))
|
||||||
{
|
{
|
||||||
@@ -150,7 +208,10 @@ namespace FrappeMocha
|
|||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
if (this.windowsLicenseTypeItems[0] != null)
|
case 7: // mac type 1
|
||||||
|
case 8: // mac type 1
|
||||||
|
case 12:
|
||||||
|
if (windowsLicenseTypeItems[0] != null)
|
||||||
{
|
{
|
||||||
TypeDropDown.Items.Clear();
|
TypeDropDown.Items.Clear();
|
||||||
TypeDropDown.Items.AddRange(this.windowsLicenseTypeItems);
|
TypeDropDown.Items.AddRange(this.windowsLicenseTypeItems);
|
||||||
@@ -163,13 +224,48 @@ namespace FrappeMocha
|
|||||||
TypeDropDown.Items.AddRange(this.javaLicenseTypeItems);
|
TypeDropDown.Items.AddRange(this.javaLicenseTypeItems);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 9: // mac type 2
|
||||||
case 8:
|
case 10:
|
||||||
|
case 11:
|
||||||
TypeDropDown.Items.Clear();
|
TypeDropDown.Items.Clear();
|
||||||
TypeDropDown.Items.AddRange(this.macLicenseTypeItems);
|
TypeDropDown.Items.AddRange(this.macLicenseTypeItems);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TypeDropDown.SelectedIndex = 0;
|
TypeDropDown.SelectedIndex = 0;
|
||||||
|
AcceptButton.PerformClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void licensebox_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
licensebox.SelectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MainForm_Shown(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AcceptButton.PerformClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MainForm_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
Array.Copy(this.ficus, 1, this.ficus, 0, this.ficus.Length - 1);
|
||||||
|
this.ficus[ficus.Length - 1] = e.KeyChar;
|
||||||
|
if (new string(ficus) == "spicey")
|
||||||
|
{
|
||||||
|
switch (MessageBox.Show("Would you like a little salt, as a treat?", "Orly?",
|
||||||
|
MessageBoxButtons.YesNoCancel,
|
||||||
|
MessageBoxIcon.Question))
|
||||||
|
{
|
||||||
|
case DialogResult.Yes:
|
||||||
|
Process.Start("https://i.imgur.com/EJ31bmk.jpg");
|
||||||
|
break;
|
||||||
|
case DialogResult.No:
|
||||||
|
Process.Start(
|
||||||
|
"https://pics.me.me/white-people-cant-handle-spicy-food-um-try-again-sweetie-6626438.png");
|
||||||
|
break;
|
||||||
|
case DialogResult.Cancel:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user