当前位置: 移动技术网 > 网络运营>安全>加解密 > 一个.Net网络验证程序的破解

一个.Net网络验证程序的破解

2017年12月30日  | 移动技术网网络运营  | 我要评论

【文章作者】无常pl
【破解工具】Reflector/Http Analyzer/ildasm
【破解平台】Win7
【原版下载】不提供
【保护方式】网络会员验证
【软件简介】无
【破解说明】新手,只是感兴趣,没有其他目的,不足之处还请大家指教


 这是个需要安装的软件。
安装完以后查启动程序壳,是.Net写的软件。
 
没有怎么接触过.Net的程序,不知道该怎么下手了。Baidu,google无所不知,搜吧。
用ildasm反汇编
先抓下数据包看看,
随便输入一个用户名和密码。
提示 
 
返回的数据
 



注册一个账号再试试
 
返回的数据
 
分析一下,
第一个数据1可能可能是判断是不是有这个用户,
第二个数据0和第四个数据0可能就是验证的关键了,
最后一个数据可能是请求时间。

分析一下代码

启动程序Dump下来以后看了下,没有找到网络验证的代码,文件也比较小,可能不在这里面。
在文件夹里找了一下,看到了一个叫AppLogin的DLL。看名字验证代码可能再这里面。

[System.Windows.Forms/*23000001*/]System.Windows.Forms.Control/*0100002D*/::Focus() /* 0A000032 */
    IL_005c:  /* 26   |                  */ pop
    IL_005d:  /* 2A   |                  */ ret

    IL_005e:  /* 72   | (70)00026A       */ ldstr      "http://www.xxxx.com/validate/update.asp\?username="
    + "{0}&password={1}&softid=xxxx" /* 7000026A */    验证的网页
    IL_0063:  /* 02   |                  */ ldarg.0
    IL_0064:  /* 7B   | (04)000009       */ ldfld      class [System.Windows.Forms/*23000001*/]System.Windows.Forms.TextBox/*0100000C*/ MailSend.AppLogin.TAppLogin/*02000002*/::TextUsername /* 04000009 */
    IL_0069:  /* 6F   | (0A)00002E       */ callvirt   instance string [System.Windows.Forms/*23000001*/]System.Windows.Forms.Control/*0100002D*/::get_Text() /* 0A00002E */
    IL_006e:  /* 02   |                  */ ldarg.0
    IL_006f:  /* 7B   | (04)000008       */ ldfld      class [System.Windows.Forms/*23000001*/]System.Windows.Forms.TextBox/*0100000C*/ MailSend.AppLogin.TAppLogin/*02000002*/::TextPassword /* 04000008 */
    IL_0074:  /* 6F   | (0A)00002E       */ callvirt   instance string [System.Windows.Forms/*23000001*/]System.Windows.Forms.Control/*0100002D*/::get_Text() /* 0A00002E */
    IL_0079:  /* 28   | (0A)000033       */ call       string [mscorlib/*23000002*/]System.String/*01000023*/::Format(string,
                                                                                                                      object,
                                                                                                                      object) /* 0A000033 */
    IL_007e:  /* 0A   |                  */ stloc.0
    .try
    {
      IL_007f:  /* 06   |                  */ ldloc.0
      IL_0080:  /* 28   | (0A)000013       */ call       string [Other/*23000003*/]MailSend.Other.Func.NetWork/*01000024*/::GetUrlText(string) /* 0A000013 */
      IL_0085:  /* 0B   |                  */ stloc.1
      IL_0086:  /* 07   |                  */ ldloc.1
      IL_0087:  /* 39   | A8010000         */ brfalse    IL_0234      跳到--连接登录服务器误,请稍后再试

      IL_008c:  /* 07   |                  */ ldloc.1
      IL_008d:  /* 7E   | (0A)00002F       */ ldsfld     string [mscorlib/*23000002*/]System.String/*01000023*/::Empty /* 0A00002F */
      IL_0092:  /* 28   | (0A)000034       */ call       bool [mscorlib/*23000002*/]System.String/*01000023*/::op_Inequality(string,
                                                                                                                             string) /* 0A000034 */
      IL_0097:  /* 39   | 98010000         */ brfalse    IL_0234      跳到--连接登录服务器误,请稍后再试

      IL_009c:  /* 07   |                  */ ldloc.1
      IL_009d:  /* 17   |                  */ ldc.i4.1
      IL_009e:  /* 8D   | (01)00002F       */ newarr     [mscorlib/*23000002*/]System.Char/*0100002F*/
      IL_00a3:  /* 0D   |                  */ stloc.3
      IL_00a4:  /* 09   |                  */ ldloc.3
      IL_00a5:  /* 16   |                  */ ldc.i4.0
      IL_00a6:  /* 1F   | 7C               */ ldc.i4.s   124
      IL_00a8:  /* 9D   |                  */ stelem.i2
      IL_00a9:  /* 09   |                  */ ldloc.3
      IL_00aa:  /* 6F   | (0A)000035       */ callvirt   instance string[] [mscorlib/*23000002*/]System.String/*01000023*/::Split(char[]) /* 0A000035 */
      IL_00af:  /* 0C   |                  */ stloc.2
      IL_00b0:  /* 08   |                  */ ldloc.2
      IL_00b1:  /* 16   |                  */ ldc.i4.0
      IL_00b2:  /* 9A   |                  */ ldelem.ref
      IL_00b3:  /* 72   | (70)000315       */ ldstr      "1" /* 70000315 */  这个1可能是验证数据
      IL_00b8:  /* 28   | (0A)000030       */ call       bool [mscorlib/*23000002*/]System.String/*01000023*/::op_Equality(string,
                                                                                                                           string) /* 0A000030 */
      IL_00bd:  /* 39   | 49010000         */ brfalse    IL_020b

      IL_00c2:  /* 08   |                  */ ldloc.2
      IL_00c3:  /* 18   |                  */ ldc.i4.2
      IL_00c4:  /* 9A   |                  */ ldelem.ref
      IL_00c5:  /* 28   | (0A)000015       */ call       valuetype [mscorlib/*23000002*/]System.DateTime/*01000027*/ [mscorlib/*23000002*/]System.Convert/*01000026*/::ToDateTime(string) /* 0A000015 */
      IL_00ca:  /* 28   | (0A)000016       */ call       valuetype [mscorlib/*23000002*/]System.DateTime/*01000027*/ [mscorlib/*23000002*/]System.DateTime/*01000027*/::get_Now() /* 0A000016 */
      IL_00cf:  /* 28   | (0A)000036       */ call       bool [mscorlib/*23000002*/]System.DateTime/*01000027*/::op_GreaterThan(valuetype [mscorlib/*23000002*/]System.DateTime/*01000027*/,
                                                                                                                                valuetype [mscorlib/*23000002*/]System.DateTime/*01000027*/) /* 0A000036 */
      IL_00d4:  /* 39   | FE000000         */ brfalse    IL_01d7         跳到--您的账号使用时已到,请联系客服

      IL_00d9:  /* 08   |                  */ ldloc.2
      IL_00da:  /* 19   |                  */ ldc.i4.3
      IL_00db:  /* 9A   |                  */ ldelem.ref
      IL_00dc:  /* 72   | (70)000319       */ ldstr      "0" /* 70000319 */   这个0可能是验证数据
      IL_00e1:  /* 28   | (0A)000030       */ call       bool            


第一次接触这种代码,好多都看不太懂。  搜搜其他大侠怎么分析这种代码的。
看到Reflector这个程序很强大,直接翻译出源码来了。

private void ButtonLogin_Click(object sender, EventArgs e)
{
    if (this.TextUsername.Text == string.Empty)
    {
        MsgBox.ShowErrorBox("您必须输入用户名");
        this.TextUsername.Focus();
    }
    else if (this.TextPassword.Text == string.Empty)
    {
        MsgBox.ShowErrorBox("您必须输入密码");
        this.TextPassword.Focus();
    }
    else
    {
        string url = string.Format("http://www.xxxxcom/validate/update.asp?username={0}&password={1}&softid=xxxx", this.TextUsername.Text, this.TextPassword.Text);
        try
        {
            string urlText = NetWork.GetUrlText(url);
            if ((urlText != null) && (urlText != string.Empty))
            {
                string[] strArray = urlText.Split(new char[] { '|' });
                if (strArray[0] == "1")
                {
                    if (Convert.ToDateTime(strArray[2]) > DateTime.Now)
                    {
                        if ((strArray[3] == "0") ||(Datetime.DateTimeDiff(Convert.ToDateTime(strArray[3]), Convert.ToDateTime(strArray[4])) > 100L))
                        {
                            this.TempLoginUser.Username = this.TextUsername.Text;
                            this.TempLoginUser.Password = this.TextPassword.Text;
                            this.TempLoginUser.Type = (strArray[1] == "1") ? "收费用户" : "普通用户";
                            this.TempLoginUser.Expire = (strArray[1] == "1") ? Convert.ToDateTime(strArray[2]) : DateTime.Now.AddYears(1);
                            if (this.TempLoginUser.Type == "普通用户")
                            {                             MsgBox.ShowInfoBox("普通账号只可以“xxxx”\n若想无限制使用请联系客服购买。");
                            }
                            Reg.SaveReg("username", this.TextUsername.Text);
                            base.DialogResult = DialogResult.OK;
                        }
                        else
                        {                          MsgBox.ShowErrorBox("同一帐号同一时间只能一人登录!\n如果您上次异常退出程序,请1-2分钟后尝试重新登录。");
                        }
                    }
                    else
                    {
                        MsgBox.ShowErrorBox("您的账号使用时间已到,请联系客服续费。");
                        this.TextPassword.Text = "";
                        this.TextUsername.Focus();
                        this.TextUsername.SelectAll();
                    }
                }
                else
                {
                    MsgBox.ShowErrorBox("账号或密码错误");
                    this.TextPassword.Text = "";
                    this.TextPassword.Focus();
                }
            }
            else
            {
                MsgBox.ShowErrorBox("连接登录服务器错误,请稍后再试");
            }
        }
        catch
        {
            MsgBox.ShowErrorBox("程序出现致命错误。请重新安装程序。");
            Environment.Exit(0);
        }
    }
}


流程清楚多了,返回的数据结构是这样的
1                验证账号或密码错误  
0                是否是收费用户
2012-8-24         到期时间  
0                是否有人登陆
2012-8-24 7:51:31  请求时间

在启动程序调用了Update.dll的ChecUpdate函数检查版本信息

public static void CheckUpdate(int AppID)
{
    string str = GetUrlText(new Uri("http://www.xxxx.com/validate/ver.asp?softid=xxxx"), Encoding.Default, 30);
    if (str != null)
    {
        if (Convert.ToDouble(str) > 4.6)
        {
            MessageBox.Show("软件已升级到 " + str + " 版,点击确定后软件将自动升级到最新版本。");
            Execute(Application.StartupPath + @"\update.exe", "http://www.xxxx.com/download/xxxx_update.rar|" + Path.GetFileName(Application.ExecutablePath), null);
            Environment.Exit(0);
        }
    }
    else
    {
        MessageBox.Show("不能连接到服务器,请联系管理员", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
        Environment.Exit(0);
    }
}


搭个asp服务器
建一个validate/update.asp文件
里面的数据为1 | 1 | 2012-9-24 | 0 | 2012-8-24 7:51:31

建一个validate/ver.asp文件
里面是版本信息

再把C:\Windows\System32\drivers\etc目录下的hosts文件改为 
127.0.0.1   www.xxxx.com

测试时又遇到个问题,
 
可能在启动程序有检查。

分析一下启动程序有个CheckHosts函数
 
 
启动程序检查hosts文件是否改成了xxxx.com.

用ildasm反汇编一下,Dump保存为main.il

找到相应位置
 


保存一下,用ilasm.exe编译
再进行测试,成功。完

第一次写这东西,有点乱,大家见谅!

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网