1 Commits
3 changed files with 152 additions and 19 deletions

No files matched your search

+95 -13
View File
@@ -9,10 +9,10 @@ namespace FrappeMocha
public enum LicenseTypes public enum LicenseTypes
{ {
License3270 = 0x8c, LicenseWindows3270 = 0x8c,
License5250 = 0x80, LicenseWindows5250 = 0x80,
License3812 = 0xa0, LicenseWindows3812 = 0xa0,
LicenseTelnet = 0x9b, LicenseWindowsTelnet = 0x9b,
LicenseJava3270 = 0x1e, LicenseJava3270 = 0x1e,
LicenseJava5250 = 0x1e, LicenseJava5250 = 0x1e,
LicenseJavaTelnet = 0x1b, LicenseJavaTelnet = 0x1b,
@@ -21,6 +21,9 @@ namespace FrappeMocha
LicenseMac3812 = 0x22, LicenseMac3812 = 0x22,
LicenseMacTelnet = 0x5e, LicenseMacTelnet = 0x5e,
LicenseMacKeyboard = 0xa5, LicenseMacKeyboard = 0xa5,
LicenseChrome3270 = 0xb3,
LicenseChrome5250 = 0xb2,
LicenseChromeTelnet = 0xb4,
} }
public Keygen() public Keygen()
@@ -33,10 +36,10 @@ namespace FrappeMocha
{ {
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 GenLicenseWindows(type, param_company, license); return GenLicenseWindows(type, param_company, license);
case LicenseTypes.LicenseJavaTelnet: case LicenseTypes.LicenseJavaTelnet:
@@ -52,6 +55,11 @@ namespace FrappeMocha
case LicenseTypes.LicenseMacTelnet: case LicenseTypes.LicenseMacTelnet:
case LicenseTypes.LicenseMacKeyboard: case LicenseTypes.LicenseMacKeyboard:
return GenLicenseMacNum(type, param_company, license); return GenLicenseMacNum(type, param_company, license);
case LicenseTypes.LicenseChrome3270:
case LicenseTypes.LicenseChrome5250:
case LicenseTypes.LicenseChromeTelnet:
return GenLicenseJavascript(type, param_company, license);
} }
return ""; return "";
} }
@@ -180,15 +188,50 @@ namespace FrappeMocha
return param_lickey; 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 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:
@@ -202,10 +245,49 @@ namespace FrappeMocha
case LicenseTypes.LicenseMacTelnet: case LicenseTypes.LicenseMacTelnet:
case LicenseTypes.LicenseMacKeyboard: 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);
} }
return false; 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 * @todo: write some sanity checks
*/ */
@@ -214,6 +296,7 @@ namespace FrappeMocha
return true; return true;
} }
/** /**
* @todo: write some sanity checks * @todo: write some sanity checks
*/ */
@@ -292,6 +375,5 @@ namespace FrappeMocha
} }
} }
} }
} }
} }
+8 -2
View File
@@ -133,7 +133,10 @@
"TN5250 for Mac OS X", "TN5250 for Mac OS X",
"TN3812 for Mac OS X", "TN3812 for Mac OS X",
"Telnet for Mac OS X", "Telnet for Mac OS X",
"Keyboard for Mac OS X"}); "Keyboard for Mac OS X",
"TN3270 for Google Chrome",
"TN5250 for Google Chrome",
"Telnet for Google Chrome"});
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);
@@ -156,12 +159,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();
+49 -4
View File
@@ -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,6 +12,7 @@ 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[1]; private object[] macLicenseTypeItems = new object[1];
private object[] javaLicenseTypeItems = new object[5]; private object[] javaLicenseTypeItems = new object[5];
@@ -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:
@@ -107,6 +109,18 @@ namespace FrappeMocha
case 11: case 11:
this.keygen(Keygen.LicenseTypes.LicenseMacKeyboard); this.keygen(Keygen.LicenseTypes.LicenseMacKeyboard);
break; 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;
} }
} }
@@ -127,6 +141,8 @@ namespace FrappeMocha
{ {
companyusernamelabel.Text = "Name"; companyusernamelabel.Text = "Name";
} }
AcceptButton.PerformClick();
} }
private void keygen(Keygen.LicenseTypes license) private void keygen(Keygen.LicenseTypes license)
@@ -174,6 +190,7 @@ namespace FrappeMocha
case 3: case 3:
case 7: // mac type 1 case 7: // mac type 1
case 8: // mac type 1 case 8: // mac type 1
case 12:
if (windowsLicenseTypeItems[0] != null) if (windowsLicenseTypeItems[0] != null)
{ {
TypeDropDown.Items.Clear(); TypeDropDown.Items.Clear();
@@ -195,11 +212,39 @@ namespace FrappeMocha
break; break;
} }
TypeDropDown.SelectedIndex = 0; TypeDropDown.SelectedIndex = 0;
AcceptButton.PerformClick();
} }
private void licensebox_Click(object sender, EventArgs e) private void licensebox_Click(object sender, EventArgs e)
{ {
licensebox.SelectAll(); 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;
}
}
}
} }
} }