Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a2ab0d873 | ||
|
|
f77ce971d8 |
No files matched your search
@@ -24,6 +24,11 @@ namespace FrappeMocha
|
||||
LicenseChrome3270 = 0xb3,
|
||||
LicenseChrome5250 = 0xb2,
|
||||
LicenseChromeTelnet = 0xb4,
|
||||
LicenseAndroid3270 = 0x94,
|
||||
LicenseAndroid5250 = 0x91,
|
||||
LicenseAndroidTelnet = 0x96,
|
||||
LicenseAndroidVnc = 0x92,
|
||||
LicenseAndroidBarcode = 0x9c,
|
||||
}
|
||||
|
||||
public Keygen()
|
||||
@@ -60,6 +65,13 @@ namespace FrappeMocha
|
||||
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 "";
|
||||
}
|
||||
@@ -224,6 +236,37 @@ namespace FrappeMocha
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
switch (license)
|
||||
@@ -250,10 +293,67 @@ namespace FrappeMocha
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
Generated
+6
-1
@@ -136,7 +136,12 @@
|
||||
"Keyboard for Mac OS X",
|
||||
"TN3270 for Google Chrome",
|
||||
"TN5250 for Google Chrome",
|
||||
"Telnet 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.Name = "productSelect";
|
||||
this.productSelect.Size = new System.Drawing.Size(146, 21);
|
||||
|
||||
+25
-4
@@ -121,6 +121,26 @@ namespace FrappeMocha
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,11 +247,12 @@ namespace FrappeMocha
|
||||
|
||||
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")
|
||||
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,
|
||||
switch (MessageBox.Show("Would you like a little salt, as a treat?", "Orly?",
|
||||
MessageBoxButtons.YesNoCancel,
|
||||
MessageBoxIcon.Question))
|
||||
{
|
||||
case DialogResult.Yes:
|
||||
|
||||
Reference in new issue
Block a user