我在互联网上阅读有关如何总是可以反编译几乎所有内容的信息。添加此方法会使黑客更难反编译程序:
void PreventProgramFromBeingDebuged()
{
Task.Factory.StartNew(()=>{
while(true){
var a = DateTime.Now;
Thread.Sleep(10);
var b = DateTime.Now;
// if difference in time is greater than 1 second it means the program has stopped executing
if( (b-a).TotalSeconds > 1)
// then make appliction crash or make it behave the way it is not suppose to
}
});
}
这种方法很明显,但是您可以让两个线程通过信号量同步,从而使相同的代码更难理解。拥有这样的方法会让黑客的生活更加艰难吗?或者黑客不必为了反编译程序而调试程序?