最近在反编译一款.NET程序,其配置文件中的字符串为加密的.经反编译后,发现
1.字符串加密涵数EncryptDES如下:
public static string EncryptDES(string encryptString, string encryptKey)
{
MemoryStream stream;
CryptoStream stream2;
byte[] bytes = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 8));
byte[] rgbIV = xbd492d4fc8202882;
byte[] buffer = Encoding.UTF8.GetBytes(encryptString);
do
{
DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
stream = new MemoryStream();
stream2 = new CryptoStream(stream, provider.CreateEncryptor(bytes, rgbIV), CryptoStreamMode.Write);
}
while (0x7fffffff == 0);
stream2.Write(buffer, 0, buffer.Length);
stream2.FlushFinalBlock();
return Convert.ToBase64String(stream.ToArray());
}
2.字符串解密涵数DecryptDES如下:
public static string DecryptDES(string decryptString, string decryptKey)
{
string str;
try
{
byte[] buffer2;
byte[] buffer3;
DESCryptoServiceProvider provider;
MemoryStream stream;
byte[] bytes = Encoding.UTF8.GetBytes(decryptKey.Substring(0, 8));
if (-2 != 0)
{
goto Label_0067;
}
Label_001C:
do
{
stream = new MemoryStream();
}
while (0 != 0);
CryptoStream stream2 = new CryptoStream(stream, provider.CreateDecryptor(bytes, buffer2), CryptoStreamMode.Write);
stream2.Write(buffer3, 0, buffer3.Length);
stream2.FlushFinalBlock();
str = Encoding.UTF8.GetString(stream.ToArray());
if (0xff != 0)
{
return str;
}
Label_0067:
buffer2 = xbd492d4fc8202882;
buffer3 = Convert.FromBase64String(decryptString);
provider = new DESCryptoServiceProvider();
goto Label_001C;
}
catch
{
str = decryptString;
}
return str;
}
3.读取配置文件中字符串的涵数如下:
public bool GetSoftConfig(ref string dwName, ref string dwCode, ref double minx, ref double maxx, ref double miny, ref double maxy)
{
bool flag;
try
{
XmlDocument document;
string str;
XmlElement element;
bool flag2 = File.Exists(this.xbece5211ea7dc225);
goto Label_0156;
Label_0014:
if (2 == 0)
{
goto Label_0040;
}
flag = true;
if (1 == 0)
{
goto Label_00DF;
}
return flag;
Label_002C:
if ((((uint) flag) & 0) != 0)
{
goto Label_00BB;
}
Label_0040:
element = (XmlElement) document.SelectSingleNode("RSC/YMin");
miny = double.Parse(StringOperate.DecryptDES(element.InnerText, str));
element = (XmlElement) document.SelectSingleNode("RSC/YMax");
maxy = double.Parse(StringOperate.DecryptDES(element.InnerText, str));
if (((uint) flag) >= 0)
{
goto Label_0014;
}
Label_009C:
element = (XmlElement) document.SelectSingleNode("RSC/CODE");
dwCode = StringOperate.DecryptDES(element.InnerText, str);
Label_00BB:
element = (XmlElement) document.SelectSingleNode("RSC/XMin");
minx = double.Parse(StringOperate.DecryptDES(element.InnerText, str));
Label_00DF:
element = (XmlElement) document.SelectSingleNode("RSC/XMax");
maxx = double.Parse(StringOperate.DecryptDES(element.InnerText, str));
goto Label_002C;
Label_0110:
document = new XmlDocument();
document.Load(this.xbece5211ea7dc225);
str = "";
str = "&_e@dD(7";
element = (XmlElement) document.SelectSingleNode("RSC/NAME");
dwName = StringOperate.DecryptDES(element.InnerText, str);
goto Label_009C;
Label_0156:
if (!flag2)
{
return false;
}
goto Label_0110;
}
catch
{
flag = false;
}
return flag;
}
由于我对.NET和 C#一点不懂(好像是DES+Base64的字符加解密,向量IV = 0xbd492d4fc8202882,密钥=&_e@dD(7),求助各位高手大虾,能否根据上面提供的信息,提供一个针对该程序结构的字符串加解密的工具.谢谢!
另密文格式(>.......<之间的码):
<YMax>8mugAHINQHLROK+L9P3PNDjLd/lpg+c4</YMax>
<NAME>pfLibu2hWPmEZNtm6DfCig==</NAME>
能提供有效加解密工具的,奖100Kx
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)