A method, apparatus, device and medium for authorizing software anti-tamper system time
Patent Information
- Application Number
- CN202310666269.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-07
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2043-06-07
AI Technical Summary
[0002]商业性质的软件在授权其他公司使用的时候,往往通过License许可文件来限制保护产品的授权,而授权时间限制是限制使用方需在合同约定的时间范围内使用,不得私自延长
[0008]本发明实施例中提供的一个或多个技术方案,至少具有如下技术效果或优点:本发明在系统启动的时候,就将当前系统时间写入到时间文件和内存中;然后定期检查当前系统时间与内存文件中的时间、时间文件中存储的时间、程序生成的日志文件名的时间和程序生成的日志文件内容中的日期文本时间,通过日期大小判断当前系统时间是否被篡改,若已被篡改,则停止授权软件服务,从而有效预防通过系统时间篡改的形式来无限期的延迟软件使用时间。
Smart Images

Figure CN116796375B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of software license management, and in particular to a method, apparatus, device, and medium for preventing licensed software from tampering with system time. Background Technology
[0002] When commercial software is licensed to other companies, the licensing agreement is often used to restrict and protect the product's use. The license period limits the user's ability to use the software within the contractually agreed timeframe, prohibiting unauthorized extensions. However, currently, users can tamper with the system time to extend the usage period without authorization, thus harming the licensor's interests. Therefore, preventing the indefinite delay of software use through system time manipulation is of significant importance. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a method, apparatus, device and medium for preventing authorized software from tampering with the system time, which can effectively prevent the software usage time from being delayed indefinitely by tampering with the system time.
[0004] In a first aspect, the present invention provides a method for preventing authorized software from tampering with system time, comprising the following steps: S1. When the system starts up, the current system time is written to the time file and memory; S2. Periodically determine whether the system time has been tampered with using the following items: Periodically check the current system time and the time in the memory file, and determine whether the sum of the memory time and the check period is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the check in the next period. Periodically check the current system time against the time stored in the time file, and determine if the sum of the time in the time file and the check period is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the check in the next period. Periodically check the current system time and the time of the log file name generated by the program to determine if the time parsed from the log file name is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the next cycle to make the judgment. Periodically check the current system time and the date text time in the log file generated by the program. Determine if the sum of the date text time in the log file and the judgment period is greater than the current system time. If so, it is determined that the system time has been tampered with. If not, wait for the judgment of the next period. S3. If the judgment result of any item is that the system time has been tampered with, the authorized software service will be stopped; otherwise, the authorized software service will continue to be provided.
[0005] Secondly, the present invention provides an apparatus for preventing authorized software from tampering with system time, characterized in that it comprises: The write module is used to write the current system time to a time file and memory when the system starts up; The judgment module is used to periodically determine whether the system time has been tampered with based on the following items: Periodically check the current system time and the time in the memory file, and determine whether the sum of the memory time and the check period is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the check in the next period. Periodically check the current system time against the time stored in the time file, and determine if the sum of the time in the time file and the check period is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the check in the next period. Periodically check the current system time and the time of the log file name generated by the program to determine if the time parsed from the log file name is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the next cycle to make the judgment. Periodically check the current system time and the date text time in the log file generated by the program. Determine if the sum of the date text time in the log file and the judgment period is greater than the current system time. If so, it is determined that the system time has been tampered with. If not, wait for the judgment of the next period. In the decision-making module, if the judgment result of any project is that the system time has been tampered with, the authorized software service will be stopped; otherwise, the authorized software service will continue to be provided.
[0006] Thirdly, the present invention provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in the first aspect.
[0007] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0008] One or more technical solutions provided in the embodiments of the present invention have at least the following technical effects or advantages: When the system starts up, the present invention writes the current system time into a time file and memory; then it periodically checks the current system time against the time in the memory file, the time stored in the time file, the time of the log file name generated by the program, and the date text time in the content of the log file generated by the program. It determines whether the current system time has been tampered with by the date size. If it has been tampered with, it stops the authorized software service, thereby effectively preventing the software usage time from being delayed indefinitely by tampering with the system time.
[0009] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0010] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0011] Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention; Figure 2 This is a flowchart illustrating the specific program implementation of the present invention; Figure 3 This is a schematic diagram of the device in Embodiment 2 of the present invention; Figure 4 This is a schematic diagram of the electronic device in Embodiment 3 of the present invention; Figure 5 This is a schematic diagram of the structure of the medium in Embodiment 4 of the present invention. Detailed Implementation
[0012] This application provides a method, apparatus, device, and medium for preventing authorized software from tampering with system time, which can effectively prevent the indefinite delay of software usage time through system time tampering.
[0013] The overall idea of the technical solution in this application embodiment is as follows: When the system starts, the present invention writes the current system time into a time file and memory; then, it periodically checks the current system time against the time in the memory file, the time stored in the time file, the time of the log file name generated by the program, and the date text time in the content of the log file generated by the program. The date size is used to determine whether the current system time has been tampered with. If it has been tampered with, the authorized software service is stopped, thereby effectively preventing the software usage time from being delayed indefinitely by tampering with the system time. Example 1
[0014] like Figure 1As shown, this embodiment provides a method for preventing authorized software from tampering with system time, including the following steps: S1. When the system starts up, the current system time is written to the time file and memory; S2. Periodically determine whether the system time has been tampered with using the following items: (1) Periodically check the current system time and the time in the memory file, and determine whether the sum of the memory time and the judgment period is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the judgment of the next period. (2) Periodically check the current system time and the time stored in the time file, and determine whether the sum of the time in the time file and the judgment period is greater than the current system time. If so, it is determined that the system time has been tampered with. If not, wait for the judgment of the next period. If the user modifies the system time while the authorized software is closed, the authorized software cannot detect it. Therefore, the judgment can be made by comparing the time stored in the time file with the current system time, which can prevent the user from tampering with the system time while the authorized software is closed in order to delay the use of the authorized software. (3) Periodically check the current system time and the time of the log file name generated by the program, and determine whether the time parsed from the log file name is greater than the current system time. If so, it is determined that the system time has been tampered with. If not, wait for the next cycle of judgment. If the user knows that there is a time file, he / she can restore the time of the time file to achieve the purpose of delaying the use of the licensed software. Therefore, by increasing the detection of the time of the log file name generated by the program, it can prevent the user from achieving the purpose of delaying the use of the licensed software by restoring the time of the time file.
[0015] (4) Periodically check the current system time and the date text time in the log file generated by the program, and determine whether the sum of the date text time in the log file and the judgment period is greater than the current system time. If so, it is determined that the system time has been tampered with. If not, wait for the judgment of the next period. S3. If the judgment result of any item is that the system time has been tampered with, the authorized software service will be stopped; otherwise, the authorized software service will continue to be provided.
[0016] In a more preferred or more specific implementation of this embodiment, the method further includes: In step S1, after writing the current system time into the time file and memory, a timer is started to set the period for judging whether the system time has been tampered with.
[0017] In step S2, if the judgment result is that the system time has not been tampered with, the timer is restarted and the judgment of the next cycle begins.
[0018] In step S3, while stopping the authorized software service, encrypted logs are also output.
[0019] In step S2, items (1) to (4) are not in any particular order. Figure 2 As shown, if we take the judgment order from (1) to (4) as an example, the implementation process of this embodiment can be: 1. When starting the system, first check if a time file exists. If it does, read the time from the time file. If not, it means that the time file may have been maliciously deleted. Then output an encrypted log and stop the service. 2. After reading the time from the time file, check if the time in the time file is invalid (null). If not, continue starting the system. If yes, write the current system time to the time file. Under normal circumstances, the time in the time file will be written once every time the system starts. 3. Start the timer to determine if this is the first time the system is running the task. If yes, proceed to the first branch; otherwise, proceed to the second branch. The first branch involves obtaining the current system time and writing it into memory, reading the time stored in the time file, and determining whether the time stored in the time file plus the judgment period (usually set to 24 hours, i.e., once a day) is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, the current system time is obtained and written into the time file to update the time stored in the time file, preparing for the judgment in the next period. Read the date and time (i.e., log output time) from the first N lines (N≥1) of the log file. Determine if the log output time plus the judgment period is greater than the current system time. If so, it is determined that the system time has been tampered with, so an encrypted log is output and the authorized software service is stopped. If not, wait for the judgment of the next period. Read the time of the log file name generated by the program (this refers to the time of the last log file name generated by the program. In addition, since the log file name may be generated in real time, it is not related to the judgment period, so there is no need to add the judgment period). Determine whether the time parsed from the log file name is greater than the current system time. If so, it is determined that the system time has been tampered with, so the encrypted log is output and the authorized software service is stopped. If not, wait for the judgment of the next cycle. The second branch directly reads the memory time and checks if the memory time plus the judgment period is greater than the current system time. If so, it is determined that the system time has been tampered with, and an encrypted log is output, and the authorized software service is stopped. If not, it waits for the judgment of the next cycle.
[0020] Based on the same inventive concept, this application also provides an apparatus corresponding to the method in Embodiment 1, as detailed in Embodiment 2. Example 2
[0021] like Figure 3 As shown, this embodiment provides an apparatus for preventing authorized software from tampering with system time, comprising: The write module is used to write the current system time to a time file and memory when the system starts up; The judgment module is used to periodically determine whether the system time has been tampered with based on the following items: Periodically check the current system time and the time in the memory file, and determine whether the sum of the memory time and the check period is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the check in the next period. Periodically check the current system time against the time stored in the time file, and determine if the sum of the time in the time file and the check period is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the check in the next period. Periodically check the current system time and the time of the log file name generated by the program to determine if the time parsed from the log file name is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the next cycle to make the judgment. Periodically check the current system time and the date text time in the log file generated by the program. Determine if the sum of the date text time in the log file and the judgment period is greater than the current system time. If so, it is determined that the system time has been tampered with. If not, wait for the judgment of the next period. In the decision-making module, if the judgment result of any project is that the system time has been tampered with, the authorized software service will be stopped; otherwise, the authorized software service will continue to be provided.
[0022] In one preferred or more specific implementation of this embodiment, after the writing module writes the current system time to the time file and memory, it also starts a timer to set the period for judging whether the system time has been tampered with.
[0023] If the judgment module determines that the system time has not been tampered with, it restarts the timer and begins the judgment cycle.
[0024] The decision-making module outputs encrypted logs while suspending the authorized software service.
[0025] Since the apparatus described in Embodiment 2 of the present invention is an apparatus used to implement the method of Embodiment 1 of the present invention, those skilled in the art can understand the specific structure and variations of the apparatus based on the method described in Embodiment 1 of the present invention, and therefore will not be described again here. All apparatuses used in the method of Embodiment 1 of the present invention fall within the scope of protection of the present invention.
[0026] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to Embodiment 1, as detailed in Embodiment 3. Example 3
[0027] This embodiment provides an electronic device, such as... Figure 4 As shown, it includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it can implement any of the embodiments in Example 1.
[0028] Since the electronic device described in this embodiment is the device used to implement the method in Embodiment 1 of this application, those skilled in the art can understand the specific implementation method and various variations of the electronic device in this embodiment based on the method described in Embodiment 1 of this application. Therefore, how the electronic device implements the method in the embodiment of this application will not be described in detail here. Any device used by those skilled in the art to implement the method in the embodiment of this application falls within the scope of protection of this application.
[0029] Based on the same inventive concept, this application provides a storage medium corresponding to Embodiment 1, as detailed in Embodiment 4. Example 4
[0030] This embodiment provides a computer-readable storage medium, such as... Figure 5 As shown, a computer program is stored thereon, which, when executed by a processor, can implement any of the embodiments in Example 1.
[0031] The methods, apparatus, systems, devices, and media provided in this application have at least the following technical effects or advantages: When the system starts up, the present invention writes the current system time into a time file and memory; then, it periodically checks the current system time against the time in the memory file, the time stored in the time file, the time of the log file name generated by the program, and the date text time in the content of the log file generated by the program. It determines whether the current system time has been tampered with by the date size. If it has been tampered with, it stops authorizing software services, thereby effectively preventing the software usage time from being delayed indefinitely by tampering with the system time.
[0032] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or systems, or as computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0033] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0034] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0035] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0036] While specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and not intended to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A method for preventing authorized software from tampering with system time, characterized in that: Includes the following steps: S1. When the system starts up, the current system time is written to the time file and memory; S2. Periodically determine whether the system time has been tampered with using the following items: Periodically check the current system time and the time in the memory file, and determine whether the sum of the memory time and the check period is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the check in the next period. Periodically check the current system time against the time stored in the time file, and determine if the sum of the time in the time file and the check period is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the check in the next period. Periodically check the current system time and the time of the log file name generated by the program to determine if the time parsed from the log file name is greater than the current system time. If so, it is determined that the system time has been tampered with, an encrypted log is output, and the authorized software service is stopped. If not, wait for the next cycle of judgment. The time of the log file name generated by the program is the time of the last log file name generated by the program, which is unrelated to the judgment cycle and does not need to be added. Periodically check the current system time and the date text time in the log file generated by the program. Determine if the sum of the date text time in the log file and the judgment period is greater than the current system time. If so, it is determined that the system time has been tampered with. If not, wait for the judgment of the next period. S3. If the judgment result of any item is that the system time has been tampered with, the authorized software service will be stopped; otherwise, the authorized software service will continue to be provided.
2. The method according to claim 1, characterized in that: In step S1, after writing the current system time to the time file and memory, a timer is started to set the period for judging whether the system time has been tampered with. In step S2, if the judgment result is that the system time has not been tampered with, the timer is restarted and the judgment of the next cycle begins.
3. The method according to claim 1, characterized in that: S2 also periodically checks whether the system time has been tampered with using the following items: Read the log output times of the first N lines in the log file, and determine whether the log output times plus 24 hours is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the next cycle to make the judgment.
4. A device for preventing authorized software from tampering with system time, characterized in that: include: The write module is used to write the current system time to a time file and memory when the system starts up; The judgment module is used to periodically determine whether the system time has been tampered with based on the following items: Periodically check the current system time and the time in the memory file, and determine whether the sum of the memory time and the check period is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the check in the next period. Periodically check the current system time against the time stored in the time file, and determine if the sum of the time in the time file and the check period is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the check in the next period. Periodically check the current system time and the time of the log file name generated by the program to determine if the time parsed from the log file name is greater than the current system time. If so, it is determined that the system time has been tampered with, an encrypted log is output, and the authorized software service is stopped; if not, wait for the next cycle of judgment. The time of the log file name generated by the program is the time of the last log file name generated by the program, which is irrelevant to the judgment cycle and does not need to be added. Periodically check the current system time and the date text time in the log file generated by the program. Determine if the sum of the date text time in the log file and the judgment period is greater than the current system time. If so, it is determined that the system time has been tampered with. If not, wait for the judgment of the next period. In the decision-making module, if the judgment result of any project is that the system time has been tampered with, the authorized software service will be stopped; otherwise, the authorized software service will continue to be provided.
5. The apparatus according to claim 4, characterized in that: After the writing module writes the current system time to the time file and memory, it also starts a timer to set the period for judging whether the system time has been tampered with. If the judgment module determines that the system time has not been tampered with, it restarts the timer and begins the judgment cycle.
6. The apparatus according to claim 4, characterized in that: The judgment module is also used to periodically determine whether the system time has been tampered with based on the following items: Read the log output times of the first N lines in the log file, and determine whether the log output times plus 24 hours is greater than the current system time. If so, it is determined that the system time has been tampered with; otherwise, wait for the next cycle to make the judgment.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 3.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
License valid time check method and apparatus
CN107341368A
Software License verification method capable of preventing time tampering
CN110825639A