我正在尝试进行逆向工程,并从 .NET 开始,尝试我在互联网上找到的各种 CrackMes 和 KeygenMes。到目前为止,我还没有真正挣扎过,但最新的这个让我发疯:
https://tuts4you.com/download.php?view.1894
VT 链接(如果需要):https : //www.virustotal.com/en/file/9bd07d7cbd053f6ad27792487679b18b2f72b589440d8ab81f9cdc4d84301178/analysis/1454947890/
使用 ILSpy 反编译显示执行的许可证检查:
FileStream fileStream = new FileStream("key.dat", FileMode.Open, FileAccess.Read);
StreamReader streamReader = new StreamReader(fileStream);
string text = streamReader.ReadToEnd();
byte[] bytes = Encoding.Unicode.GetBytes(this.TextBox1.Text);
SHA512 sHA = new SHA512Managed();
sHA.ComputeHash(bytes);
if (Operators.ConditionalCompareObjectEqual(this.CodeCrypt(text), Convert.ToBase64String(sHA.Hash), true))
{
Interaction.MsgBox("Good job, make a keymaker", MsgBoxStyle.Information, "Done");
}
else
{
Interaction.MsgBox("Try again, it is very simple", MsgBoxStyle.Critical, "No ....");
}
streamReader.Close();
fileStream.Close();
这是 CodeCrypt 方法:
Key = "AoRE";
public string CodeCrypt(string text)
{
string text2 = "";
int arg_0F_0 = 1;
int num = Strings.Len(text);
checked
{
for (int i = arg_0F_0; i <= num; i++)
{
int num2 = i % Strings.Len(this.Key);
if (num2 == 0)
{
num2 = Strings.Len(this.Key);
}
text2 += Conversions.ToString(Strings.Chr(Strings.Asc(Strings.Mid(this.Key, num2, 1)) ^ Strings.Asc(Strings.Mid(text, i, 1)) - 6));
}
return text2;
}
}
看起来很简单,所以我生成了自己的密钥生成方法:
private static string Key(string name)
{
string key = "";
SHA512 sHA = new SHA512Managed();
string hash = Convert.ToBase64String(sHA.ComputeHash(Encoding.Unicode.GetBytes(name)));
for (int i = 1; i <= hash.Length; i++)
{
int num2 = i % 4;
if (num2 == 0)
{
num2 = 4;
}
var test = Convert.ToChar(("AoRE"[num2 - 1] ^ hash[i - 1]) + 6);
key += test;
}
return key;
}
然后我写了我的许可证:
using (StreamWriter sw = new StreamWriter(File.Open("key.dat", FileMode.Create), Encoding.Unicode))
sw.Write(Key("Tom"));
但它失败了。我设置了一个断点来查看 CodeCrypt() 和 SHA512 哈希的输出是什么,并看到了这个:
CodeCrypt:8dmVQYHqap7MbFngePjLSxvaC9 ķ VgaDiyR2p550IFO2kzGAuC9yWufBs5LZGbKeR / KAFGVTBb47z4sa686eBTA == SHA512:8dmVQYHqap7MbFngePjLSxvaC9 / VgaDiyR2p550IFO2kzGAuC9yWufBs5LZGbKeR / KAFGVTBb47z4sa686eBTA ==
这些输出中的第 27 个字符不同,我只是不明白为什么。我在这里错过了什么?
提前致谢。