Skip to content

Commit

Permalink
Updated cookies parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzer0 committed Jul 5, 2022
1 parent a35b591 commit 640bb55
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 7 additions & 5 deletions ChloniumUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,20 +315,20 @@ private void ImportCookies(List<Item> items)
if (hasTopFrameSiteKey)
{
cmd = new SQLiteCommand("INSERT INTO cookies (creation_utc, top_frame_site_key, host_key, name, value, " +
"path, expires_utc, is_secure, is_httponly, last_access_utc, has_expires, is_persistent, " +
"path, expires_utc, is_secure, is_httponly, last_access_utc, last_update_utc, has_expires, is_persistent, " +
"priority, encrypted_value, samesite, source_scheme, source_port, is_same_party) VALUES" +
" (@creation_utc, @top_frame_site_key, @host_key, @name, @value, @path, @expires_utc, @is_secure," +
"@is_httponly, @last_access_utc, @has_expires, @is_persistent, @priority, " +
"@is_httponly, @last_access_utc, @last_update_utc, @has_expires, @is_persistent, @priority, " +
"@encrypted_value, @samesite, @source_scheme, @source_port, @is_same_party)", con);
cmd.Parameters.AddWithValue("@top_frame_site_key", "");
}
else
{
cmd = new SQLiteCommand("INSERT INTO cookies (creation_utc, host_key, name, value, " +
"path, expires_utc, is_secure, is_httponly, last_access_utc, has_expires, is_persistent, " +
"path, expires_utc, is_secure, is_httponly, last_access_utc, last_update_utc, has_expires, is_persistent, " +
"priority, encrypted_value, samesite, source_scheme, source_port, is_same_party) VALUES" +
" (@creation_utc, @host_key, @name, @value, @path, @expires_utc, @is_secure," +
"@is_httponly, @last_access_utc, @has_expires, @is_persistent, @priority, " +
"@is_httponly, @last_access_utc, @last_update_utc, @has_expires, @is_persistent, @priority, " +
"@encrypted_value, @samesite, @source_scheme, @source_port, @is_same_party)", con);
}

Expand All @@ -341,6 +341,7 @@ private void ImportCookies(List<Item> items)
cmd.Parameters.AddWithValue("@is_secure", c.is_secure);
cmd.Parameters.AddWithValue("@is_httponly", c.is_httponly);
cmd.Parameters.AddWithValue("@last_access_utc", c.last_access_utc);
cmd.Parameters.AddWithValue("@last_update_utc", c.last_update_utc);
cmd.Parameters.AddWithValue("@has_expires", c.has_expires);
cmd.Parameters.AddWithValue("@is_persistent", c.is_persistent);
cmd.Parameters.AddWithValue("@priority", c.priority);
Expand Down Expand Up @@ -472,7 +473,7 @@ private List<Item> ExportCookies()
// open the Cookie db
string cs = string.Format("Data Source={0};", this.inputFile);
string stm = "SELECT creation_utc, host_key, name, value, " +
"path, expires_utc, is_secure, is_httponly, last_access_utc, " +
"path, expires_utc, is_secure, is_httponly, last_access_utc, last_update_utc," +
"has_expires, is_persistent, priority, encrypted_value, " +
"samesite, source_scheme, source_port, is_same_party FROM cookies ORDER BY host_key;";
SQLiteConnection con = new SQLiteConnection(cs);
Expand Down Expand Up @@ -544,6 +545,7 @@ private List<Item> ExportCookies()
is_secure = reader.GetBoolean(6),
is_httponly = reader.GetBoolean(7),
last_access_utc = reader.GetInt64(8),
last_update_utc = reader.GetInt64(8),
has_expires = reader.GetBoolean(9),
is_persistent = reader.GetBoolean(10),
priority = reader.GetInt16(11),
Expand Down
5 changes: 3 additions & 2 deletions ChloniumUI/SharpDPAPI/SharpChrome/lib/Chrome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,10 @@ public static void ParseChromeCookies(Dictionary<string, string> MasterKeys, str
//string query = "SELECT cast(creation_utc as text) as creation_utc, host_key, name, path, cast(expires_utc as text) as expires_utc, is_secure, is_httponly, cast(last_access_utc as text) as last_access_utc, encrypted_value FROM cookies";

// new, seems to work with partial indexing?? "/giphy table flip"
string query = "SELECT cast(creation_utc as text) as creation_utc, host_key, name, path, cast(expires_utc as text) as expires_utc, cast(last_access_utc as text) as last_access_utc, encrypted_value FROM cookies";
string query = "SELECT cast(creation_utc as text) as creation_utc, host_key, name, path, cast(expires_utc as text) as expires_utc, cast(last_access_utc as text) as last_access_utc,cast(last_update_utc as text) as last_update_utc encrypted_value FROM cookies";
List<SQLiteQueryRow> results = database.Query2(query, false);


// used if cookies "never expire" for json output
DateTime epoch = new DateTime(1601, 1, 1);
TimeSpan timespan = (DateTime.Now).AddYears(100) - epoch;
Expand Down Expand Up @@ -692,7 +693,7 @@ public static void ParseChromeCookies(Dictionary<string, string> MasterKeys, str
{
Console.WriteLine("SEP=,");
}
Console.WriteLine("file_path,host,path,name,value,creation_utc,expires_utc,last_access_utc");
Console.WriteLine("file_path,host,path,name,value,creation_utc,expires_utc,last_access_utc, last_update_utc");
}
someResults = true;

Expand Down

0 comments on commit 640bb55

Please sign in to comment.