2014-12-29 23:42:46 +00:00
using System ;
using System.Collections.Generic ;
using System.ComponentModel ;
using System.Data ;
using System.Drawing ;
using System.Linq ;
using System.Text ;
using System.Threading.Tasks ;
using System.Windows.Forms ;
namespace Pithos
{
2015-01-04 22:30:56 +00:00
public partial class unlock : Form {
2014-12-29 23:42:46 +00:00
private List < string > validUserNames = privateFunctions . validUserNames ( ) ;
private List < string > validMachineNames = privateFunctions . validMachineNames ( ) ;
2015-01-04 22:30:56 +00:00
private List < char > licenseChar = new List < char > ( ) ;
2014-12-29 23:42:46 +00:00
public unlock ( ) {
InitializeComponent ( ) ;
2014-12-30 21:03:20 +00:00
}
2015-01-04 22:30:56 +00:00
private void loginSuccessful ( ) {
2014-12-30 21:03:20 +00:00
this . Hide ( ) ;
Program . MW . Show ( ) ;
2015-01-04 22:30:56 +00:00
licenceInput . Text = "" ;
unlockButton . Text = "Unlock" ;
2014-12-29 23:42:46 +00:00
}
private void checkWorkSpaceValidations ( ) {
string machineName = Environment . MachineName ;
string domainName = Environment . UserDomainName ;
string userName = Environment . UserName ;
if ( validUserNames . Contains ( userName ) | | validMachineNames . Contains ( machineName ) | | validMachineNames . Contains ( domainName ) ) {
2014-12-30 21:03:20 +00:00
MessageBox . Show ( "Valid Computer Credentials have been detected. Automatic Login Initiated." , "Computer Confirmed" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
2014-12-29 23:42:46 +00:00
}
2015-01-04 22:30:56 +00:00
loginSuccessful ( ) ;
2014-12-29 23:42:46 +00:00
}
2015-01-04 22:30:56 +00:00
private void button1_Click ( object sender , EventArgs e ) { //validation
2014-12-30 21:03:20 +00:00
unlockButton . Text = "Validating..." ;
2015-01-04 22:30:56 +00:00
//checkWorkSpaceValidations();
2014-12-30 21:03:20 +00:00
if ( privateFunctions . checkHardCodes ( licenceInput . Text ) ) {
MessageBox . Show ( "You have entered hard-coded login credentials. Access Granted." , "Access Granted" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
loginSuccessful ( ) ;
}
2015-01-04 22:30:56 +00:00
else
{
MessageBox . Show ( "Incorrent Login. Access Denied" , "Access Denied" , MessageBoxButtons . OK , MessageBoxIcon . Stop ) ;
unlockButton . Text = "Unlock" ;
}
2014-12-30 21:03:20 +00:00
}
2015-01-04 22:30:56 +00:00
private void infoLabel_Click ( object sender , EventArgs e ) { System . Diagnostics . Process . Start ( "http://theorangeone.net/pithos" ) ; }
private void licenceInput_TextChanged ( object sender , EventArgs e )
{
System . Random rnd = new System . Random ( ) ;
rnd . Next ( licenseChar . Count ) ;
2014-12-29 23:42:46 +00:00
}
}
}