申明:本帖只用于学习(其实是我自己记录下免得以后忘了),不发成品,大家也别问我要.
用到的工具de4dot,dnspy,vs2019
前几天老板变态的需求,非要把上万个工程的Excel文件转成html让其他人访问,目的是不想让人下载,随便吧,老板最大.
但同一进程打开100个以上文件就报错,于是就出现了上一篇文章.(其实写个进程重新开就行了,不过谁让.net的程序破解简单呢…)
然后逛论坛的时候发现了这个https://www.52pojie.cn/forum.php?mod=viewthread&tid=1116770
然后就觉得可以搞搞,锻炼锻炼智商.
根据该楼主的思路,下了个2012年版本的aspose.cell.开始研究.
先de4net去花,然后dnspy跑起来.(楼主说跑不起来要报错…报错你跳过就是了嘛,反正就只研究注册部分)
以下是部分程序片段
internal void method_1(Stream stream_0)
{
if (stream_0 == null)
{
throw new ArgumentNullException("stream");
}
Class827.smethod_3(0);
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(stream_0);
this.method_2(xmlDocument);
Hashtable hashtable = Class828.hashtable_0;
if (hashtable == null)
{
//hashtable = new Hashtable();
hashtable = Class828.smethod_10();
Class828.hashtable_0 = hashtable;
}
if (hashtable.ContainsKey(this.string_1))
{
throw new InvalidOperationException("This license is disabled, please contact Aspose to obtain a new license.");
}
if (Class827.smethod_2() > 0)
{
return;
}
bool flag = false;
string[] array = this.string_0;
int i = 0;
while (i < array.Length)
{
string text = array[i];
if (!text.Equals("Aspose.Total") && !text.Equals("Aspose.Total for .NET") && !text.Equals("Aspose.Cells for .NET") && !text.Equals("Aspose.Cells Product Family") && !text.Equals("Aspose.Total Product Family") && !text.Equals("Aspose.Cells"))
{
i++;
}
else
{
flag = true;
if (!flag)
{
throw new InvalidOperationException("The license is not valid for this product.");
}
DateTime t = DateTime.ParseExact("2012.01.16", "yyyy.MM.dd", CultureInfo.InvariantCulture);
if (t > this.dateTime_0)
{
throw new InvalidOperationException(string.Format("The subscription included in this license allows free upgrades until {0}, but this version of the product was released on {1}. Please renew the subscription or use a previous version of the product.", this.dateTime_0.ToString("dd MMM yyyy", CultureInfo.InvariantCulture), t.ToString("dd MMM yyyy", CultureInfo.InvariantCulture)));
}
if (DateTime.Now > this.dateTime_1)
{
throw new InvalidOperationException("The license has expired.");
}
this.enum127_0 = Enum127.const_1;
Class828.class828_0 = this;
return;
}
}
if (!flag)
{
throw new InvalidOperationException("The license is not valid for this product.");
}
DateTime t1 = DateTime.ParseExact("2012.01.16", "yyyy.MM.dd", CultureInfo.InvariantCulture);
if (t1 > this.dateTime_0)
{
throw new InvalidOperationException(string.Format("The subscription included in this license allows free upgrades until {0}, but this version of the product was released on {1}. Please renew the subscription or use a previous version of the product.", this.dateTime_0.ToString("dd MMM yyyy", CultureInfo.InvariantCulture), t1.ToString("dd MMM yyyy", CultureInfo.InvariantCulture)));
}<