Example #1
0
        private void loadLoginsKeys()
        {
            lvLogins.Items.Clear();
            RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Seeker", true);

            if (key != null)
            {
                foreach (string keyItem in key.GetSubKeyNames())
                {
                    dLibAd.adUsers loginUser = loadLogin(keyItem, cbBoxDomains.SelectedItem.ToString());
                    if (loginUser != null)
                    {
                        ListViewItem loginItem = new ListViewItem();
                        loginItem.Name = loginUser.Account;
                        loginItem.Text = loginUser.Account;
                        loginItem.Tag  = loginUser;
                        lvLogins.Items.Add(loginItem);
                    }
                    else
                    {
                        MessageBox.Show("Sorry, Cypher KEY changed. Please reenter your Credentials.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        deleteLogin("", true);
                        tbcLogin.SelectTab(tbpNewLogin);
                    }
                }
            }
            if (!(lvLogins.Items.Count > 0))
            {
                tbcLogin.SelectTab(tbpNewLogin);
            }
        }
Example #2
0
 private void queryUser(string user)
 {
     ClearFileds();
     usrToUpdate = dLibAd.locateUsr(new PrincipalContext(ContextType.Domain, frmMain.domainAccountData[0], frmMain.domainAccountData[1], frmMain.domainAccountData[2]), user);
     if (usrToUpdate != null)
     {
         this.Text            = "";
         lblAccount.Text      = usrToUpdate.Account;
         lblFirstName.Text    = usrToUpdate.FirstName;
         lblLastName.Text     = usrToUpdate.LastName;
         lblFullName.Text     = usrToUpdate.DisplayName;
         lblMail.Text         = usrToUpdate.Email;
         pEmployee.Image      = usrToUpdate.Photo;
         lblLocation.Text     = usrToUpdate.Location;
         lblDivision.Text     = usrToUpdate.Division;
         lblPhone.Text        = usrToUpdate.Phone;
         lblCreationDate.Text = usrToUpdate.CreationDate;
         lblChangedDate.Text  = usrToUpdate.ChangedDate;
         if (usrToUpdate.Status.Contains("Locked"))
         {
             lblAccountStatus.ForeColor = Color.Red;
         }
         else
         {
             lblAccountStatus.ForeColor = Color.Blue;
         }
         lblAccountStatus.Text      = usrToUpdate.Status;
         lblLastBadPassword.Text    = usrToUpdate.LastBadPasswordAttempt.ToString();
         lblLastPasswordChange.Text = usrToUpdate.LastPasswordChange.ToString();
         this.Text = usrToUpdate.Account;
     }
 }
Example #3
0
        private void tvResults_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if ((tvResults.SelectedNode.Parent != null) && (tvResults.SelectedNode.Text != string.Empty))
            {
                switch (tvResults.SelectedNode.Parent.Name)
                {
                case "users":
                    try
                    {
                        dLibAd.adUsers selectedUser = dLibAd.locateUsr(new PrincipalContext(ContextType.Domain, frmMain.domainAccountData[0], frmMain.domainAccountData[1], frmMain.domainAccountData[2]), tvResults.SelectedNode.Text.Split(',')[1]);
                        if ((selectedUser != null) && (selectedUser.Photo != null))
                        {
                            selectedUserPic.Image     = selectedUser.Photo;
                            splitMain.Panel2Collapsed = false;
                        }
                    }
                    catch
                    {
                        splitMain.Panel2Collapsed = true;
                    }
                    break;

                default:
                    splitMain.Panel2Collapsed = true;
                    break;
                }
            }
        }
Example #4
0
        private void loadLoginsKeys()
        {
            lvLogins.Items.Clear();
            RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Seeker", true);

            if (key != null)
            {
                foreach (string keyItem in key.GetSubKeyNames())
                {
                    dLibAd.adUsers loginUser = loadLogin(keyItem, cbBoxDomains.SelectedItem.ToString());
                    if (loginUser != null)
                    {
                        ListViewItem loginItem = new ListViewItem();
                        loginItem.Name = loginUser.Account;
                        loginItem.Text = loginUser.Account;
                        loginItem.Tag  = loginUser;
                        lvLogins.Items.Add(loginItem);
                    }
                }
            }
            if (!(lvLogins.Items.Count > 0))
            {
                tbcLogin.SelectTab(tbpNewLogin);
            }
        }
Example #5
0
        private dLibAd.adUsers loadLogin(string user, string domain)
        {
            string decUser = "";

            dLibAd.adUsers userObject = new dLibAd.adUsers();
            RegistryKey    key        = Registry.CurrentUser.OpenSubKey(@"Software\Seeker\" + user, false);

            if (key != null)
            {
                decUser    = dLibCypher.DecText(key.GetValue("0").ToString(), "OC7Wwx9vui*y6ltCTv,e*u$z+4Hv:o%uSYZB5P7dpaYa5N.zsx.SP]lvAL7k50dA");
                userObject = dLibAd.locateUsr(new PrincipalContext(ContextType.Domain, cbBoxDomains.SelectedItem.ToString()), decUser);
                if (userObject != null)
                {
                    userObject.StructClass = key.GetValue("0").ToString() + "|" + key.GetValue("1").ToString();
                }
            }
            return(userObject);
        }
Example #6
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            bool   isValid = false;
            string domain = string.Empty, user = string.Empty, pass = string.Empty;

            Thread thLogin;

            thLogin = new Thread(() =>
            {
                try
                {
                    using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, domain))
                    {
                        isValid = pc.ValidateCredentials(user, pass);
                    }
                }
                catch (Exception ex)
                {
                    this.Invoke((MethodInvoker) delegate {
                        updateProgress(0);
                        cbBoxDomains.Items.Clear();
                        cbBoxDomains.Items.Add("Domain is Off-line");
                        cbBoxDomains.SelectedIndex = 0;
                        cbBoxDomains.BackColor     = System.Drawing.Color.Salmon;
                    });
                    Thread.CurrentThread.Abort();
                }

                if (isValid)
                {
                    userAccount             = dLibAd.locateUsr(new PrincipalContext(ContextType.Domain, domain, user, pass), user);
                    userAccount.StructClass = domain + "|" + user + "|" + pass;

                    frmMain.domainAccountData   = new string[] { domain, user, pass };
                    frmMain.domainAccountObject = userAccount;
                    if (ckBoxSaveCredentials.Checked)
                    {
                        saveLogin(domain, user, pass);
                    }
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    this.Invoke((MethodInvoker) delegate
                    {
                        MessageBox.Show("Invalid Credentials", "Something went Wrong...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        updateProgress(0);
                    });
                }
            });


            //Start Login Process
            if (cbBoxDomains.SelectedItem != null)
            {
                domain = cbBoxDomains.SelectedItem.ToString();
            }
            else
            {
                domain = cbBoxDomains.Text.Trim();
            }

            Ping      pingDC      = new Ping();
            PingReply pingDCReply = null;

            try
            {
                pingDCReply = pingDC.Send(domain, 120);
            }
            catch { }
            if ((pingDCReply != null) && (pingDCReply.Status == IPStatus.Success))
            {
                if (lvLogins.SelectedItems.Count > 0)
                {
                    dLibAd.adUsers currentSelectedUser = (dLibAd.adUsers)lvLogins.SelectedItems[0].Tag;
                    user = dLibCypher.DecText(currentSelectedUser.StructClass.Split('|')[0], "OC7Wwx9vui*y6ltCTv,e*u$z+4Hv:o%uSYZB5P7dpaYa5N.zsx.SP]lvAL7k50dA");
                    pass = dLibCypher.DecText(currentSelectedUser.StructClass.Split('|')[1], "OC7Wwx9vui*y6ltCTv,e*u$z+4Hv:o%uSYZB5P7dpaYa5N.zsx.SP]lvAL7k50dA");
                    updateProgress(1);
                    thLogin.Start();
                }
                else
                {
                    if (txtBoxUser.Text != string.Empty && txtBoxUser.Text != string.Empty)
                    {
                        user = txtBoxUser.Text;
                        pass = txtBoxPass.Text;
                        updateProgress(1);
                        thLogin.Start();
                    }
                    else
                    {
                        MessageBox.Show("You have to enter your Credentials first!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                cbBoxDomains.Items.Clear();
                cbBoxDomains.Items.Add("Domain is Off-line");
                cbBoxDomains.SelectedIndex = 0;
                cbBoxDomains.BackColor     = System.Drawing.Color.Salmon;
            }
        }
Example #7
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            bool   isValid = false;
            string domain = string.Empty, user = string.Empty, pass = string.Empty;

            Thread thLogin;

            thLogin = new Thread(() =>
            {
                try
                {
                    using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, domain))
                    {
                        isValid = pc.ValidateCredentials(user, pass);
                    }
                }
                catch (Exception ex)
                {
                    EventLog.WriteEntry("Seeker",
                                        "Can't authenticate User: "******"\" + user +
                                        "\n\nMessage: " + ex.Message +
                                        "\n\nSource: " + ex.Source +
                                        "\n\nStack: " + ex.StackTrace +
                                        "\n\nTarget: " + ex.TargetSite, EventLogEntryType.Error, 3310, 00);
                }

                if (isValid)
                {
                    userAccount             = dLibAd.locateUsr(new PrincipalContext(ContextType.Domain, domain, user, pass), user);
                    userAccount.StructClass = domain + "|" + user + "|" + pass;

                    frmMain.domainAccountData   = new string[] { domain, user, pass };
                    frmMain.domainAccountObject = userAccount;
                    if (ckBoxSaveCredentials.Checked)
                    {
                        saveLogin(domain, user, pass);
                    }
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    this.Invoke((MethodInvoker) delegate
                    {
                        MessageBox.Show("Invalid Credentials", "Something went Wrong...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        updateProgress(0);
                    });
                }
            });


            //Start Login Process
            if (cbBoxDomains.SelectedItem != null)
            {
                domain = cbBoxDomains.SelectedItem.ToString();
            }
            else
            {
                domain = cbBoxDomains.Text.Trim();
            }

            if (lvLogins.SelectedItems.Count > 0)
            {
                dLibAd.adUsers currentSelectedUser = (dLibAd.adUsers)lvLogins.SelectedItems[0].Tag;
                user = dLibCypher.DecText(currentSelectedUser.StructClass.Split('|')[0], "OC7Wwx9vui*y6ltCTv,e*u$z+4Hv:o%uSYZB5P7dpaYa5N.zsx.SP]lvAL7k50dA");
                pass = dLibCypher.DecText(currentSelectedUser.StructClass.Split('|')[1], "OC7Wwx9vui*y6ltCTv,e*u$z+4Hv:o%uSYZB5P7dpaYa5N.zsx.SP]lvAL7k50dA");
                updateProgress(1);
                thLogin.Start();
            }
            else
            {
                if (txtBoxUser.Text != string.Empty && txtBoxUser.Text != string.Empty)
                {
                    user = txtBoxUser.Text;
                    pass = txtBoxPass.Text;
                    updateProgress(1);
                    thLogin.Start();
                }
                else
                {
                    MessageBox.Show("You have to enter your Credentials first!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }