maomaocat

导航

由一次偶然破解想到

         五一七天,没事。偶然从硬盘上找到一个以前下载的国产控件(没注册码)破解掉了。
这个控件是asp.net2.0控件,只需设置属性,几分钟时间,即可获得一个漂亮的类似 Outlook 样式的菜单,若未注册,会在用户显示的基础上,多显示一项:****soft(*是字符),除此之外,无其它的限制。
想想:自然在OnpreRender事件那有特殊。用Reflector一看就知道了。关键代码如下:

if ((this._RegistUser != null&& (this._RegistUser != string.Empty))
    
{
        
this.temp1 = this._RegistUser;
    }

    
if ((this._RegistCode != null&& (this._RegistCode != string.Empty))
    
{
        
this.temp2 = this._RegistCode;
    }

    
if ((this.temp1 != null&& (this.temp1 != string.Empty))
    
{
        
string s = this.temp1.GetHashCode().ToString();
        
if (s.Substring(01== "-")
        
{
            s 
= s.Substring(1);
        }

        
long num = (long.Parse(s) * 0x17+ 0x2d11368aa3;
        
string text2 = num.ToString().Substring(24+ "-" + num.ToString().Substring(64);
        num 
= (num * 3+ 0x22184ee23d;
        
string text3 = num.ToString().Substring(34+ "-" + num.ToString().Substring(74);
        
if ((this.temp2.Substring(09== text2) && (this.temp2.Substring(109== text3))
        
{
            
this.barbottom = 200;
        }

        
else
        
{
            num 
= (long.Parse(s) * 0x1f+ 0x4205091f33;
            text2 
= num.ToString().Substring(24+ "-" + num.ToString().Substring(64);
            num 
= (num * 7+ 0x4ff65d2d53;
            text3 
= num.ToString().Substring(34+ "-" + num.ToString().Substring(74);
            
if ((this.temp2.Substring(09== text2) && (this.temp2.Substring(109== text3))
            
{
                
this.barbottom = 200;
            }

        }

    }

        算法简单,注册机就不写了。
由此我想有几点注意:
1. .net软件产品,一定要有保护措施(混淆,加壳等)。否则就象把源代码给了别人一样,版权就不用考虑了。
2. 轻易不要使自己设计的加密或注册算法,用成熟的现有算法。
3. 写软件很辛苦,成果来之不易,去之又很快。(作控件的大侠,若有得罪,请原谅!)。

posted on 2007-05-08 20:14  maomaocat  阅读(159)  评论(0)    收藏  举报