Initial release, all features working as expected

This commit is contained in:
Neo Anderson committed 2020-04-02 06:25:41 -07:00
1 parent a8f9bfce2e
commit ebe606f4cf
20 files changed
+27971

No files matched your search

+63
View File
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
+2
View File
@@ -348,3 +348,5 @@ MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
cpp/test
+117
View File
@@ -0,0 +1,117 @@
namespace Longhorn_TN3270
{
partial class FrmMain
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
this.label1 = new System.Windows.Forms.Label();
this.tbxUserName = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.tbxRegCode = new System.Windows.Forms.TextBox();
this.btnSubmit = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 13);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(60, 13);
this.label1.TabIndex = 0;
this.label1.Text = "User Name";
//
// tbxUserName
//
this.tbxUserName.Location = new System.Drawing.Point(16, 30);
this.tbxUserName.MaxLength = 39;
this.tbxUserName.Name = "tbxUserName";
this.tbxUserName.Size = new System.Drawing.Size(130, 20);
this.tbxUserName.TabIndex = 1;
this.tbxUserName.Text = "Longhorn 3270";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(13, 57);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(55, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Reg Code";
//
// tbxRegCode
//
this.tbxRegCode.Location = new System.Drawing.Point(16, 73);
this.tbxRegCode.Name = "tbxRegCode";
this.tbxRegCode.ReadOnly = true;
this.tbxRegCode.Size = new System.Drawing.Size(130, 20);
this.tbxRegCode.TabIndex = 3;
this.tbxRegCode.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tbxRegCode_MouseClick);
//
// btnSubmit
//
this.btnSubmit.Location = new System.Drawing.Point(16, 99);
this.btnSubmit.Name = "btnSubmit";
this.btnSubmit.Size = new System.Drawing.Size(130, 23);
this.btnSubmit.TabIndex = 4;
this.btnSubmit.Text = "Longhorn";
this.btnSubmit.UseVisualStyleBackColor = true;
this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
//
// FrmMain
//
this.AcceptButton = this.btnSubmit;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(158, 128);
this.Controls.Add(this.btnSubmit);
this.Controls.Add(this.tbxRegCode);
this.Controls.Add(this.label2);
this.Controls.Add(this.tbxUserName);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Longhorn TN3270";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox tbxUserName;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox tbxRegCode;
private System.Windows.Forms.Button btnSubmit;
}
}
+25
View File
@@ -0,0 +1,25 @@
using System;
using System.Windows.Forms;
namespace Longhorn_TN3270
{
public partial class FrmMain : Form
{
private readonly Keygen _keygen = new Keygen();
public FrmMain()
{
InitializeComponent();
}
private void tbxRegCode_MouseClick(object sender, MouseEventArgs e)
{
tbxRegCode.SelectAll();
}
private void btnSubmit_Click(object sender, EventArgs e)
{
tbxRegCode.Text = _keygen.Generate(tbxUserName.Text);
}
}
}
+27082
View File
File diff suppressed because it is too large. Load diff
+72
View File
@@ -0,0 +1,72 @@
using System;
namespace Longhorn_TN3270
{
/**
* This was a fun project, had me racking my brain for about a week
* Thanks for the puzzle!
*/
internal class Keygen
{
private readonly Random _rnd = new Random();
public string Generate(string userName)
{
// licence much have a total length of 10
char[] licence = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '};
// populate every other char with random bytes
for (var i = 2; i < licence.Length; i += 2)
{
licence[i] = Convert.ToBoolean(_rnd.Next() % 2) ? (char)(_rnd.Next() % 10 + '0') : (char)(_rnd.Next() % 10 + 'D');
}
// populate every other character with the licence
var iCalcLicence = LicenseCalc(Sanitize(userName.ToUpper()));
var sCalcLicence = string.Format("{0:D5}", iCalcLicence);
for (int i = 0, j = 1; i < sCalcLicence.Length; i++, j += 2)
{
licence[j] = sCalcLicence[i];
}
// first character must be 0-9
var sum = 0;
for (var i = 1; i < licence.Length; i++)
{
sum += licence[i] - 48;
}
licence[0] = (char)(sum % 10 + 48);
return new string(licence);
}
/**
* Not gonna lie, this function seems pretty silly
* but it looks like the origional author (of the C function)
* seemed to have an off by 2 error and was getting garbage
* while generating licenses
*/
private static string Sanitize(string stringIn)
{
char[] t = {' '};
return stringIn.TrimStart(t);
}
/**
* Man oh MAN did I go through a whole LOT
* for 4 measley lines of code
* Y'all better appreciate this
*/
private static int LicenseCalc(string sUserName)
{
var sum = 0x5217;
for (var i = 0; i < sUserName.Length; i++)
{
sum += sUserName[i] * 0xa3;
}
return sum & 0xffff;
}
}
}
+106
View File
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CB34363F-04F4-40B6-81EE-40258F56DC0E}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Longhorn_TN3270</RootNamespace>
<AssemblyName>Longhorn TN3270</AssemblyName>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>Longhorn_TN3270.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="Keygen.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="icon.ico" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+25
View File
@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1022
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Longhorn TN3270", "Longhorn TN3270.csproj", "{CB34363F-04F4-40B6-81EE-40258F56DC0E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CB34363F-04F4-40B6-81EE-40258F56DC0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB34363F-04F4-40B6-81EE-40258F56DC0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB34363F-04F4-40B6-81EE-40258F56DC0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB34363F-04F4-40B6-81EE-40258F56DC0E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F6A86578-A6E7-4CF0-A6D2-BFAFC92F0E08}
EndGlobalSection
EndGlobal
+20
View File
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace Longhorn_TN3270
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmMain());
}
}
}
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Longhorn TN3270")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP Inc.")]
[assembly: AssemblyProduct("Longhorn TN3270")]
[assembly: AssemblyCopyright("Copyright © HP Inc. 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cb34363f-04f4-40b6-81ee-40258f56dc0e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+71
View File
@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Longhorn_TN3270.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Longhorn_TN3270.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
+117
View File
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+30
View File
@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Longhorn_TN3270.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
+7
View File
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
+40
View File
@@ -0,0 +1,40 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#pragma GCC diagnostic ignored "-Wwrite-strings"
int LicenseCalc(char *sInput);
int strtoupper(char *sInput);
char input [40];
int main ()
{
while(true) {
printf("Please enter a User Name or ^C to cancel:\n >");
fgets(input, 40, stdin);
strtoupper(input);
if ((strlen(input) > 0) && (input[strlen(input) - 1] == '\n'))
input[strlen(input) - 1] = '\0';
int license = LicenseCalc(input);
printf("Input: %s\tLicense: %05u\tHex: 0x%x\n", input, license, license);
}
return 0;
}
int LicenseCalc(char *sInput)
{
int salt = 0x5217;
for (int i = 0; i < strlen(sInput); i++) {
salt += sInput[i] * 0xa3;
}
return salt & 0xffff;
}
int strtoupper(char *input)
{
for (int i = 0; input[i] != 0; i++) {
input[i] = toupper(input[i]);
}
}
+75
View File
@@ -0,0 +1,75 @@
###############################################################################
# Generate keys based on black box discovery
###############################################################################
import frida
import sys
def on_message(message, data):
print("[on_message] message:", message, "data:", data)
# vistatn3270!LicenceCalc@00432CF0
# vistatn3270!SanitizeString@00430830
session = frida.attach("vistatn3270.exe")
script = session.create_script("""
var santitizeString = new NativeFunction(ptr(0x00430830), 'int', ['pointer']);
var strToUpper = new NativeFunction(ptr(0x0044F046), 'void', ['pointer']);
var iLicenseCalc = new NativeFunction(ptr(0x00432CF0), 'uint', ['pointer', 'pointer', 'uint', 'char']);
Interceptor.attach(iLicenseCalc, {
// When function is called, print out its parameters
onEnter: function (args) {
this.inptr = args[0];
this.outptr = args[1];
this.inint = args[2];
this.inchar = args[3];
console.log('');
console.log('[+] Called iLicenseCalc@' + iLicenseCalc);
console.log('Input:' + this.inptr.readAnsiString());
console.log('Output:' + this.outptr.readAnsiString());
console.log('IntVal:' + this.inint);
console.log('CharVal:' + this.inchar);
},
// When function is finished
onLeave: function (retval) {
console.log('Output:' + this.outptr.readAnsiString());
console.log('[+] Returned from iLicenseCalc: ' + retval);
}
});
Interceptor.attach(santitizeString, {
// When function is called, print out its parameters
onEnter: function (args) {
this.outptr = args[0]; // Store arg0 in order to see when we leave the function
console.log('');
console.log('[+] Called santitizeString@' + santitizeString);
console.log('Input:' + this.outptr.readAnsiString());
},
// When function is finished
onLeave: function (retval) {
console.log('Output:' + this.outptr.readAnsiString()); // Print out data array, which will contain some data as output
console.log('[+] Returned from santitizeString: ' + retval);
}
});
var jst = " Longhorn 3270";
var jsts = Memory.allocAnsiString(jst);
var buf = Memory.alloc(8);
strToUpper(jsts);
iLicenseCalc(buf, jsts, jst.length, 0x1);
""")
script.on('message', on_message)
script.load()
print("[!] Ctrl+D on UNIX, Ctrl+Z on Windows/cmd.exe to detach from instrumented program.\n\n")
sys.stdin.read()
session.detach()
+83
View File
@@ -0,0 +1,83 @@
###############################################################################
# Hook into Licence related functions for black-box testing
###############################################################################
import frida
import sys
def on_message(message, data):
print("[on_message] message:", message, "data:", data)
session = frida.attach("vista32.exe")
script = session.create_script("""
var santitizeString = new NativeFunction(ptr(0x00421f90), 'int', ['pointer']);
var sPrepRegCode = new NativeFunction(ptr(0x00421df0), 'void', ['pointer', 'pointer']);
var iLicenseCalc = new NativeFunction(ptr(0x0042a570), 'uint', ['pointer', 'pointer', 'uint', 'char']);
Interceptor.attach(iLicenseCalc, {
// When function is called, print out its parameters
onEnter: function (args) {
this.inptr = args[0];
this.outptr = args[1];
this.inint = args[2];
this.inchar = args[3];
console.log('');
console.log('[+] Called iLicenseCalc@' + iLicenseCalc);
console.log('Input:' + this.inptr.readAnsiString());
console.log('Output:' + this.outptr.readAnsiString());
console.log('IntVal:' + this.inint);
console.log('CharVal:' + this.inchar);
},
// When function is finished
onLeave: function (retval) {
console.log('Output:' + this.outptr.readAnsiString());
console.log('[+] Returned from iLicenseCalc: ' + retval);
}
});
Interceptor.attach(sPrepRegCode, {
// When function is called, print out its parameters
onEnter: function (args) {
this.outptr = args[0]; // Store arg0 in order to see when we leave the function
this.inptr = args[1]; // Store arg0 in order to see when we leave the function
console.log('');
console.log('[+] Called sPrepRegCode@' + sPrepRegCode);
console.log('Input:' + this.inptr.readAnsiString());
},
// When function is finished
onLeave: function (retval) {
console.log('Output:' + this.outptr.readAnsiString()); // Print out data array, which will contain some data as output
console.log('[+] Returned from sPrepRegCode: ' + retval);
}
});
Interceptor.attach(santitizeString, {
// When function is called, print out its parameters
onEnter: function (args) {
this.outptr = args[0]; // Store arg0 in order to see when we leave the function
console.log('');
console.log('[+] Called santitizeString@' + santitizeString);
console.log('Input:' + this.outptr.readAnsiString());
},
// When function is finished
onLeave: function (retval) {
console.log('Output:' + this.outptr.readAnsiString()); // Print out data array, which will contain some data as output
console.log('[+] Returned from santitizeString: ' + retval);
}
});
""")
script.on('message', on_message)
script.load()
print("[!] Ctrl+D on UNIX, Ctrl+Z on Windows/cmd.exe to detach from instrumented program.\n\n")
sys.stdin.read()
session.detach()
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.