您的位置:首页 > 其它

由一次偶然破解想到

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

if ((this._RegistUser != null) && (this._RegistUser != string.Empty))
if ((this._RegistCode != null) && (this._RegistCode != string.Empty))
if ((this.temp1 != null) && (this.temp1 != string.Empty))
{
string s = this.temp1.GetHashCode().ToString();
if (s.Substring(0, 1) == "-")
{
s = s.Substring(1);
}
long num = (long.Parse(s) * 0x17) + 0x2d11368aa3;
string text2 = num.ToString().Substring(2, 4) + "-" + num.ToString().Substring(6, 4);
num = (num * 3) + 0x22184ee23d;
string text3 = num.ToString().Substring(3, 4) + "-" + num.ToString().Substring(7, 4);
if ((this.temp2.Substring(0, 9) == text2) && (this.temp2.Substring(10, 9) == text3))
{
this.barbottom = 200;
}
else
{
num = (long.Parse(s) * 0x1f) + 0x4205091f33;
text2 = num.ToString().Substring(2, 4) + "-" + num.ToString().Substring(6, 4);
num = (num * 7) + 0x4ff65d2d53;
text3 = num.ToString().Substring(3, 4) + "-" + num.ToString().Substring(7, 4);
if ((this.temp2.Substring(0, 9) == text2) && (this.temp2.Substring(10, 9) == text3))
{
this.barbottom = 200;
}
}
}

算法简单,注册机就不写了。
由此我想有几点注意:
1. .net软件产品,一定要有保护措施(混淆,加壳等)。否则就象把源代码给了别人一样,版权就不用考虑了。
2. 轻易不要使自己设计的加密或注册算法,用成熟的现有算法。
3. 写软件很辛苦,成果来之不易,去之又很快。(作控件的大侠,若有得罪,请原谅!)。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: