Пример #1
0
        private void UpdateAuthorisedConnections()
        {
            KeyContainerClass[] kcs       = FindAuthorisedConnections();
            bool anyConnectionCompromised = false;

            if (kcs == null)
            {
                // Tell the user it's not worked.
                dataGridView1.Visible = false;
                labelAuthorisedClientsFail.Visible = true;
                return;
            }

            List <string> connectedClientUsernames = new List <string>();

            foreach (KeePassRPCClientConnection client in _plugin.GetConnectedRPCClients())
            {
                if (!string.IsNullOrEmpty(client.UserName))
                {
                    connectedClientUsernames.Add(client.UserName);
                }
            }

            // Update the screen
            foreach (KeyContainerClass kc in kcs)
            {
                bool connected = false;
                if (connectedClientUsernames.Contains(kc.Username))
                {
                    connected = true;
                }

                string[] row   = new string[] { kc.ClientName, kc.Username, kc.AuthExpires.ToString() };
                int      rowid = dataGridView1.Rows.Add(row);
                dataGridView1.Rows[rowid].Cells[3].Value = connected;

                bool compromised = kc.Key == "5feceb66ffc86f38d952786c6d696c79c2dbc239dd4e91b46729d73a27fb57e9";
                if (compromised)
                {
                    anyConnectionCompromised = true;
                    dataGridView1.Rows[rowid].DefaultCellStyle.ForeColor = Color.DarkRed;
                }
            }

            if (anyConnectionCompromised)
            {
                MessageBox.Show(@"Your KeePass instance may have previously been exploited by a malicious attacker.

The passwords contained within any databases that were open before this point may have been exposed so you should change them.

Suspicious clients will be listed in red on the Authorised clients tab.

See https://forum.kee.pm/t/3143/ for more information.",
                                "WARNING!",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }

            return;
        }
Пример #2
0
        private void UpdateAuthorisedConnections()
        {
            KeyContainerClass[] kcs = FindAuthorisedConnections();

            if (kcs == null)
            {
                // Tell the user it's not worked.
                dataGridView1.Visible = false;
                labelAuthorisedClientsFail.Visible = true;
                return;
            }

            List <string> connectedClientUsernames = new List <string>();

            foreach (KeePassRPCClientConnection client in _plugin.GetConnectedRPCClients())
            {
                if (!string.IsNullOrEmpty(client.UserName))
                {
                    connectedClientUsernames.Add(client.UserName);
                }
            }

            // Update the screen
            foreach (KeyContainerClass kc in kcs)
            {
                bool connected = false;
                if (connectedClientUsernames.Contains(kc.Username))
                {
                    connected = true;
                }

                string[] row   = new string[] { kc.ClientName, kc.Username, kc.AuthExpires.ToString() };
                int      rowid = dataGridView1.Rows.Add(row);
                dataGridView1.Rows[rowid].Cells[3].Value = connected;
            }
            return;
        }