从Chrome SQLite Cookie数据库读取时为空值 [英] Null values when reading from Chrome SQLite cookie database

查看:89
本文介绍了从Chrome SQLite Cookie数据库读取时为空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C#Chrome SQLite值未读?已读取Mozilla Cookie值,但Chrome Cookie值为 null .读取此Cookie值的正确方法是什么?

C# Chrome SQLite value not read ? Mozilla cookie value read but chrome cookie value null. What is the correct way to read this cookie value?

//String connString = "Data Source=C:\\Users\\XXXX\\AppData\\Roaming\\Opera Software\\Opera Stable\\Cookies;Version=3;New=False;Compress=True;";
String connString = "Data Source=C:\\Users\\XXXX\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Cookies;Version=3;New=False;Compress=True;";
//String connString = "Data Source=C:\\Users\\XXXX\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\eac8q0hd.default\\cookies.sqlite";
using (SQLiteConnection conn = new SQLiteConnection(connString))
{
   StringBuilder query = new StringBuilder();
   //chrome
   query.Append("SELECT value FROM cookies WHERE host_key LIKE '%.search.cpan.org%' AND name LIKE '%__utmc%';");
   //mozilla
   //query.Append("SELECT value FROM moz_cookies WHERE host LIKE '%.oasgames.com%' AND name LIKE '%__utmz%';");
   //query.Append("ORDER BY name");
   using (SQLiteCommand cmd = new SQLiteCommand(query.ToString(), conn))
   {
      conn.Open();
      using (SQLiteDataReader dr = cmd.ExecuteReader())
      {
         while (dr.Read())
         {
            textBox1.Text = dr.GetValue(0).ToString();
            // textBox1.Text = dr.GetValue(0) + " " + dr.GetValue(1) + " " + dr.GetValue(2) + " " + dr.GetValue(3) + " " + dr.GetValue(4) + " " + dr.GetValue(5);
         }
      }
   }
}

推荐答案

这些值已加密并存储为"encrypted_value".您将无法读取该值,但可以读取存储在"encrypted_value"中的Blob.

The values are encrypted and stored as "encrypted_value". You will not be able to read the value, but can read the blob stored in "encrypted_value".

如果要读取该值,则可以编写PowerShell脚本对其进行解密: https://stackoverflow.com/a/38701402

If you want to read the value, you could write a PowerShell script to decrypt it: https://stackoverflow.com/a/38701402

我正在读取加密值,以确保其中存在一个值

I'm reading just the encrypted value to make sure that there is a value there

SELECT encrypted_value FROM cookies WHERE host_key LIKE '%XXX%' AND name LIKE '%XXXX%';

这篇关于从Chrome SQLite Cookie数据库读取时为空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆