Shark_鹏 发表于 2015-3-24 22:58

一个.NET软件的破解过程

[ 逆向工具 ] UEDIT32,Reflector,DotNet Helper
[ 逆向平台 ] Windows XP SP2
[ 软件名称 ] XX数学软件
[ 保护方式 ] 无壳
[ 软件简介 ] Microsoft Visual C# / Basic .NET
[ 逆向声明 ] 应SCS成员小杨写的一个,高人不要看了,太简单了,不会的看一下就不要笑偶了,呵呵
-----------------------------------------------------
[ 逆向过程 ]-----------------------------------------

先用PDIE查壳吧,无壳,是个Microsoft Visual C# / Basic .NET编写的家伙


先运行软件观察一下有什么限制吧,发现过期后会弹出一大堆的网页,很烦的啦,所认我们要干掉他。

此软件为一个重启注册软件,所以看上去有点麻烦,呵呵,还好这个软件只要改到两处。

第一处:

再看一下注册方式,这时我们打开Reflector导入REG.DLL,找到我们注册的地方

public bool Check(string reg)
{
    if (reg == this.Md5())
    {
      this.Info.RegCode = reg;
      this.Info.IsReg = 3;      此位置是判断注册,如果为3就是注册成功
      this.SetReg();
      this.SetFile();
      Mail mail = new Mail(this.Info.Email);
      mail.Info.Name = this.Info.SoftName + " " + this.Ver;
      mail.Info.Subject = "软件注册成功!";                     软件注册成功
      mail.Info.Body = "用户:" + this.Info.Computer + "<br>序列号:" + this.MacCode + "<br>版本:" + this.Ver + "<br>软件号:"

+ this.Info.Soft.ToString() + "<br>总使用次数:" + this.Info.UseCount.ToString();
      mail.Send();
      return true;
    }
    return false;
}


这时我们打开先用DotNet Helper反编译成代码再打开UEDIT32将下面位置改动

IL_0000:nop
    IL_0001:ldarg.1
    IL_0002:ldarg.0
    IL_0003:call       instance string LibReg.Reg::Md5()
    IL_0008:call       bool System.String::op_Equality(string,
                                                                   string)
    IL_000d:ldc.i4.0            改成ldc.i4.1
    IL_000e:ceq
    IL_0010:stloc.2
    IL_0011:ldloc.2
    IL_0012:brtrue   IL_0118

    IL_0017:nop
    IL_0018:ldarg.0
    IL_0019:ldflda   valuetype LibReg.Reg/RegInfo LibReg.Reg::Info
    IL_001e:ldarg.1
    IL_001f:stfld      string LibReg.Reg/RegInfo::RegCode
    IL_0024:ldarg.0
    IL_0025:ldflda   valuetype LibReg.Reg/RegInfo LibReg.Reg::Info




第二处:


我们再用Reflector查看哪里在比较

private void Check()
{
   Mail mail;
   Dictionary<int, string> data = new Dictionary<int, string>();
   Dictionary<int, string> dictionary2 = new Dictionary<int, string>();
   bool flag = this.CheckReg(ref data);
   bool flag2 = this.CheckFile(ref dictionary2);
   if (!(flag || flag2))
   {
       this.Info.MacCode = this.GetCode();
       mail = new Mail(this.Info.Email);
       mail.Info.Name = this.Info.SoftName + " " + this.Ver;
       mail.Info.Subject = "第一次使用";
       mail.Info.Body = "用户:" + this.Info.Computer + "<br>序列号:" + this.MacCode + "<br>版本:" + this.Ver + "<br>软件号:"

+ this.Info.Soft.ToString();
       mail.Send();
   }
   else if (flag && flag2)
   {
       for (int i = 0; i < 4; i++)
       {
         if (data != dictionary2)
         {
               this.Info.MacCode = this.GetCode();
               if (dictionary2 == this.Info.MacCode)
               {
                   flag = false;
               }
               else if (data == this.Info.MacCode)
               {
                   flag2 = false;
               }
               else
               {
                   flag = false;
                   flag2 = false;
               }
               break;
         }
       }
   }
   if (flag)
   {
       this.Info.Computer = data;
       this.Info.MacCode = data;
       this.Info.RegCode = data;
       this.Info.StartDate = Convert.ToInt64(data);
   }
   if (flag2)
   {
       this.Info.Computer = dictionary2;
       this.Info.MacCode = dictionary2;
       this.Info.RegCode = dictionary2;
       this.Info.StartDate = Convert.ToInt64(dictionary2);
       this.Info.LastDate = Convert.ToInt64(dictionary2);
       this.Info.UseCount = Convert.ToInt32(dictionary2) + 1;
   }
   if (this.Info.RegCode == this.Md5())
   {
       this.Info.IsReg = 3;            如果ISREG为3的话就是已注册
   }
   else
   {
       if (this.Info.LastDate > this.Info.CurDate)
       {
         this.Info.IsReg = 2;         这里是最主要的判断点,我们要改的就是这里了。
       }
       long num2 = (this.Info.CurDate - this.Info.StartDate) / 0xc92a69c000L;
       int num3 = Convert.ToInt32(num2);
       if ((num3 > this.Info.Days) || (num3 < 0))
       {
         this.Info.IsReg = 2;
         mail = new Mail(this.Info.Email);
         mail.Info.Name = this.Info.SoftName + " " + this.Ver;
         mail.Info.Subject = "此用户已使用了" + num2 + "天";
         mail.Info.Body = string.Concat(new object[] { "用户:", this.Info.Computer, "<br>序列号:", this.MacCode, "<br>版

本:", this.Ver, "<br>软件号:", this.Info.Soft.ToString(), "<br>已使用天数:", num2, "<br>总使用次数:",

this.Info.UseCount.ToString() });
         mail.Send();
       }
   }
   if (!flag)
   {
       this.SetReg();
   }
   this.SetFile();
   new Thread(new ThreadStart(this.CheckNet)).Start();
}


地方我们找到了,现在再打开UEDIT32,找到些地方

IL_02ba:ldc.i4.0               我们将这里改成ldc.i4.1那么我们也就注册成功
    IL_02bb:ceq
    IL_02bd:stloc.s    V_8
    IL_02bf:ldloc.s    V_8
    IL_02c1:brtrue.s   IL_02d6

    IL_02c3:nop
    IL_02c4:ldarg.0
    IL_02c5:ldflda   valuetype LibReg.Reg/RegInfo LibReg.Reg::Info
    IL_02ca:ldc.i4.3
    IL_02cb:stfld      int32 LibReg.Reg/RegInfo::IsReg
    IL_02d0:nop
    IL_02d1:br         IL_0472

    IL_02d6:nop
    IL_02d7:ldarg.0
    IL_02d8:ldflda   valuetype LibReg.Reg/RegInfo LibReg.Reg::Info
    IL_02dd:ldfld      int64 LibReg.Reg/RegInfo::LastDate
    IL_02e2:ldarg.0
    IL_02e3:ldflda   valuetype LibReg.Reg/RegInfo LibReg.Reg::Info
    IL_02e8:ldfld      int64 LibReg.Reg/RegInfo::CurDate
    IL_02ed:cgt
    IL_02ef:ldc.i4.0
    IL_02f0:ceq
    IL_02f2:stloc.s    V_8
    IL_02f4:ldloc.s    V_8
    IL_02f6:brtrue.s   IL_0306

经过上面两处地方完全搞定我们再用DotNet Helper反编译成DLL文件就行了,我们再运行软件,这里我们可以看到已注册,再打开注册的地方

也是已注册好了,不用写注册码了,呵呵。

嘻嘻,是不是好简单的说呀!




chenyuanpojie 发表于 2022-1-19 11:25

谢谢楼主分享

月光下の魔术师 发表于 2015-3-24 23:05

lz成功屠版&刷屏

赵师傅 发表于 2015-3-24 23:09

谢谢分享,膜拜会逆向.NET的大牛   板凳 {:5_116:}

路人乙 发表于 2015-3-25 00:07

谢谢,学习            

一蓑烟雨 发表于 2015-3-25 08:44

好厉害!

ye4241 发表于 2015-3-25 11:17

月光下の魔术师 发表于 2015-3-24 23:05
lz成功屠版&刷屏

被你这么一说还真是的啊!!!

tony2526 发表于 2015-6-11 11:57

来分享下楼主的作品,{:5_116:}

消逝的过去 发表于 2022-1-19 08:47

属实牛逼

ldzsl 发表于 2022-1-19 10:23

谢谢分享,膜拜会逆向.NET的大牛   板凳
页: [1] 2
查看完整版本: 一个.NET软件的逆向过程