以下文章解釋瞭如何在不使用WinAPI(advapi32.dll)的情況下分析註冊表文件。在這種特殊情況下的傢伙是使用單聲道:
http://volatile-minds.blogspot.com/2011/01/analyzing-windows-nt-registry-without.html
using (FileStream fs = File.OpenRead (path)) {
var data = new byte[checked((int)fs.Length)];
int i = 0;
int read;
using (var ms = new MemoryStream (checked((int)fs.Length))) {
while ((read = fs.Read (data, 0, data.Length)) > 0) {
ms.Write (data, 0, read);
i += read;
}
byte[] hive = ms.ToArray();
char[] cList = new char[fs.Length];
i = 0;
foreach (byte b in hive)
cList[i++] = (char)b;
string d = new string (cList);
int all = 0;
foreach (Match mx in lf.Matches (d)) { //you can change out the regex you want here.
byte[] bb = new byte[mx.Value.Length];
char[] cb = new char[mx.Value.Length];
for (int k = 0; k < mx.Value.Length; k++) {
bb[k] = (byte)mx.Value[k];
cb[k] = (char)bb[k];
}
all++;
//Console.WriteLine (new string (cb));
}
Console.WriteLine (all.ToString());
all = 0;
}
}
我其實寫了上面的代碼,那是我的博客。該代碼真的很糟糕,我不推薦使用它。我確實在Ruby中寫了一個[真正的脫機註冊表閱讀庫](https://github.com/brandonprry/ntreg-ruby),並且一個使用它的工具在Metasploit框架(tools/reg.rb)中。最終我也將在C#中實現這個庫,但不會很快。 – 2012-08-05 22:00:21
@ user1577946:4年後。做了什麼? – 2016-08-05 12:26:09