![软件破解与防破解的那些事](https://images.weserv.nl/?url=https://hzimgs.oss-cn-hangzhou.aliyuncs.com/uposs/2021_12/14/16394397472LVlj0.jpg)
这个时候,你痛定思痛,mmp,有内鬼,既然MessageBox不好用,那我不用就是了,于是你把代码改成下面这样
#include "stdio.h"
#include "string.h"
#include "windows.h"
#include "math.h"
int main()
{
char iKey[32];
char Key[32];
char ID[32];
int iID=0xabc1d3f;
sprintf(Key,"%x",iID*8 123456);
printf("你的机器码是%x\n",iID);
printf("请输入注册码:");
gets(iKey);
if (strcmp(Key,iKey)==0)
printf("注册成功");
else
exit(0);
}
你看,啧.只要你注册码没输对,我直接把软件退出(或者跳到别的地方),看你怎么办
可惜,内鬼年年有,"注册成功"几个字还是出卖了你,打开ollydbg,查找字符串参考,然后双击
![软件破解与防破解的那些事](https://images.weserv.nl/?url=https://hzimgs.oss-cn-hangzhou.aliyuncs.com/uposs/2021_12/14/1639439748B2I5jt.jpg)
![软件破解与防破解的那些事](https://images.weserv.nl/?url=https://hzimgs.oss-cn-hangzhou.aliyuncs.com/uposs/2021_12/14/1639439748bVWdzJ.jpg)
![软件破解与防破解的那些事](https://images.weserv.nl/?url=https://hzimgs.oss-cn-hangzhou.aliyuncs.com/uposs/2021_12/14/1639439748K79fDm.jpg)
哦豁,完蛋,换汤不换药,还是给逮住了.
你察觉到这样一个地方判断注册码实在不靠谱,所以,你改变了策略,把检查注册码的代码复制了n遍,或者逐字符检查注册码的准确性,还有人将注册成功等字样进行加密或混淆,等到要用的时候再取出来
#include "stdio.h"
#include "string.h"
#include "windows.h"
#include "math.h"
int main()
{
char iKey[32];
char Key[32];
char ID[32];
int iID=0xabc1d3f;
sprintf(Key,"%x",iID*8 123456);
printf("你的机器码是%x\n",iID);
printf("请输入注册码:");
gets(iKey);
if (strcmp(Key,iKey)==0)
printf("注册成功");
else
exit(0);
if (strcmp(Key,iKey)==0)
printf("注册成功");
else
exit(0);
if (strcmp(Key,iKey)==0)
printf("注册成功");
else
exit(0);
if (strcmp(Key,iKey)==0)
printf("注册成功");
else
exit(0);
if (strcmp(Key,iKey)==0)
printf("注册成功");
else
exit(0);
if (strcmp(Key,iKey)==0)
printf("注册成功");
else
exit(0);
if (strcmp(Key,iKey)==0)
printf("注册成功");
else
exit(0);
if (strcmp(Key,iKey)==0)
printf("注册成功");
else
exit(0);
}
![软件破解与防破解的那些事](/d/file/2021-12-14/7e40af351ff4bbc4cb4ec2710d414039.jpg)
你放心,不管你复制多少次,要找出来都是时间问题,吃枣是会被破解的.同时只要你要用到明文字符串你迟早还是要解密的,这种手段类似于加upx压缩壳,只需要等待数据解压完成,所有的东西又都是明文的了。因此比较聪明的做法是,要用时解密,用完后马上把明文抹掉,这样说不定能拖延更长的时间。但这仍然也是时间问题。
你开始发现,与其揪出内鬼,不如主动出击,也就是我们著名的与其解决问题不如解决提出问题的人,终于,你开始对调试器下手了,然后你成功进化到防破解V2.5时代.
这个时候,不得不介绍一个老掉牙的但非常有名的函数
IsDebugPresent
你可能有点懵,这个函数是干啥子用的?,简单来说,当我们破解一个程序的时候,大部分情况下我们会打开一个叫调试器的东西来对软件进行反编译分析,诶,重点就在这,IsDebugPresent这个函数,就能检测我们的程序有没有被一个调试器附加,你想啊,正常情况我们用软件谁会吃饱撑着附加一个调试器来用,你要是用调试器附加我,你肯定就是想干坏事.
于是,你开始把代码写成这样:
#include "stdio.h"
#include "string.h"
#include "windows.h"
#include "math.h"
int main()
{
char iKey[32];
char Key[32];
char ID[32];
int iID=0xabc1d3f;
if (IsDebuggerPresent())
{
MessageBoxA(NULL,"小样,就你还破解我的程序,回家喝奶去吧","",MB_OK);
return 0;
}
sprintf(Key,"%x",iID*8 123456);
printf("你的机器码是%x\n",iID);
printf("请输入注册码:");
gets(iKey);
if (strcmp(Key,iKey)==0)
printf("注册成功");
else
exit(0);
}