• Ext.NET 4.1 最新版本破解


    Ext.NET 4.1 最新版本破解

    今天在将Ext.NET 4.1版本的程序发布到公网时居然要license(localhost和127.0.0.1不收费),而且一年$4999,突然间觉得这是什么鬼,居然还收费!如图:

    大大的一个UNLICENSED!

    网上搜索破解方法,好像都没什么用,唯一有启发的是这篇文章(虽然不能解决我的问题):

    http://blog.csdn.net/xyun52/article/details/24011507

    下面就具体说下我是如何破解该问题的:

    右键查看了一下源码,license多了以下两个:

    <link type="text/css" rel="stylesheet" href="/ExtTest/extnet/unlicensed/css/un-embedded-css/ext.axd?v=4.1.0" />
    <script type="text/javascript" src="/ExtTest/extnet/unlicensed/un-js/ext.axd?v=4.1.0"></script>

    一个样式文件,一个js文件。

    为了一探究竟我打算用Reflector反编译看看究竟Ext.Net.dll里对License封装了什么,

    由于内容较多,我直接搜索”License”,结果还是挺满意的:

    看Resouces,正好一个样式文件,一个js文件。

    先看看Resources部分:

    1.先看中间图片:Ext.Net.Build.Ext.Net.extnet.unlicensed.images.attention.png

     

    这就是图1里显示警告的图。

    2.再来看js方法:Ext.Net.Build.Ext.Net.extnet.unlicensed.un.js
    Ext.onReady(function () {
                Ext.Function.defer(function () {
                    var el = Ext.DomHelper.append(document.body, {
                        tag: "div",
                        id: "unlicensed",
                        children: [{
                            tag: "div",
                            class: "ul-title-icon",
                            children: [{
                                tag: "img",
                                 48,
                                height: 48,
                                src: Ext.net.ResourceMgr.resolveUrl("~/extnet/unlicensed/images/attention-png/ext.axd")
                            }]
                        }, {
                            tag: "div",
                            class: "ul-title",
                            html: "UNLICENSED!"
                        }, {
                            tag: "hr",
                            class: "ul-hr"
                        }, {
                            tag: "div",
                            class: "ul-body",
                            html: "Your copy of Ext.NET is unlicensed!<br />Ext.NET can be used without a license only on a local development environment."
                        }, {
                            tag: "a",
                            class: "ul-btn",
                            href: "http://ext.net/store/",
                            target: "_blank",
                            html: "PURCHASE LICENSE"
                        }, {
                            tag: "div",
                            class: "ul-footer",
                            html: "Free Minor Version Upgrades Included!"
                        }]
                    }, true);
    
                    el.alignTo(document, "br-br", [-20, -20]);
                    el.slideIn("b", {
                        listeners: {
                            afteranimate: function () {
                                Ext.Function.defer(function () {
                                    el.slideOut("b", {
                                        listeners: {
                                            afteranimate: function () {
                                                Ext.Function.defer(el.destroy, 100, el);
                                            }
                                        }
                                    });
                                }, 20000);
                            }
                        }
                    });
                }, 500, window);
            });

    图1里的警告信息就是来自于这里。

    再来看看ResourceManager部分:

    下面来分析LicenseKey和IsValidLicenseKey:

     LicenseKey反编译代码:

    [DefaultValue(""), Description("")]
    public virtual string LicenseKey
    {
        get
        {
            if (this.licenseKey != null)
            {
                return this.licenseKey;
            }
            if (base.DesignMode)
            {
                return "";
            }
            if (Globals.Context != null)
            {
                string name = "Ext.Net.LicenseKey";
                object obj2 = Globals.Application[name];
                if (obj2 == null)
                {
                    obj2 = Session(name);
                }
                if ((obj2 != null) && (obj2 is string))
                {
                    return (string) obj2;
                }
            }
            return GlobalConfig.Settings.LicenseKey;
        }
        set
        {
            this.licenseKey = value;
        }
    }
     
    
     

    这段代码的功能就是获取LicenseKey的值:从某个地方读取(比如session)名称为” Ext.Net.LicenseKey”的值。

    IsValidLicenseKey反编译代码:

    public bool IsValidLicenseKey
    {
        get
        {
            if (!this.isValidLicenseKey.HasValue)
            {
                this.isValidLicenseKey = false;
                string licenseKey = this.LicenseKey;
                if (licenseKey.IsNotEmpty())
                {
                    try
                    {
                        licenseKey = licenseKey.Base64Decode();
                    }
                    catch (FormatException)
                    {
                    }
                    if (licenseKey.IsNotEmpty())
                    {
                        int num;
                        DateTime time;
                        string[] strArray = licenseKey.Split(new char[] { ',' });
                        if ((((strArray.Length == 3) && int.TryParse(strArray[1], out num)) && ((num >= 4) && DateTime.TryParseExact(strArray[2], "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out time))) && (time >= DateTime.Now))
                        {
                            this.isValidLicenseKey = true;
                        }
                    }
                }
            }
            return this.isValidLicenseKey.Value;
        }
    }
     
    
     

    这段代码的作用就是对LicenseKey的值进行校验,可以获取到LicenseKey值的信息为:

    1. LicenseKey值是以逗号分隔的;

    2.逗号分隔后,长度为3;

    3.逗号分隔后,第2个值为数字,且大于等于4;

    4. 逗号分隔后,第3个值为日期,且要大于当前时间,格式为"yyyy-MM-dd",可以猜测为这个值为有效期。

    根据这些信息,LicenseKey的值很快可以构建出来,比如:“net,5,2018-11-11”

    再注意到这行代码:

    licenseKey = licenseKey.Base64Decode();

    这就是LicenseKey的编码格式,也就是说传入的LicenseKey不能直接是“net,5,2018-11-11”这样的值,必须是经过转换后的,

    跟进去看一下代码:

    public static string Base64Decode(this string text)
    {
        Decoder decoder = new UTF8Encoding().GetDecoder();
        byte[] bytes = Convert.FromBase64String(text);
        char[] chars = new char[decoder.GetCharCount(bytes, 0, bytes.Length)];
        decoder.GetChars(bytes, 0, bytes.Length, chars, 0);
        return new string(chars);
    }
    
     
    
     

    使用的方法是:Convert.FromBase64String(text),很显然,编码方式给的很彻底,这里直接给出转换代码:

    string LicenseKey = "net,5,2018-11-11";
    byte[] b = Encoding.Default.GetBytes(LicenseKey);
    LicenseKey = Convert.ToBase64String(b);
    Session["Ext.Net.LicenseKey"] = LicenseKey;

    最后以Session传值(只需要上面4行代码即可),搞定。

    看,没有警告了,而且是真正通过验证了。

    好了,破解就研究到这里吧。

    大家可以将LicenseKey放到ResourceManager中,这样就可以通用了。

  • 相关阅读:
    linux 系统运维工具13款
    Django2.0 分页的应用
    jvm优化
    SSH-key 在Windows下如何生成公钥和私钥
    申请Let’s Encrypt免费证书,给自己网站增加https访问
    wordpress上传主题以及安装插件 出现ftp的问题解决方案
    php压缩文件
    linux下 如何切换到root用户
    TP3.2.3框架隐藏Home模块以及index.php入口文件的方法
    PHP打开错误提示和关闭错误提示的方法
  • 原文地址:https://www.cnblogs.com/zhangtingzu/p/6137612.html
Copyright © 2020-2023  润新知