Virtual machine data generation method based on program data and terminal
By local virtualization of sensitive data in program data, using virtual machine technology to generate virtual machine data and replace the original data, the problems of inefficient virtual machine technology and difficulty in debugging of encryption and shelling technology in the existing technology are solved, and the encryption efficiency and flexibility are improved.
Patent Information
- Application Number
- CN202411376923.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-02-28
AI Technical Summary
The existing virtual machine technology and encryption and shelling technology have problems such as inefficiency, high resource consumption, difficulty in debugging and poor local encryption effects in the field of software protection.
By local virtualization of some sensitive data in the program data, string virtual machines and constant virtual machines are used to generate virtual machine data for string data and constant data respectively. If the parsing output result of the virtual machine data is the same as the original data, it will be replaced.
Improves the efficiency and flexibility of encryption, avoids the need to simulate a complete hardware environment and operating system during virtualization, and improves encryption flexibility through local sensitive data encryption.
Smart Images

Figure CN119538273A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data encryption protection, and in particular to a method and terminal for generating virtual machine data based on program data. Background Art
[0002] In the field of software protection, with the increasing awareness of digital copyright and the increasingly serious problem of software piracy, developers are constantly exploring more efficient and covert technical means to protect the intellectual property rights of their software products from being illegally copied or tampered with. Among them, virtualization technology and encryption and shell technology are two major protection methods and are widely used in the field of software protection.
[0003] Although existing virtual machine technology and encryption and shell technology have achieved certain results in the field of software protection, they still have many limitations. The low efficiency and high resource consumption of traditional virtual machine technology limit its application scope; while encryption and shell technology faces problems such as debugging difficulties caused by overall encryption and poor local encryption effects. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a method and terminal for generating virtual machine data based on program data, which improves the efficiency and flexibility of encryption by locally virtualizing some sensitive data in the program data.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0006] A method for generating virtual machine data based on program data, comprising the steps of:
[0007] Receiving program data to be processed, and obtaining character string data and constant data in the program data to be processed;
[0008] Using a string virtual machine to generate first virtual machine data for the string data, and if a parsing result of the first virtual machine data is the same as the string data, using the first virtual machine data to replace the string data;
[0009] A constant virtual machine is used to generate second virtual machine data for the constant data, and if a parsing result of the second virtual machine data is the same as the constant data, the second virtual machine data is used to replace the constant data.
[0010] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0011] A terminal for generating virtual machine data based on program data comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step of the method for generating virtual machine data based on program data is implemented.
[0012] The beneficial effect of the present invention is that: for the program data to be processed, the string data and constant data therein are obtained, and the string virtual machine and the constant virtual machine are used to generate corresponding virtual machine data for the string data and the constant data respectively, and if the parsing output result of the virtual machine data is the same as the corresponding original data, then the data is replaced. In this way, in the process of virtualization, it is not necessary to simulate the complete hardware environment and operating system, which improves the efficiency of encryption; and by encrypting local sensitive data, the flexibility of encryption can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 A flowchart of a method for generating virtual machine data based on program data according to an embodiment of the present invention;
[0014] Figure 2 A schematic diagram of a virtual machine data generating terminal based on program data according to an embodiment of the present invention;
[0015] Figure 3 The present invention is a logic diagram of a method for generating virtual machine data based on program data according to an embodiment of the present invention.
[0016] Description of labels:
[0017] 1. A virtual machine data generating terminal based on program data; 2. A memory; 3. A processor. DETAILED DESCRIPTION
[0018] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.
[0019] Please refer to Figure 1 The embodiment of the present invention provides a method for generating virtual machine data based on program data, comprising the steps of:
[0020] Receiving program data to be processed, and obtaining character string data and constant data in the program data to be processed;
[0021] Using a string virtual machine to generate first virtual machine data for the string data, and if a parsing result of the first virtual machine data is the same as the string data, using the first virtual machine data to replace the string data;
[0022] A constant virtual machine is used to generate second virtual machine data for the constant data, and if a parsing result of the second virtual machine data is the same as the constant data, the second virtual machine data is used to replace the constant data.
[0023] From the above description, it can be seen that the beneficial effect of the present invention is that: for the program data to be processed, the string data and constant data therein are obtained, and the string virtual machine and the constant virtual machine are used to generate corresponding virtual machine data for the string data and the constant data respectively, and if the parsed output result of the virtual machine data is the same as the corresponding original data, it is replaced. In this way, it is not necessary to simulate the complete hardware environment and operating system during the virtualization process, which improves the efficiency of encryption; and by encrypting local sensitive data, the flexibility of encryption can be improved.
[0024] Further, using a string virtual machine to generate first virtual machine data for the string data includes:
[0025] Use a string virtual machine to convert the string into a hex file format, and array the hex file format, and use the array members as string data branches;
[0026] For any of the string data branches, an array is created for the string data branch, and random numbers are filled in the array; or random XOR data is generated for the string data branch; or a formula is selected from a formula warehouse, and the string data branch is substituted into the formula to obtain a formula calculation result;
[0027] The first virtual machine data is obtained by combining the processing results of each of the string data branches.
[0028] From the above description, it can be seen that the character string is converted into a hexadecimal file format with lines as units to facilitate its array formation, and the array members are used as branches. According to these branches, random numbers in the array are generated and filled, or XOR data is generated, or the calculation results are substituted into the formula. Each branch is processed in an arbitrary manner, and finally the first virtual machine data is obtained by combining the processing results of each branch. This can not only improve the efficiency of virtual data generation, but also ensure the security of the original data.
[0029] Further, using a string virtual machine to generate first virtual machine data for the string data, then comprising:
[0030] It is determined whether the output result of the first virtual machine data is the same as the string data; if not, the string virtual machine is reused to generate the first virtual machine data for the string data.
[0031] It can be seen from the above description that when the output result of the first virtual machine data is different from the original string data, the virtual machine data is regenerated. In this way, the normal operation of the program can be guaranteed.
[0032] Further, using a constant virtual machine to generate second virtual machine data for the constant data includes:
[0033] Using a constant virtual machine, split the constant data into at least two constant data branches, the sum of all the constant data branches being equal to the value of the constant data;
[0034] For any of the constant data branches, an array is created for the constant data branch, and a random number not exceeding the value of the constant data branch is filled in the array; or a random XOR data is generated for the constant data branch; or a formula is selected from a formula warehouse, and the constant data branch is substituted into the formula to obtain a formula calculation result;
[0035] The second virtual machine data is obtained by combining the processing results of each of the constant data branches.
[0036] From the above description, it can be seen that the constant is decomposed into several branches, and random numbers in the array are generated and filled according to these branches, or XOR data is generated, or the calculation results are substituted into the formula. Each branch is processed in an arbitrary way, and finally the processing results of each branch are combined to obtain the second virtual machine data. This can not only improve the efficiency of virtual data generation, but also ensure the security of the original data.
[0037] Further, using a constant virtual machine to generate second virtual machine data for the constant data, then comprising:
[0038] It is determined whether an output result of the second virtual machine data is the same as the constant data; if not, the constant virtual machine is reused to generate the second virtual machine data for the constant data.
[0039] It can be seen from the above description that when the output result of the second virtual machine data is different from the original constant data, the virtual machine data is regenerated. In this way, the normal operation of the program can be guaranteed.
[0040] Please refer to Figure 2 Another embodiment of the present invention provides a virtual machine data generation terminal based on program data, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the various steps of the above-mentioned method for generating virtual machine data based on program data when executing the computer program.
[0041] The method and terminal for generating virtual machine data based on program data of the present invention are suitable for improving the efficiency and flexibility of encryption by partially virtualizing some sensitive data in program data during or after program compilation, and are described below through specific implementation methods:
[0042] Embodiment 1
[0043] Please refer to Figure 1 and Figure 3 , a method for generating virtual machine data based on program data, comprising the steps of:
[0044] S1. Receive program data to be processed, and obtain character string data and constant data in the program data to be processed.
[0045] Specifically, for program data to be processed, if you want to assign a value to a data, you generally set the variable m_temp = 0x60, which means that the value of m_temp is equal to 0x60. However, in order to prevent 0x60 from being directly obtained by tools such as ida, the constant data (or string data) in the program needs to be hidden in this embodiment.
[0046] S2. Use a string virtual machine to generate first virtual machine data for the string data. If a parsing result of the first virtual machine data is the same as the string data, use the first virtual machine data to replace the string data.
[0047] S21. Use a string virtual machine to convert the string into a hex file format, convert the hex file format into an array, and use the array members as string data branches.
[0048] For example, when the string data is m_text[8] = "welcome", the converted hex file format is m_text_x[8] = {0x77, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x0}. At this time, the hex file format can be arrayed, and the number of split arrays is (s-rand%s), where rand is a random number and s is the data size of the string data. In the above example, s = 8.
[0049] The sum of the string data branches obtained by splitting is the original string data.
[0050] S22. For any of the string data branches, an array is created for the string data branch and random numbers are filled into the array; or random XOR data is generated for the string data branch; or a formula is selected from a formula warehouse, and the string data branch is substituted into the formula to obtain a formula calculation result.
[0051] Specifically, for any string data branch, you can choose whether to use an array, XOR, or formula for processing.
[0052] S23. Combining the processing results of each of the string data branches, obtain first virtual machine data.
[0053] S24: Determine whether the output result of the first virtual machine data is the same as the string data; if not, reuse the string virtual machine to generate the first virtual machine data for the string data.
[0054] Specifically, the first virtual machine data is parsed and run to determine whether the running output result is the same as the string data. If they are the same, the first virtual machine data is saved and used to replace the original data to achieve a partial virtualization effect. If they are not the same, the first virtual machine data is regenerated.
[0055] S3. Use a constant virtual machine to generate second virtual machine data for the constant data. If a parsing result of the second virtual machine data is the same as the constant data, use the second virtual machine data to replace the constant data.
[0056] S31. Use a constant virtual machine to split the constant data into at least two constant data branches, and the sum of all the constant data branches is equal to the value of the constant data.
[0057] For example, when the constant data is 100, it can be split into three branches 20, 40, 40.
[0058] S32. For any of the constant data branches, an array is established for the constant data branch, and random numbers not exceeding the value of the constant data branch are filled in the array; or random XOR data is generated for the constant data branch; or a formula is selected from a formula warehouse, and the constant data branch is substituted into the formula to obtain the formula calculation result.
[0059] Specifically, for any constant data branch, you can choose whether to use an array, XOR, or formula for processing.
[0060] S33. Combining the processing results of each of the constant data branches, obtain second virtual machine data.
[0061] S34: Determine whether the output result of the second virtual machine data is the same as the constant data; if not, reuse the constant virtual machine to generate the second virtual machine data for the constant data.
[0062] Specifically, the first virtual machine data is parsed and run to determine whether the running output result is the same as the constant data. If they are the same, the first virtual machine data is saved and used to replace the original data to achieve a partial virtualization effect. If they are not the same, the first virtual machine data is regenerated.
[0063] Embodiment 2
[0064] Please refer to Figure 2 A virtual machine data generation terminal 1 based on program data includes a memory 2, a processor 3, and a computer program stored in the memory 2 and executable on the processor 3. When the processor 3 executes the computer program, each step of a virtual machine data generation method based on program data of embodiment 1 is implemented.
[0065] In summary, the present invention provides a method and terminal for generating virtual machine data based on program data, for program data to be processed, obtains string data and constant data therein, and uses string virtual machines and constant virtual machines to generate corresponding virtual machine data for string data and constant data respectively. Among them, for string data, it is necessary to convert the string into a hexadecimal file format in lines, then array it, and use the array members as branches; for constant data, the numerical value is directly divided into branches. Regardless of whether it is a string data branch or a constant data branch, each branch can choose to generate and fill random numbers in the array, or generate XOR data, or substitute it into a formula to obtain a calculation result. Each branch is processed in an arbitrary manner, and finally the virtual machine data is obtained by combining the processing results of each branch, which can not only improve the generation efficiency of virtual data, but also ensure the security of the original data. If the parsing output result of the virtual machine data is the same as the corresponding original data, it is replaced. In this way, it is not necessary to simulate the complete hardware environment and operating system during the virtualization process, which improves the efficiency of encryption; and by encrypting local sensitive data, the flexibility of encryption can be improved.
[0066] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for generating virtual machine data based on program data, characterized in that: Includes steps: Receiving program data to be processed, and obtaining character string data and constant data in the program data to be processed; Using a string virtual machine to generate first virtual machine data for the string data, and if a parsing result of the first virtual machine data is the same as the string data, using the first virtual machine data to replace the string data; A constant virtual machine is used to generate second virtual machine data for the constant data, and if a parsing result of the second virtual machine data is the same as the constant data, the second virtual machine data is used to replace the constant data.
2. The method for generating virtual machine data based on program data according to claim 1, characterized in that: Using a string virtual machine to generate first virtual machine data for the string data includes: Use a string virtual machine to convert the string into a hex file format, and array the hex file format, and use the array members as string data branches; For any of the string data branches, an array is created for the string data branch, and random numbers are filled in the array; or random XOR data is generated for the string data branch; or a formula is selected from a formula warehouse, and the string data branch is substituted into the formula to obtain a formula calculation result; The first virtual machine data is obtained by combining the processing results of each of the string data branches.
3. The method for generating virtual machine data based on program data according to claim 2, characterized in that: Using a string virtual machine to generate first virtual machine data for the string data, and then comprising: It is determined whether the output result of the first virtual machine data is the same as the string data; if not, the string virtual machine is reused to generate the first virtual machine data for the string data.
4. The method for generating virtual machine data based on program data according to claim 1, characterized in that: Generating second virtual machine data for the constant data using a constant virtual machine includes: Using a constant virtual machine, split the constant data into at least two constant data branches, the sum of all the constant data branches being equal to the value of the constant data; For any of the constant data branches, an array is created for the constant data branch, and a random number not exceeding the value of the constant data branch is filled in the array; or a random XOR data is generated for the constant data branch; or a formula is selected from a formula warehouse, and the constant data branch is substituted into the formula to obtain a formula calculation result; The second virtual machine data is obtained by combining the processing results of each of the constant data branches.
5. The method for generating virtual machine data based on program data according to claim 4, characterized in that: Using a constant virtual machine to generate second virtual machine data for the constant data, then comprising: It is determined whether an output result of the second virtual machine data is the same as the constant data; if not, the constant virtual machine is reused to generate the second virtual machine data for the constant data.
6. A virtual machine data generation terminal based on program data, 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 computer program, the following steps are implemented: Receiving program data to be processed, and obtaining character string data and constant data in the program data to be processed; Using a string virtual machine to generate first virtual machine data for the string data, and if a parsing result of the first virtual machine data is the same as the string data, using the first virtual machine data to replace the string data; A constant virtual machine is used to generate second virtual machine data for the constant data, and if a parsing result of the second virtual machine data is the same as the constant data, the second virtual machine data is used to replace the constant data.
7. A terminal for generating virtual machine data based on program data according to claim 6, characterized in that: Using a string virtual machine to generate first virtual machine data for the string data includes: Use a string virtual machine to convert the string into a hex file format, and array the hex file format, and use the array members as string data branches; For any of the string data branches, an array is created for the string data branch, and random numbers are filled in the array; or random XOR data is generated for the string data branch; or a formula is selected from a formula warehouse, and the string data branch is substituted into the formula to obtain a formula calculation result; The first virtual machine data is obtained by combining the processing results of each of the string data branches.
8. The terminal for generating virtual machine data based on program data according to claim 7, characterized in that: Using a string virtual machine to generate first virtual machine data for the string data, and then comprising: It is determined whether the output result of the first virtual machine data is the same as the string data; if not, the string virtual machine is reused to generate the first virtual machine data for the string data.
9. The terminal for generating virtual machine data based on program data according to claim 6, characterized in that: Generating second virtual machine data for the constant data using a constant virtual machine includes: Using a constant virtual machine, split the constant data into at least two constant data branches, the sum of all the constant data branches being equal to the value of the constant data; For any of the constant data branches, an array is created for the constant data branch, and a random number not exceeding the value of the constant data branch is filled in the array; or a random XOR data is generated for the constant data branch; or a formula is selected from a formula warehouse, and the constant data branch is substituted into the formula to obtain a formula calculation result; The second virtual machine data is obtained by combining the processing results of each of the constant data branches.
10. The terminal for generating virtual machine data based on program data according to claim 9, characterized in that: Using a constant virtual machine to generate second virtual machine data for the constant data, then comprising: It is determined whether an output result of the second virtual machine data is the same as the constant data; if not, the constant virtual machine is reused to generate the second virtual machine data for the constant data.