windows 如何保护软件免受系统日期时间更改的影响?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3404045/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to protect software from system date-time changes?
提问by Im0rtality
I would like to add licensing system to application. For example: user buys license for 1 month and after that program expires (Kinda Anti-Virus style?).
我想在应用程序中添加许可系统。例如:用户购买 1 个月的许可证,然后该程序过期(有点反病毒风格?)。
Problem is that application is supposed to run in systems which may or may not be connected to internet, so how to protect from date-time changes?
问题是应用程序应该在可能连接或不连接到互联网的系统中运行,那么如何防止日期时间更改?
Storing app startup and close times in encrypted file won't work as date can be changed (with program uptime of 8 hours per day, would be possible to extend license to almost 300% in ideal case - change time to app close time + 1 second before launching program).
将应用程序启动和关闭时间存储在加密文件中将不起作用,因为日期可以更改(每天 8 小时的程序正常运行时间,在理想情况下可以将许可证扩展到近 300% - 更改应用程序关闭时间的时间 + 1启动程序之前的第二个)。
Another question - is there any way to protect from software like http://en.wikipedia.org/wiki/Deep_Freeze_(software)? (maybe scan drivers?)
另一个问题 - 有没有办法保护像http://en.wikipedia.org/wiki/Deep_Freeze_(software)这样的软件?(也许扫描驱动程序?)
EDIT:
I'm currently using smart card to store licensing information and will use code virtualizer on critical functions (I know about making breakpoints on API calls and inspecting passed data - don't need to hide that data, just to ensure things go as planned)
编辑:
我目前正在使用智能卡来存储许可信息,并将在关键功能上使用代码虚拟器(我知道在 API 调用上设置断点并检查传递的数据 - 不需要隐藏该数据,只是为了确保事情顺利进行计划)
采纳答案by Harsha Hulageri
Step 1:Create trial_tracker entry in an encrypted format in a windows registry and in file.
步骤 1:在 Windows 注册表和文件中以加密格式创建trial_tracker 条目。
Step 2:Assign app install timestamp ( yyyy-mm-dd-hh-mm-ss ) to trial_tracker
第 2 步:将应用安装时间戳 ( yyyy-mm-dd-hh-mm-ss ) 分配给 trial_tracker
Whenever app starts, check if current system timestamp is greater than trial_tracker and less then expected expiry date
每当应用程序启动时,检查当前系统时间戳是否大于 trial_tracker 且小于预期到期日期
If yes, update trial_tracker to current system timestamp and continue.
If no, trial_tracker has been tampered or trial time expired. Ask user to purchase full version or exit.
如果是,将trial_tracker 更新为当前系统时间戳并继续。
如果否,则trial_tracker 已被篡改或试用时间已过。要求用户购买完整版或退出。
Note:User can get away with this by deleting windows registry entry and encrypted file.( if he is able to find them ). In such case, further checks can be added. For example create secondary windows registry entry which checks for existence of primary registry and encrypted file.
注意:用户可以通过删除 Windows 注册表项和加密文件来解决这个问题。(如果他能够找到它们)。在这种情况下,可以添加进一步的检查。例如,创建辅助 Windows 注册表项来检查主注册表和加密文件的存在。
Along with these, additional remote checks can be applied which depends on internet connection ( optional )
除了这些,还可以应用额外的远程检查,这取决于互联网连接(可选)
回答by Woody
Yes, it would be possible to extend the license by up to 300% but at great effort to the user. Frankly if someone is going to spend every day of a month resetting their time to one second after they quit your program before starting it again to use it longer, there is nothing you are going to do about it, and the time you take to stop them will cost you more than they ever will.
是的,可以将许可证扩展多达 300%,但需要用户付出很大的努力。坦率地说,如果有人打算在一个月中的每一天都在退出程序后将他们的时间重置为一秒,然后再重新启动以延长使用时间,那么您将无所事事,而您需要停止的时间他们将比以往任何时候都花费更多。
回答by ZXX
Reputable game development manager stated once in a conference that it's impossible to protect software for longer than a month even with internet connection - if your software is popular :-) So you can just write software that no one wants and it will be as safe as you want :-)))
著名的游戏开发经理曾在一次会议上表示,即使有互联网连接,也不可能将软件保护超过一个月 - 如果您的软件很受欢迎:-) 所以您可以编写没有人想要的软件,它会像你要 :-)))
If on the other side you write reasonably popular software then you couldn't care less if a small percentage of paying customers snitch some extra time - they'll renew a week latter anyway. If you really want to do short time licensing you have to put internet as a pre-requisite. It's still going to be cracked in a month if it's good for something :-) but paying customers will by and large remain paying customers with reasonably light enforcement.
另一方面,如果您编写了相当流行的软件,那么即使有一小部分付费客户窃取一些额外的时间,您也不会在意——无论如何,他们会在一周后续订。如果您真的想进行短期许可,则必须将互联网作为先决条件。如果它对某些东西有好处,它仍然会在一个月内被破解:-)但是付费客户基本上会在合理轻度执行的情况下仍然是付费客户。
If however you piss people off by doing intrusive and scary things then you'll loose paying customers and create much bigger motivation for ppl to crack it.
但是,如果您通过做侵入性和可怕的事情来激怒人们,那么您将失去付费客户并为人们破解它创造更大的动力。
回答by Andrew Lewis
Create a windows service that gets installed with your app, but is auto-start. Keep track of elapsed time and offsets there. Provide an API for your app to talk to the service to query usage/elapsed time.
创建一个 Windows 服务,该服务随您的应用程序一起安装,但会自动启动。跟踪经过的时间和偏移量。为您的应用程序提供 API 以与服务对话以查询使用情况/已用时间。
回答by Toby
I assume the software phones home at least once to let you know the license key has been bought / installed / extended?
我假设软件至少打电话回家一次,让您知道许可证密钥已购买/安装/扩展?
After the time has ran out since they bought the license key and they haven't purchased another you could contact them and ask them how they are getting on and to let them know they need to renew. If they do choose to abuse your system a simple call to chat about it may be enough to get them to stop.
在他们购买许可证密钥的时间用完之后,他们还没有购买另一个许可证,您可以联系他们并询问他们进展如何,并让他们知道他们需要更新。如果他们确实选择滥用您的系统,一个简单的电话交谈可能足以让他们停止。
回答by Mike
Maybe you could combine the use of the date/time with the tick count? Then if you see a date/time with an incompatible tick count, you could flag that as a violation. This would change your worst case scenario to require them to restart the machine whenever they want to manipulate the clock to abuse your license.
也许您可以将日期/时间与滴答计数结合使用?然后,如果您看到具有不兼容滴答计数的日期/时间,您可以将其标记为违规。这将改变您最坏的情况,要求他们在想要操纵时钟以滥用您的许可证时重新启动机器。
回答by accountcreation
From your program you create a log of time when the app is launched and exited.The log is encrypted and prevent the common user to trick its content.
当应用程序启动和退出时,您可以从您的程序中创建一个时间日志。该日志是加密的,可防止普通用户欺骗其内容。
With this log, you can see if time elapsed normally that is time goes to the future. If not then something fishy is occurring on this system. In this case display a dialog box with a phone number where they can call you.
使用此日志,您可以查看时间是否正常流逝,即时间是否流向未来。如果没有,那么这个系统上就会发生一些可疑的事情。在这种情况下,会显示一个带有电话号码的对话框,他们可以在那里给您打电话。
You could also ensure via a data file that the program can run for one month only after that as the said data file don't contain the data to work for the following month, this requires an update.
您还可以通过数据文件确保程序只能在此之后运行一个月,因为所述数据文件不包含下个月的数据,这需要更新。
The idea is that time is flowing linearly to the future, it can only increase the counter from the launch date and external data is required for the program to run in the future so you've created a dependency relationship on updates. This last strategy is what Microsoft and co used and they call it security updates / patches...
这个想法是时间线性地流向未来,它只能从启动日期开始增加计数器,并且程序在未来运行需要外部数据,因此您已经创建了对更新的依赖关系。最后一个策略是微软和合作伙伴使用的,他们称之为安全更新/补丁......
回答by Luca
You shall decrease the time elapsed between checks. Instead of checking only at application startup and application shutdown, you shall check every 5, 10 or 15 minutes using a timer or a background thread. In this way the user cannot change time (because the software will stops in few minutes).
您应减少两次检查之间的间隔时间。您应该使用计时器或后台线程每 5、10 或 15 分钟检查一次,而不是仅在应用程序启动和应用程序关闭时进行检查。这样用户就不能改变时间(因为软件会在几分钟后停止)。
However, I'd prefer to pay a software that I need instead of not having the correct date/time on my machine.
但是,我更愿意为我需要的软件付费,而不是我的机器上没有正确的日期/时间。
回答by Clark Gaebel
Create a Windows driver that starts on boot, grabs the system date-time, and runs until shutdown, tracking the time independently from Windows [ sleep(1000); ++time; ].
创建一个在启动时启动的 Windows 驱动程序,获取系统日期时间,并一直运行到关机,独立于 Windows [ sleep(1000); 跟踪时间] ++时间;]。
When your application starts up, check that the service is running, and check the date-time! Compare it to the date-time you were installed on, and you can figure out if you've expired or not.
当您的应用程序启动时,检查服务是否正在运行,并检查日期时间!将它与您安装的日期时间进行比较,您可以确定您是否已过期。
Note: If any application did this, I wouldn't install it in the first place. If I WAS tasked with cracking it, it would be trivial. There is no way to prevent reverse engineering. NONE. It WILL get cracked no matter what. And when it does, you're going to regret putting any time into this.
注意:如果有任何应用程序这样做,我不会首先安装它。如果我的任务是破解它,那将是微不足道的。没有办法阻止逆向工程。没有任何。无论如何它都会被破解。当它发生时,你会后悔投入任何时间。
回答by Allon Guralnek
Enable Privilege Use logging (in the installation process) and then check for a time changed event in Windows' event log, as explained here:
启用特权使用日志记录(在安装过程中),然后检查 Windows 事件日志中的时间更改事件,如下所述:
http://www.stevebunting.org/udpd4n6/forensics/timechange.htm
http://www.stevebunting.org/udpd4n6/forensics/timechange.htm
You can then deduct the time difference from the license (rather than void the license, since some system clock changes are legitimate).
然后您可以从许可证中扣除时间差(而不是使许可证无效,因为某些系统时钟更改是合法的)。
NOTE: This will not protect from changes of the system clock when changed from the BIOS.
注意:当从 BIOS 更改时,这不会防止系统时钟的更改。