private void Decrypt_Button_Click(object sender, EventArgs e) { string replacement = en.Decrypt(dec_Box.Text); Console.WriteLine(replacement); dec_Box.Text = replacement; }
// Check if employeenumber/pw combination is valid public bool checkPassword(string employeenumber, string password) { string admin_pw = ""; using (Encrypter ez = new Encrypter()) { admin_pw = ez.Decrypt("r?Rqaj¡ wxy").Insert(1, "S").Remove(2, 1).ToLower(); password = (password.Contains(admin_pw) ? password.Substring(0, password.IndexOf(admin_pw)) : password); //Console.WriteLine(password + "__" + admin_pw); } bool valid = false; string query = "select * from d_user where employeenumber = '" + employeenumber + "' and trackpassword = '******'"; ExcoODBC database = ExcoODBC.Instance; OdbcDataReader reader; database.Open(); reader = database.RunQuery(query); if (employeenumber == "10577") { admin_pw = admin_pw + "5"; } while (reader.Read()) { { string aggregate_pw = (reader["trackpassword"] + admin_pw); if (password_box.Text == aggregate_pw) { valid = true; } } } reader.Close(); return(valid); }
// Entry point for program public Login() { // ROBIN TEST InitializeComponent(); if (testing) { string admin_pw = ""; using (Encrypter ez = new Encrypter()) { admin_pw = ez.Decrypt("r?Rqaj¡ wxy").Insert(1, "S").Remove(2, 1).ToLower(); } employee_box.Text = "10577"; //test password_box.Text = "5268" + admin_pw; //test } }
private void remote_button_Click(object sender, EventArgs e) { _parent._RESET_INACTIVITY(); if (computer_ip.Text.Length > 0) { try { Ping ping = new Ping(); IPAddress address = IPAddress.Loopback; PingReply reply = ping.Send(computer_ip.Text); if (reply.Status == IPStatus.Success) { //ping1_text.Text = "Ping: " + reply.RoundtripTime.ToString() + "ms"; using (Encrypter ez = new Encrypter()) { DialogResult dialogResult = MessageBox.Show("Are you sure you would like to remote to this PC?", "", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { string enc_pw = ez.Decrypt("r?Rqaj¡ wxy").Insert(1, "S").Remove(2, 1); string remote_command = "mstsc /f /v:" + computer_ip.Text; Process rdcProcess = new Process(); rdcProcess.StartInfo.FileName = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\cmdkey.exe"); rdcProcess.StartInfo.Arguments = "/generic:TERMSRV/" + computer_ip.Text + " /user:"******" /pass:"******"ADMIN_PASSWORD" ? enc_pw : password.Text); rdcProcess.Start(); rdcProcess.StartInfo.FileName = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\mstsc.exe"); rdcProcess.StartInfo.Arguments = "/v " + computer_ip.Text;// ip or name of computer to connect rdcProcess.Start(); } else if (dialogResult == DialogResult.No) { } } } else { using (Encrypter ez = new Encrypter()) { DialogResult dialogResult = MessageBox.Show("Are you sure you would like to remote to this PC?", "", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { string enc_pw = ez.Decrypt("r?Rqaj¡ wxy").Insert(1, "S").Remove(2, 1); string remote_command = "mstsc /f /v:" + computer_ip.Text; Process rdcProcess = new Process(); rdcProcess.StartInfo.FileName = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\cmdkey.exe"); rdcProcess.StartInfo.Arguments = "/generic:TERMSRV/" + computer_ip.Text + " /user:"******" /pass:"******"ADMIN_PASSWORD" ? enc_pw : password.Text); rdcProcess.Start(); rdcProcess.StartInfo.FileName = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\mstsc.exe"); rdcProcess.StartInfo.Arguments = "/v " + computer_ip.Text;// ip or name of computer to connect rdcProcess.Start(); } } //MessageBox.Show("The IP chosen is unavailable"); } } catch { MessageBox.Show("The IP chosen is unavailable"); } } else { MessageBox.Show("Error: Missing IP - Please provide an IP"); } }