【发布时间】:2021-03-15 01:43:19
【问题描述】:
我正在尝试从 Chrome 数据库中检索密码,它在使用 Python 时运行良好,但在使用 C# 时我得到不同的字节。
python代码在从数据库中查询密码时返回以下内容(十六进制值“76 31 30”是v10部分):
0x76 0x31 0x30 0xd2 0x72 0x89 0xc7 0xcf ...
C# 代码...
string passwordColumn = reader.GetString(3); // returns third column
byte[] passBytes= Encoding.UTF8.GetBytes(passwordColumn); // get bytes from string
Console.WriteLine(BitConverter.ToString(passBytes)); // pretty print
...返回以下内容:
76-31-30-EF-BF-BD-72-EF-BF-BD-EF-BF-BD ...
为什么我所做的所有其他查询都返回正确的字符串,但只有当我想要 password_value 列时它才正确返回前三个字节?
有趣的是,当我尝试用这个检查字节时:
foreach (int a in passwordColumn) {
Console.WriteLine(a);
}
我得到这个作为输出:
118
49
48
65533
114
65533
65533
65533
88
114
106
65533
65533
...
只有不是 65533 的值才是正确的,这是为什么呢?为什么有些字节是正确的,而其他的却不是?最重要的是:如何解决这个问题?
【问题讨论】:
-
可能和你使用的驱动有关。我不确定。数据库名称是什么,有机会我可以试一试。
-
@NoChance 我尝试使用 .NET 5 和 .NET Framework 4.7.2、System.Data.SQLite 和 Microsoft.Data.Sqlite,在每种情况下我都得到了相同的结果。数据库名称为“Login Data”,位于“AppData\Local\Google\Chrome\User Data\Default\Login Data”
标签: c# .net database sqlite google-chrome