diff --git a/FingerPassSetup/Product.wxs b/FingerPassSetup/Product.wxs index 6ac5851..467449c 100644 --- a/FingerPassSetup/Product.wxs +++ b/FingerPassSetup/Product.wxs @@ -1,7 +1,7 @@ - + diff --git a/fingerpass/DatabaseForm.cs b/fingerpass/DatabaseForm.cs index 56926cc..b2e44b2 100644 --- a/fingerpass/DatabaseForm.cs +++ b/fingerpass/DatabaseForm.cs @@ -43,21 +43,24 @@ private void DatabaseForm_Load(object sender, EventArgs e) { this.FormBorderStyle = FormBorderStyle.FixedDialog; //some DPI madness requires this to be set to sizable to start - int[] widths = new int[5]; - widths[0] = 25; - widths[1] = 25; - widths[2] = 25; + int[] widths = new int[6]; + widths[0] = 20; + widths[1] = 20; + widths[2] = 20; widths[3] = 15; - widths[4] = 10; + widths[4] = 15; + widths[5] = 10; passwordsDataGrid.Columns.Add("programNameColumn", "Program Name"); passwordsDataGrid.Columns.Add("windowTitleColumn", "Window Title"); passwordsDataGrid.Columns.Add("passwordColumn", "Password"); passwordsDataGrid.Columns.Add(new DataGridViewCheckBoxColumn()); + passwordsDataGrid.Columns.Add(new DataGridViewCheckBoxColumn()); passwordsDataGrid.Columns.Add(new DataGridViewLinkColumn()); passwordsDataGrid.Columns[3].HeaderText = "Press Enter?"; - passwordsDataGrid.Columns[4].HeaderText = "Actions"; + passwordsDataGrid.Columns[4].HeaderText = "Just Copy?"; + passwordsDataGrid.Columns[5].HeaderText = "Actions"; //set column widths based on percents, and other options... passwordsDataGrid.RowHeadersWidth = 50; @@ -86,6 +89,7 @@ private void DatabaseForm_Load(object sender, EventArgs e) row.Cells[1].Value = _newWindowTitle; row.Cells[2].Value = ""; row.Cells[3].Value = true; + row.Cells[4].Value = false; row.Cells[2].Selected = true; passwordsDataGrid.BeginEdit(true); @@ -164,6 +168,7 @@ private void UpdatePasswordsList() row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells.Add(new DataGridViewCheckBoxCell()); + row.Cells.Add(new DataGridViewCheckBoxCell()); row.Cells.Add(new DataGridViewLinkCell()); updatePasswordCells(row, password); @@ -186,9 +191,10 @@ private void updatePasswordCells(DataGridViewRow row, Password password) row.Cells[1].Value = password.Title; row.Cells[2].Value = defaultPassword; row.Cells[3].Value = password.PressEnter; - row.Cells[4].Value = "Delete"; - (row.Cells[4] as DataGridViewLinkCell).LinkBehavior = LinkBehavior.HoverUnderline; - (row.Cells[4] as DataGridViewLinkCell).TrackVisitedState = false; + row.Cells[4].Value = password.UseClipboard; + row.Cells[5].Value = "Delete"; + (row.Cells[5] as DataGridViewLinkCell).LinkBehavior = LinkBehavior.HoverUnderline; + (row.Cells[5] as DataGridViewLinkCell).TrackVisitedState = false; } private void saveButton_Click(object sender, EventArgs e) @@ -270,7 +276,7 @@ private void passwordsDataGrid_CellContentClick(object sender, DataGridViewCellE if (e.RowIndex >= 0) { DataGridViewCell cell = passwordsDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex]; - if (cell.ColumnIndex == 4) + if (cell.ColumnIndex == 5) { DeletedPassword(cell.RowIndex); } @@ -342,11 +348,12 @@ private void passwordsDataGrid_RowValidating(object sender, DataGridViewCellCanc string program = (row.Cells[0].Value != null) ? row.Cells[0].Value.ToString():""; string window = (row.Cells[1].Value != null) ? row.Cells[1].Value.ToString():""; bool enter = (row.Cells[3].Value != null) ? (bool)row.Cells[3].Value : false; + bool clipboard = (row.Cells[4].Value != null) ? (bool)row.Cells[4].Value : false; string password = row.Cells[2].Value.ToString(); if (isRowNew) { - updatedPassword = Program.keyDatabase.AddOrUpdate(program, window, enter, password); + updatedPassword = Program.keyDatabase.AddOrUpdate(program, window, enter, clipboard, password); } else { @@ -366,7 +373,7 @@ private void passwordsDataGrid_RowValidating(object sender, DataGridViewCellCanc return; } - updatedPassword = Program.keyDatabase.UpdateIndex(row.Index, program, window, enter, password); + updatedPassword = Program.keyDatabase.UpdateIndex(row.Index, program, window, enter, clipboard, password); } updatePasswordCells(row, updatedPassword); diff --git a/fingerpass/KeyDatabase.cs b/fingerpass/KeyDatabase.cs index f24075f..8fefea8 100644 --- a/fingerpass/KeyDatabase.cs +++ b/fingerpass/KeyDatabase.cs @@ -8,6 +8,7 @@ using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; +using System.Threading; using System.Threading.Tasks; using System.Timers; using System.Windows.Forms; @@ -135,6 +136,7 @@ public void Export(string path) newDatabasePassword.Program = password.Program; newDatabasePassword.Title = password.Title; newDatabasePassword.PressEnter = password.PressEnter; + newDatabasePassword.UseClipboard = password.UseClipboard; newDatabasePassword.PasswordHash = password.DecryptedPassword(); newDatabase.Passwords.Add(newDatabasePassword); }); @@ -175,6 +177,7 @@ public void UpdatePassword(string newPassword, string currentPassword = null) newDatabasePassword.Program = password.Program; newDatabasePassword.Title = password.Title; newDatabasePassword.PressEnter = password.PressEnter; + newDatabasePassword.UseClipboard = password.UseClipboard; newDatabasePassword.PasswordHash = password.DecryptedPassword(); //temporarily store in clear text newDatabase.Passwords.Add(newDatabasePassword); }); @@ -389,8 +392,9 @@ public void RemoveIndex(int index) /// The program name that the password belongs to /// The window title that the password belongs to /// Whether or not to automatically press enter after the password is typed + /// Whether or not to type this password using the clipboard via copy/paste /// The password in clear text, which will be encrypted. If left null, the password is not updated. - public Password UpdateIndex(int index, string programName, string windowTitle, bool pressEnter, string clearPassword = null) + public Password UpdateIndex(int index, string programName, string windowTitle, bool pressEnter, bool useClipboard, string clearPassword = null) { int existingIndex = FindPasswordIndex(programName, windowTitle); if (existingIndex >= 0 && existingIndex != index) @@ -402,6 +406,7 @@ public Password UpdateIndex(int index, string programName, string windowTitle, b database.Passwords[index].Program = programName; database.Passwords[index].Title = windowTitle; database.Passwords[index].PressEnter = pressEnter; + database.Passwords[index].UseClipboard = useClipboard; if (clearPassword != null) database.Passwords[index].PasswordHash = Protect(clearPassword); @@ -422,10 +427,11 @@ public Password UpdateIndex(int index, string programName, string windowTitle, b /// The program name that the password belongs to /// The window title that the password belongs to /// Whether or not to automatically press enter after the password is typed + /// Whether or not to type this password using the clipboard via copy/paste /// The password in clear text, which will be encrypted /// If specified along with oldWindowTitle, this entry will be replaced with the new one /// If specified along with oldProgramName, this entry will be replaced with the new one - public Password AddOrUpdate(string programName, string windowTitle, bool pressEnter, string clearPassword, string oldProgramName = null, string oldWindowTitle = null) + public Password AddOrUpdate(string programName, string windowTitle, bool pressEnter, bool useClipboard, string clearPassword, string oldProgramName = null, string oldWindowTitle = null) { int index = -1; @@ -446,6 +452,7 @@ public Password AddOrUpdate(string programName, string windowTitle, bool pressEn database.Passwords[index].Program = programName; database.Passwords[index].Title = windowTitle; database.Passwords[index].PressEnter = pressEnter; + database.Passwords[index].UseClipboard = useClipboard; database.Passwords[index].PasswordHash = Protect(clearPassword); Save(); @@ -458,6 +465,7 @@ public Password AddOrUpdate(string programName, string windowTitle, bool pressEn password.Program = programName; password.Title = windowTitle; password.PressEnter = pressEnter; + password.UseClipboard = useClipboard; password.PasswordHash = Protect(clearPassword); database.Passwords.Add(password); @@ -661,6 +669,7 @@ public class Password public string Title { get; set; } public string PasswordHash { get; set; } public bool PressEnter { get; set; } = true; + public bool UseClipboard { get; set; } = false; /// /// Returns the decrypted password in clear text @@ -683,14 +692,28 @@ public string DecryptedPassword() /// public void Type() { - //decrypt password and escape special characters that SendKeys uses... - string password = Regex.Replace(DecryptedPassword(), "[+^%~()]", "{$0}"); + if (this.UseClipboard) + { + //clipboard access must be done on an STA thread... + Thread thread = new Thread(() => + { + Clipboard.SetText(DecryptedPassword()); + }); + thread.SetApartmentState(ApartmentState.STA); //Set the thread to STA + thread.Start(); + thread.Join(); //Wait for the thread to end + } + else + { + //decrypt password and escape special characters that SendKeys uses... + string password = Regex.Replace(DecryptedPassword(), "[+^%~()]", "{$0}"); - //maybe add an ENTER keypress... - if (this.PressEnter) - password += "{ENTER}"; + //maybe add an ENTER keypress... + if (this.PressEnter) + password += "{ENTER}"; - SendKeys.SendWait(password); + SendKeys.SendWait(password); + } } } } diff --git a/fingerpass/MasterPasswordPromptForm.cs b/fingerpass/MasterPasswordPromptForm.cs index 37a2db1..4a6e919 100644 --- a/fingerpass/MasterPasswordPromptForm.cs +++ b/fingerpass/MasterPasswordPromptForm.cs @@ -35,7 +35,10 @@ private void MasterPasswordPromptForm_Load(object sender, EventArgs e) instructionsLabel.Text += "Please enter your master password to continue..."; + this.ShowInTaskbar = true; this.Activate(); + this.BringToFront(); + this.TopMost = true; } private void continueButton_Click(object sender, EventArgs e) diff --git a/fingerpass/Properties/AssemblyInfo.cs b/fingerpass/Properties/AssemblyInfo.cs index 8ec612c..0f556bc 100644 --- a/fingerpass/Properties/AssemblyInfo.cs +++ b/fingerpass/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("1.0")] -[assembly: AssemblyFileVersion("1.0")] +[assembly: AssemblyVersion("1.1.0")] +[assembly: AssemblyFileVersion("1.1.0")] diff --git a/fingerpass/TrayIcon.cs b/fingerpass/TrayIcon.cs index 4ac8a61..f436819 100644 --- a/fingerpass/TrayIcon.cs +++ b/fingerpass/TrayIcon.cs @@ -182,13 +182,21 @@ public void Show() if (_isDisposed) throw new ObjectDisposedException("_notifyIcon"); _notifyIcon.Visible = true; - //on first run, add to startup... + //do some setup on the first run... if (Properties.Settings.Default.FirstRun) { - Properties.Settings.Default.FirstRun = false; + //try upgrading settings from a previous version... + Properties.Settings.Default.Upgrade(); + + //if still the first run, add to startup... + if (Properties.Settings.Default.FirstRun) + { + Properties.Settings.Default.FirstRun = false; + RegistryKey startupKeys = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); + startupKeys.SetValue(Application.ProductName, Application.ExecutablePath); + } + Properties.Settings.Default.Save(); - RegistryKey startupKeys = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); - startupKeys.SetValue(Application.ProductName, Application.ExecutablePath); } //if salts haven't been set yet, set them... diff --git a/service/fingerpass_service/Properties/AssemblyInfo.cs b/service/fingerpass_service/Properties/AssemblyInfo.cs index 641eb29..63ac8e1 100644 --- a/service/fingerpass_service/Properties/AssemblyInfo.cs +++ b/service/fingerpass_service/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // 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")] +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")]