Commit 0807aa89 authored by pokkst's avatar pokkst

Upload

parent 7b15f0ac
MIT License
Copyright (c) 2018 duudl3
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2018
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProceduralPassApp", "ProceduralPass\ProceduralPassApp.csproj", "{DB3AD5AF-A729-4EDA-9DCB-D1233B69DB8F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DB3AD5AF-A729-4EDA-9DCB-D1233B69DB8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB3AD5AF-A729-4EDA-9DCB-D1233B69DB8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB3AD5AF-A729-4EDA-9DCB-D1233B69DB8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB3AD5AF-A729-4EDA-9DCB-D1233B69DB8F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D955EC30-A913-4F1E-9D8B-E692AC51BF04}
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
\ No newline at end of file
<Application x:Class="ProceduralPass.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ProceduralPass"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace ProceduralPass
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public static String availChars = "[email protected]#$%^&*()";
public static String availChars2 = "[email protected]#$%^&*()";
public static String masterPassword = "";
}
}
<Window x:Class="ProceduralPass.ConfirmationDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProceduralPass"
mc:Ignorable="d"
Title="Alert" Height="200" Width="350" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize" Background="#FF1D1D1D">
<Grid Margin="-5,-5,0,0">
<Label Name="ConfirmDialogText" Content="Label Text" HorizontalAlignment="Center" Margin="10,45,0,0" VerticalAlignment="Top" Foreground="White" FontSize="18"/>
<Button Content="Yes" HorizontalAlignment="Center" Margin="-130,95,0,0" VerticalAlignment="Center" Width="120" Height="35" Click="ConfirmAction" IsDefault="False" Background="#FF666666" BorderBrush="{x:Null}" Foreground="White"/>
<Button Content="No" HorizontalAlignment="Center" Margin="130,95,0,0" VerticalAlignment="Center" Width="120" Height="35" Click="DeclineAction" IsDefault="True" Background="#FF666666" BorderBrush="{x:Null}" Foreground="White"/>
</Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ProceduralPass
{
/// <summary>
/// Interaction logic for ConfirmationDialog.xaml
/// </summary>
public partial class ConfirmationDialog : Window
{
private String actionType = "";
private int selectedRow = -1;
private DataGrid dataGrid = null;
public ConfirmationDialog(String actionType, int selectedRow, DataGrid dataGrid)
{
InitializeComponent();
if(actionType == "Delete")
{
ConfirmDialogText.Content = "Are you sure you wish to delete?";
}
else if(actionType == "Reset")
{
ConfirmDialogText.Content = "Are you sure you wish to reset?";
}
this.actionType = actionType;
this.selectedRow = selectedRow;
this.dataGrid = dataGrid;
}
private void ConfirmAction(object sender, RoutedEventArgs e)
{
if (actionType == "Delete")
{
dataGrid.ItemsSource = null;
LoginArrayHandler.INSTANCE.logins.RemoveAt(selectedRow);
dataGrid.ItemsSource = LoginArrayHandler.INSTANCE.logins;
LoginArrayHandler.INSTANCE.saveLogins();
}
else if(actionType == "Reset")
{
LoginEntry entry = (LoginEntry)LoginArrayHandler.INSTANCE.logins[selectedRow];
Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
LoginArrayHandler.INSTANCE.logins[selectedRow] = new LoginEntry(entry.getUsername(), entry.getWebsite(), unixTimestamp.ToString());
entry = (LoginEntry)LoginArrayHandler.INSTANCE.logins[selectedRow];
String password = entry.generatePassword(entry.getUsername(), entry.getWebsite(), entry.getUnixTime(), App.masterPassword);
LoginArrayHandler.INSTANCE.saveLogins();
Clipboard.SetText(password);
password = "";
dataGrid.SelectedIndex = -1;
}
Close();
}
private void DeclineAction(object sender, RoutedEventArgs e)
{
Close();
}
}
}
using System;
using System.IO;
using System.Collections;
namespace ProceduralPass
{
public class LoginArrayHandler
{
public static LoginArrayHandler INSTANCE;
public ArrayList logins;
public LoginArrayHandler()
{
INSTANCE = this;
}
public void saveLogins()
{
String data = "";
foreach (LoginEntry login in logins)
{
data += login.getWebsite() + "=" + login.getUsername() + "=" + login.getUnixTime() + Environment.NewLine;
}
File.WriteAllText("./data.txt", data);
}
public void loadLogins()
{
if (File.Exists("./data.txt"))
{
logins = new ArrayList();
foreach (String line in File.ReadLines("./data.txt"))
{
String[] combo = line.Split('=');
String website = combo[0];
String username = combo[1];
String unixTime = "";
if(combo.Length == 3)
{
unixTime = combo[2];
}
if (combo.Length == 4)
{
unixTime = combo[2];
}
logins.Add(new LoginEntry(username, website, unixTime));
}
}
else
{
logins = new ArrayList();
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
namespace ProceduralPass
{
public class LoginEntry
{
public String Username { get; set; }
public String Website { get; set; }
public String unixTime = "";
public String generatedPassword = "";
public String[] saltTable = new String[] { "RF0VcwcU72Di/CViIyQ==", "tSzfiE9ILJ3GoeB6LrzDyi8=", "ScwxrfsCTsHD/BEI00Vx3A==", "+pXmuSPgJnm7+jXrA/r0w==", "+tNW3r9ewsgLJy4h#YY#Gzj==*#*YYT*" };
public LoginEntry(String user, String site, String unixTime)
{
this.Username = user;
this.Website = site;
this.unixTime = unixTime;
}
public String getUsername()
{
return Username;
}
public String getWebsite()
{
return Website;
}
public String getUnixTime()
{
return unixTime;
}
public String generatePassword(String username, String site, String unixTime, String masterPassword)
{
String password = "";
//This is v3 of the generation algorithm. I plan to phase out v1 and v2 within future updates. People should update their passwords.
//This may be the final algorithm change for a while. I think it's good enough to obfuscate the master password.
//Alright, here's how the bad boy works.
/**
* Here we take the username and site data and hash it with a hardcoded salt.
**/
int masterPassLength = masterPassword.Length;
String saltedUsername = SHA256(username) + "*#UYT4348ghy*H&T^F&%RT^H*NG&^B(T(^*hg3u4g**H";
String saltedWebsite = SHA256(site) + "*#UYTG*H3u4hg3u4g**H";
String saltedMasterpass = masterPassLength.ToString() + SHA256(masterPassword) + "*^GBR%y7g6g6hj&T&^^%^F56d56D%F65f567f5&F57f%&f**H";
/**
* This is what I like to call the 3D hashing machine. We run it through these for loops, similar to a 3D objects x, y, and z axis.
**/
for (int x = 0; x < 32; x++)
{
for (int y = 0; y < 32; y++)
{
for (int z = 0; z < 32; z++)
{
char[] charArray = App.availChars2.ToCharArray();
/**
* Next we run it through the 3D hashing machine to get a new username and website hash with random salt hashes generated on the fly,
* mixed with predefined salts in the String[] "saltTable".
**/
String nextUsernameSalt = "";
String nextWebsiteSalt = "";
String nextMasterpassSalt = "";
int randomSaltTableHashIndexUser = 0;
int randomSaltTableHashIndexSite = 0;
int randomSaltTableHashIndexMasterpass = 0;
for (int i = 0; i < 32; i++)
{
int threeDimSeedUser = (saltedWebsite.Length + saltedUsername.Length) + (x * x + y * y + (z * (z * 2))) + (i * 4);
RandomNumberGenerator threeDimRandomUser = new RandomNumberGenerator(threeDimSeedUser * 5, i + 5);
int userCharChosen = threeDimRandomUser.nextInt(App.availChars2.Length);
nextUsernameSalt += charArray[userCharChosen].ToString();
randomSaltTableHashIndexUser = threeDimRandomUser.nextInt(saltTable.Length);
int threeDimSeedSite = (256 + (saltedWebsite.Length + saltedUsername.Length) * (x + x + (y * y) + z + z) * i) * 2;
RandomNumberGenerator threeDimRandomSite = new RandomNumberGenerator(threeDimSeedSite, i + 2);
int siteCharChosen = threeDimRandomSite.nextInt(App.availChars2.Length);
nextWebsiteSalt += charArray[siteCharChosen].ToString();
randomSaltTableHashIndexSite = threeDimRandomSite.nextInt(saltTable.Length);
int threeDimSeedMasterpass = Math.Abs((saltedMasterpass.Length * 4) - (x + (x + y) * y + z * z) + (i * i));
RandomNumberGenerator threeDimRandomMasterpass = new RandomNumberGenerator(threeDimSeedMasterpass + 1, i + 1);
int mpCharChosen = threeDimRandomMasterpass.nextInt(App.availChars2.Length);
nextMasterpassSalt += charArray[mpCharChosen].ToString();
randomSaltTableHashIndexMasterpass = threeDimRandomMasterpass.nextInt(saltTable.Length);
}
saltedUsername = SHA256(saltedUsername + nextUsernameSalt) + saltTable[randomSaltTableHashIndexUser];
saltedWebsite = SHA256(saltedWebsite + nextWebsiteSalt) + saltTable[randomSaltTableHashIndexSite];
saltedMasterpass = SHA256(saltedMasterpass + nextMasterpassSalt) + saltTable[randomSaltTableHashIndexMasterpass];
}
/**
* The salted hashes are then hashed again in each loop on a different axis.
**/
saltedMasterpass = SHA256(saltedMasterpass);
saltedWebsite = SHA256(saltedWebsite);
saltedUsername = SHA256(saltedUsername);
}
/**
* The salted hashes are then hashed *again* on a another axis.
**/
saltedMasterpass = SHA256(saltedMasterpass);
saltedWebsite = SHA256(saltedWebsite);
saltedUsername = SHA256(saltedUsername);
}
/**
* To keep most hashes unique, as each hash's length is 64 characters long, meaning we'd get almost the same seed every time, we add up the UTF8 values of each character in the
* string for a unique number. We do this for the masterpassword hash, and username hash.
**/
int mpHashCharSum = 0;
int userHashCharSum = 0;
int siteHashCharSum = 0;
int mpHashCharProduct = 1;
foreach (byte b in System.Text.Encoding.UTF8.GetBytes(saltedMasterpass.ToCharArray()))
{
mpHashCharSum += b;
mpHashCharProduct *= b + mpHashCharSum;
}
foreach (byte b in System.Text.Encoding.UTF8.GetBytes(saltedUsername.ToCharArray()))
userHashCharSum += b;
foreach (byte b in System.Text.Encoding.UTF8.GetBytes(saltedWebsite.ToCharArray()))
siteHashCharSum += b;
/**
* We then multiple the above UTF8 sums and add it to the length of the masterpassword hash, saltedWebsite hash, and the saltedUsername hash * 4, all of which is multiplied by 128.
* We then set this as the next seed.
* We then generate the length of the password using the masterpass UTF8 sum while dividing by the saltedUsername length, saltedWebsite length, and masterpass length, all
* multiplied by 4. Which all of *that* is multiplied by 6. Then we add 32 to ALL of *that* as a base length.
**/
int seed = ((mpHashCharSum * userHashCharSum) + masterPassLength + siteHashCharSum + (mpHashCharProduct * 4)) * 128;
RandomNumberGenerator rand = new RandomNumberGenerator(seed, mpHashCharSum);
int length = rand.nextInt((((mpHashCharSum + ((mpHashCharProduct + siteHashCharSum + masterPassLength) * 4)) * 6)) / 2000) + 32;
for (int x = 0; x < length; x++)
{
/**
* We then run the length of the password in a for loop to use more procedural generation to choose characters from the list of available ones in App.availChars2.
**/
RandomNumberGenerator charRand = new RandomNumberGenerator(rand.nextInt(masterPassLength * 32) * (x * x) + Int32.Parse(unixTime), mpHashCharSum);
int charChosen = charRand.nextInt(App.availChars2.Length);
char[] charArray = App.availChars2.ToCharArray();
//The chosen character is then added onto the password string.
password += charArray[charChosen].ToString();
}
//Then the data is cleared.
masterPassword = "0000000000000000";
site = "0000000000000000";
username = "0000000000000000";
masterPassLength = -1;
//And the password is returned to us.
return password;
}
private string SHA256(string input)
{
var crypt = new System.Security.Cryptography.SHA256Managed();
var hash = new System.Text.StringBuilder();
byte[] crypto = crypt.ComputeHash(Encoding.UTF8.GetBytes(input));
foreach (byte theByte in crypto)
{
hash.Append(theByte.ToString("x2"));
}
return hash.ToString();
}
}
}
<Window x:Class="ProceduralPass.Logins"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProceduralPass"
mc:Ignorable="d"
Title="Procedural Pass v1.4.2" Height="450" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize" Background="#FF1D1D1D">
<Grid Margin="-5,-5,0,0">
<Button Content="Add Login" HorizontalAlignment="Left" Margin="655,10,0,0" VerticalAlignment="Top" Width="127" Height="34" Click="openNewLoginWindow" Background="#FF666666" BorderBrush="{x:Null}" Foreground="White"/>
<DataGrid Name="LoginDataGrid" GridLinesVisibility="None" RowHeaderWidth="0" CanUserResizeColumns="False" CanUserResizeRows="False" Height="362" Margin="10,49,0,0" VerticalAlignment="Top" Width="772" CanUserAddRows="False" BorderBrush="{x:Null}" Background="#FF303030" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch" ColumnWidth="*">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Password">
<DataGridTemplateColumn.HeaderStyle>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="Background" Value="#FF666666" />
<Setter Property="Foreground" Value="#FFF" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="MinWidth" Value="100" />
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
</DataGridTemplateColumn.HeaderStyle>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="Get" Click="getPassword" Background="#FF666666" BorderBrush="{x:Null}" Foreground="White"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Reset Password">
<DataGridTemplateColumn.HeaderStyle>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="Background" Value="#FF666666" />
<Setter Property="Foreground" Value="#FFF" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="MinWidth" Value="100" />
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
</DataGridTemplateColumn.HeaderStyle>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="Reset" Click="resetPassword" Background="#FF666666" BorderBrush="{x:Null}" Foreground="White" MinWidth="0" MinHeight="0"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Delete">
<DataGridTemplateColumn.HeaderStyle>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="Background" Value="#FF666666" />
<Setter Property="Foreground" Value="#FFF" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="MinWidth" Value="100" />
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
</DataGridTemplateColumn.HeaderStyle>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="Delete" Click="deleteLogin" Background="#FF666666" BorderBrush="{x:Null}" Foreground="White"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
<DataGrid.Resources>
<Style BasedOn="{StaticResource {x:Type DataGridRow}}" TargetType="{x:Type DataGridRow}">
<Setter Property="Background" Value="#FF323232" />
<Setter Property="Foreground" Value="#FFF" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="MinWidth" Value="100" />
</Style>
<Style BasedOn="{StaticResource {x:Type DataGridColumnHeader}}" TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="Background" Value="#FF666666" />
<Setter Property="Foreground" Value="#FFF" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="MinWidth" Value="100" />
</Style>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="Foreground" Value="#FFF" />
<Setter Property="BorderBrush" Value="{x:Null}" />
</Style>
</DataGrid.Resources>
</DataGrid>
<Label Content="Logins" HorizontalAlignment="Left" Margin="10,5,0,0" VerticalAlignment="Top" Width="114" Foreground="White" FontSize="24" Height="44"/>
</Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ProceduralPass
{
/// <summary>
/// Interaction logic for Logins.xaml
/// </summary>
public partial class Logins : Window
{
public static Logins INSTANCE;
public Logins()
{
InitializeComponent();
INSTANCE = this;
LoginDataGrid.ItemsSource = LoginArrayHandler.INSTANCE.logins;
}
private void openNewLoginWindow(object sender, RoutedEventArgs e)
{
NewLogin newLogin = new NewLogin();
newLogin.Show();
}
private void deleteLogin(object sender, RoutedEventArgs e)
{
int index = LoginDataGrid.SelectedIndex;
ConfirmationDialog confirmDialog = new ConfirmationDialog("Delete", index, LoginDataGrid);
confirmDialog.Show();
}
private void getPassword(object sender, RoutedEventArgs e)
{
int index = LoginDataGrid.SelectedIndex;
LoginEntry entry = (LoginEntry)LoginArrayHandler.INSTANCE.logins[index];
String password = entry.generatePassword(entry.getUsername(), entry.getWebsite(), entry.getUnixTime(), App.masterPassword);
Clipboard.SetText(password);
password = "";
LoginDataGrid.SelectedIndex = -1;
}
private void resetPassword(object sender, RoutedEventArgs e)
{
int index = LoginDataGrid.SelectedIndex;
ConfirmationDialog confirmDialog = new ConfirmationDialog("Reset", index, LoginDataGrid);
confirmDialog.Show();
}
}
}
<Window x:Class="ProceduralPass.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"