private void displayPasswords() { int txtBoxStartPositionId = 12; int txtBoxStartPositionVId = 30; int txtBoxStartPositionPass = 230; int txtBoxStartPositionVPass = 30; RetrievePass rp = new RetrievePass(); TextEncryptionDecryption tcd = new TextEncryptionDecryption(); var count = 0; var masterPass = rp.retrieveMasterPass(); using (StreamReader sr = new StreamReader(@"credentials\Cred.txt")) { while (sr.Peek() >= 0) { var line = sr.ReadLine(); if (GlobalVariables.websiteName.ToLower() == line.Split(',')[0].ToLower()) { var id = line.Split(',')[1]; var encryptedPass = line.Split(',')[2]; var passInPlainText = tcd.DecryptText(encryptedPass, masterPass); count++; // Displaying Id fields. TextBox tBoxId = new TextBox(); tBoxId.Location = new System.Drawing.Point(txtBoxStartPositionId, txtBoxStartPositionVId); tBoxId.Size = new System.Drawing.Size(200, 30); tBoxId.Text = id.ToString(); Controls.Add(tBoxId); txtBoxStartPositionVId += 30; // Displaying Password fields. TextBox tBoxPass = new TextBox(); tBoxPass.Location = new System.Drawing.Point(txtBoxStartPositionPass, txtBoxStartPositionVPass); tBoxPass.Size = new System.Drawing.Size(200, 30); tBoxPass.Text = passInPlainText.ToString(); Controls.Add(tBoxPass); txtBoxStartPositionVPass += 30; var text = line.Split(',')[2]; } } } GlobalVariables.passwordCount = count; Text = "Website = " + GlobalVariables.websiteName + " :: Passwords Found = " + GlobalVariables.passwordCount; }
private void btnProceed_Click(object sender, EventArgs e) { var input1 = tBoxMasterpassInput1.Text; var input2 = tBoxMasterpassInput2.Text; // Check if both inputs are not same, show warning and stay in form. if (input1 != input2) { if (input1.Trim() == "" && input2.Trim() == "") { lblNotMatchWarning.Hide(); lblEmptyTextWarning.Show(); } else { lblEmptyTextWarning.Hide(); lblNotMatchWarning.Show(); } } // If both inputs are same and if yes, set it up as masterpass if input value is not blank. else { if (input1.Trim() == "") { lblNotMatchWarning.Hide(); lblEmptyTextWarning.Show(); } else { lblNotMatchWarning.Hide(); lblEmptyTextWarning.Hide(); TextEncryptionDecryption tcd = new TextEncryptionDecryption(); var applicationEncryptionPass = "******"; var encryptedPass = tcd.EncryptText(input1, applicationEncryptionPass); File.AppendAllText(@"donotdelete.txt", encryptedPass.ToString()); MessageBox.Show("Your masterpassword has been saved successfully!"); } } // Check to see if masterpass was set properly. If yes, close the form and return to main. RetrievePass rp = new RetrievePass(); if (rp.checkMasterPassExistance() == true) { this.Close(); } }
private void formMain_Load(object sender, EventArgs e) { RetrievePass rp = new RetrievePass(); var masterPassExists = rp.checkMasterPassExistance(); if (masterPassExists != true) { // #IMP: Need to write code so that main window is closed. Need more research. formSetupMasterpass frmSMP = new formSetupMasterpass(); frmSMP.ShowDialog(this); } masterPassExists = rp.checkMasterPassExistance(); if (masterPassExists != true) { MessageBox.Show("You must setup a masterpass to use this application!"); this.Close(); } }
private void btnProceed_Click(object sender, EventArgs e) { if (dataValidator()) { RetrievePass rp = new RetrievePass(); if (tBoxMasterpass.Text == rp.retrieveMasterPass()) { tBoxMasterpass.Clear(); formPasswords frmPasswords = new formPasswords(); frmPasswords.ShowDialog(this); Close(); } else { tBoxMasterpass.Clear(); MessageBox.Show("Spammer detected!"); Application.Exit(); } } }