A dynamic heterogeneous method and system for mimicry application service code
By randomly selecting heterogeneous functions and compiler versions at the business code level to generate heterogeneous applications, the problem of insufficient code-level heterogeneity in existing technologies is solved, achieving application heterogeneity and rapid generation, and improving the security of mimicry networks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HENAN XINDA WANGYU TECH CO LTD
- Filing Date
- 2021-12-24
- Publication Date
- 2026-04-24
AI Technical Summary
Existing technologies struggle to achieve effective heterogeneity at the business code level, resulting in mimicry defense systems having the same vulnerabilities or backdoors at the code level, thus affecting their protection capabilities.
By randomly selecting function sets and compiler versions from heterogeneous function libraries, heterogeneous application source code is generated and compiled. This ensures the heterogeneity of different applications, avoids the occurrence of the same vulnerabilities or backdoors, and prioritizes compilers with shorter compilation times to improve compilation efficiency.
It achieves heterogeneity among different applications, prevents the same attack from affecting multiple applications, improves the security of the mimicry network, and ensures the rapid generation of applications.
Smart Images

Figure CN114356338B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of mimicry defense, and more specifically, to a method and system for dynamic heterogeneity of mimicry application business code. Background Technology
[0002] Mimicry defense technology has revolutionized cybersecurity, offering a novel solution for network applications to achieve network security. Heterogeneous design is a crucial component in the implementation of mimicry defense technology; the degree of heterogeneity determines the effectiveness of the mimicry system against attacks.
[0003] Currently, different CPU architectures are often chosen at the processor level, different operating systems are often used at the operating system level, and different compilers are often used at the business code level.
[0004] However, compiling the same code with different compilers often makes it difficult to avoid the existence of identical vulnerabilities or backdoors at the code level. Therefore, achieving effective heterogeneity at the code level is crucial for improving the protective capabilities of mimicry defense systems.
[0005] In order to solve the above problems, people have been seeking an ideal technological solution. Summary of the Invention
[0006] The purpose of this invention is to address the shortcomings of existing technologies by providing a method and system for dynamic heterogeneity of mimicry application business code.
[0007] To achieve the above objectives, the first aspect of the present invention provides a method for dynamic heterogeneity of mimicry application business code, comprising the following steps:
[0008] Upon receiving a request, at least one function is randomly selected from the heterogeneous function library to heterogeneously process the initial application source code, generating heterogeneous application source code. The heterogeneous function library includes multiple sets of functions that make up the application source code, and each set of functions includes multiple functions with the same functionality but different internal implementation logic.
[0009] The system searches the historical production record database for a production record containing the heterogeneous application source code. If no such record exists, it randomly selects a compiler from the heterogeneous compiler library to compile the heterogeneous application source code, generating an executable application. The heterogeneous application source code and the compiler version are then saved as the application's production record in the historical production record database. The heterogeneous compiler library contains different versions of the same compiler.
[0010] Otherwise, further search in all production records containing heterogeneous application source code to see if any of the pre-installed compiler versions in the heterogeneous compiler library exist. If they exist, return to execute the heterogeneous application source code generation step. If they do not exist, randomly select a compiler version from the compiler versions not included in the corresponding production record to compile the heterogeneous application source code, generate an executable application, and save the heterogeneous application source code and compiler version as the production record of the application to the historical production record library.
[0011] Based on the above, when randomly selecting a compiler from the heterogeneous compiler library to compile the heterogeneous application source code, it is determined whether there are any functions with added marking information in the heterogeneous application source code. If so, the compiler version in the heterogeneous compiler library that is not included in the marking information is used as a candidate compiler version, and a compiler is randomly selected from the candidate compiler versions to compile the heterogeneous application source code; otherwise, all compiler versions in the heterogeneous compiler library are directly used as candidate compiler versions, and a compiler is randomly selected from the candidate compiler versions to compile the heterogeneous application source code.
[0012] When further searching for the existence of all pre-installed compiler versions in the heterogeneous compiler library in all production records containing heterogeneous application source code, first determine whether there are function functions with added marking information in the heterogeneous application source code. If not, further search for the existence of all pre-installed compiler versions in the heterogeneous compiler library in the corresponding production records. If all compiler versions are found, return to execute the heterogeneous application source code generation step. If not all compiler versions are found, use the compiler versions in the heterogeneous compiler library that are not found in the production records as candidate compiler versions, and randomly select a compiler version from the candidate compiler versions to compile the heterogeneous application source code.
[0013] Otherwise, further search the corresponding production records to see if there are any compiler versions other than those in the tag information. If all compiler versions other than those in the tag information are found, return to the heterogeneous application source code generation step; if no compiler versions other than those in the tag information are found, use the compiler version in the heterogeneous compiler library that is neither included in the tag information nor found in the production records as a candidate compiler version, and randomly select a compiler version from the candidate compiler versions to compile the heterogeneous application source code.
[0014] The marking information includes compiler versions that failed to compile. When building a heterogeneous function library, each time a function is designed, it is compiled once using all compiler versions in the heterogeneous compiler library. If the function can be successfully compiled by all compiler versions, no marking is required; if the function cannot be successfully compiled by individual compiler versions, the marking information is added to the function; otherwise, the function is redesigned.
[0015] Based on the above, when randomly selecting a compiler version from the candidate compiler versions to compile the heterogeneous application source code, the total compilation time of each candidate compiler version for the heterogeneous application source code is obtained according to the compilation schedule of all functional functions in the heterogeneous application source code, and the candidate compiler version with the shortest total compilation time is selected to compile the heterogeneous application source code.
[0016] The compilation schedule for each function includes the compiler version and compilation time. The total compilation time for the heterogeneous application source code for each candidate compiler version is equal to the sum of the compilation times for each function for each candidate compiler version. When building the heterogeneous function library, for each function designed, it is compiled once using all compiler versions in the heterogeneous compiler library, and the compilation time when the function is successfully compiled for each compiler version is recorded. The compilation schedule for the function is established based on the compilation times of the function for different compiler versions.
[0017] A second aspect of the present invention provides a dynamic heterogeneous device for mimicry application business code, comprising:
[0018] Heterogeneous function library, which includes multiple sets of functional functions that make up the application source code. Each set of functional functions includes multiple functional functions that have the same functionality but different internal implementation logic.
[0019] The heterogeneous compiler library comes pre-loaded with different versions of the same compiler. Each version of the compiler is used to compile the source code of heterogeneous applications, generate executable applications, and save the production records of the applications to the historical production record library.
[0020] A historical production record library is used to store the production records of each application, including heterogeneous application source code and compiler version;
[0021] A heterogeneous application source code generator is used to randomly select at least one function from a heterogeneous function library to heterogeneously process the initial application source code after receiving a request, thereby generating heterogeneous application source code; and when the generated heterogeneous application source code has a corresponding production record in the historical production record library, and the corresponding production record contains all compiler versions, it is used to randomly select at least one function from a heterogeneous function library to heterogeneously process the initial application source code, thereby generating heterogeneous application source code.
[0022] The compiler version selector is used to randomly select a compiler version from the heterogeneous compiler library to compile the heterogeneous application source code when no production record containing the heterogeneous application source code exists in the historical production record library; and to randomly select a compiler version from the compiler versions not included in the corresponding production record to compile the heterogeneous application source code when a production record containing the heterogeneous application source code exists in the historical production record library and the corresponding production record does not contain all compiler versions.
[0023] A third aspect of the present invention provides a mimicry application system, including an adjudicator, a scheduler, a plurality of executors, and the aforementioned mimicry application business code dynamic heterogeneous device. The plurality of executors are each connected to a mimicry application business code dynamic heterogeneous device for loading the application generated by the mimicry application business code dynamic heterogeneous device. In the initial state, the plurality of executors share a single heterogeneous application source code.
[0024] The arbitrator is connected to several execution entities and is used to make decisions on the several execution entities;
[0025] The scheduler is connected to the arbiter and the dynamic heterogeneous device for mimicry application business code respectively, and is used to notify the dynamic heterogeneous device for mimicry application business code to generate a new application and send it to the abnormal execution body adjudicated by the arbiter;
[0026] After generating heterogeneous application source code, the dynamic heterogeneous device for mimicry application business code determines whether the heterogeneous application source code is consistent with the current application source code corresponding to the normal executor. If they are consistent, the heterogeneous application source code is regenerated; if they are inconsistent, the step of checking if the generated heterogeneous application source code has a corresponding production record in the historical production record database continues.
[0027] The steps for obtaining the current application source code corresponding to the normal executor are as follows: The mimicry application business code dynamic heterogeneous device obtains the current application of the normal executor based on the built-in sending records, and searches for the corresponding production records to obtain the current application source code corresponding to each normal executor.
[0028] A fourth aspect of the present invention provides a mimicry application system, comprising an adjudicator, a scheduler, a plurality of executors, and the aforementioned mimicry application business code dynamic heterogeneous device; each executor is also connected to a mimicry application business code dynamic heterogeneous device for loading an application generated by the mimicry application business code dynamic heterogeneous device. In the initial state, different executors each have heterogeneous application source code in a different language built-in; the adjudicator is connected to the plurality of executors for adjudicating the plurality of executors; the scheduler is connected to the adjudicator and the mimicry application business code dynamic heterogeneous device for notifying the corresponding mimicry application business code dynamic heterogeneous device to generate a new application based on the abnormal executor adjudicated by the adjudicator, and sending it to the abnormal executor.
[0029] Based on the above, after the heterogeneous function library is built in each mimicry application business code dynamic heterogeneous device, for each application source code in the heterogeneous function library, the code similarity between it and each application source code in other mimicry application business code dynamic heterogeneous devices is calculated, and an application source code similarity table is generated.
[0030] When the scheduler notifies the corresponding mimicry application business code dynamic heterogeneous device to generate a new application based on the abnormal execution body decided by the arbiter, the mimicry application business code dynamic heterogeneous device obtains the last production record of other mimicry application business code dynamic heterogeneous devices.
[0031] After generating heterogeneous application source code, the dynamic heterogeneous device for mimicry application business code searches the application source code similarity table to determine whether the similarity between the heterogeneous application source code and the application source code in the last production record of other dynamic heterogeneous application generation devices is lower than a preset threshold. If it is lower, it searches the historical production records to determine whether the heterogeneous application source code has existed before; otherwise, it re-executes the heterogeneous application source code generation step.
[0032] This invention has outstanding substantive features and significant progress compared to the prior art. Specifically,
[0033] This invention achieves code-level heterogeneity by using several functionally identical but internally different functions while maintaining the logical framework of the source code. It then generates an executable application through compilation, thus achieving application heterogeneity. Since different applications do not share the same vulnerabilities or underlying code, the same attack cannot simultaneously target multiple applications. This ensures that the response information returned by different executors cannot pass the consistency test, resulting in the attack failing and improving the security of the mimicry network.
[0034] This invention further improves the heterogeneity of generated applications by setting different versions of compilers; when selecting a compiler version, it ensures that the selected compiler can successfully compile the heterogeneous application source code by selecting a compiler version not included in the tag information, and further improves compilation efficiency by prioritizing compilers with shorter compilation times, thus ensuring the rapid generation of heterogeneous applications.
[0035] In this invention, when different executors are connected to the same dynamic heterogeneous device for mimicry application business code, the heterogeneous application source code is compared with the application source code of other online executors during the process of generating the heterogeneous application, further ensuring the heterogeneity of the source code between different executors.
[0036] In this invention, when different executors are connected to different dynamic heterogeneous devices for mimicry application business code, after a certain dynamic heterogeneous device for mimicry application business code generates heterogeneous application source code, the application source code similarity table ensures that only heterogeneous application source code whose similarity to the current application source code of other heterogeneous application dynamic generation devices is lower than a preset threshold can continue the subsequent application generation steps. That is, the heterogeneity of applications of different executors is ensured through the linkage of dynamic heterogeneous devices for mimicry application business code. Attached Figure Description
[0037] Figure 1 This is a flowchart illustrating the dynamic heterogeneity method for mimicry application business code in this invention.
[0038] Figure 2 This is a schematic diagram of the structure of the first mimicry application system of the present invention.
[0039] Figure 3 This is a schematic diagram of the structure of the second type of mimicry application system of the present invention. Detailed Implementation
[0040] The technical solution of the present invention will be further described in detail below through specific embodiments.
[0041] like Figure 1 As shown, a method for dynamic heterogeneity of mimicry application business code includes the following steps:
[0042] S1, upon receiving a request, randomly selects at least one function from the heterogeneous function library to heterogeneously process the initial application source code, generating heterogeneous application source code; the heterogeneous function library includes multiple function sets that make up the application source code, each function set including multiple functions with the same functionality but different internal implementation logic; the application source code is often composed of functions and variables, represented by S={F1, F2, F3, V1, V2, V3}, where F1, F2, F3 represent function sets, and V1, V2, V3 represent variables; function sets are stored in the form of function set, for example, represented by the set F1={A1, A2, A3}, where F1 represents the function functionality, and A1, A2, A3 represent the function names, where A1, A2, A3 have the same function functionality, the same input parameters, output parameters, and return values, but different internal implementation logic;
[0043] Suppose the application source code S = {F1, F2, F3, V1, V2, V3}, where F1, F2, and F3 are sets from a heterogeneous function library, F1 = {A1, A2, A3}, F2 = {B1, B2, B3}, and F3 = {C1, C2, C3}; initially, the application source code S1 = {F1.A1, F2.B1, F3.C1, V1, V2, V3}. Upon receiving a request, a new function is randomly selected from the heterogeneous function library to replace the function in the application source code S1; specifically... There are two ways to select at least one function from the heterogeneous function library to heterogeneously modify the initial application source code. One way is to replace all functions in the initial application source code to obtain heterogeneous application source code S2, for example, S2={F1.A2, F2.B2, F3.C2, V1, V2, V3}. The other way is to randomly replace the functions in the initial application source code to obtain heterogeneous application source code S3, for example, S3={F1.A1, F2.B1, F3.C2, V1, V2, V3}.
[0044] S2. Search the historical production record library for a production record containing heterogeneous application source code. If no record exists, randomly select a compiler from the heterogeneous compiler library to compile the heterogeneous application source code, generate an executable application, and save the heterogeneous application source code and compiler version as the production record of the application to the historical production record library.
[0045] Otherwise, further search in all production records containing heterogeneous application source code to see if all the compiler versions pre-installed in the heterogeneous compiler library exist. If they exist, return to execute the heterogeneous application source code generation step. If they do not exist, randomly select a compiler version from the compiler versions not included in the corresponding production record to compile the heterogeneous application source code, generate an executable application, and save the heterogeneous application source code and compiler version as the production record of the application to the historical production record library.
[0046] The heterogeneous compiler library is pre-installed with different versions of the same compiler; the heterogeneous compiler library is represented by COM, identified by COM={C1, C2, C3}, where C1, C2, and C3 represent different versions of the same compiler; the production record is N1={S, COM, N}, where S represents the application source code, COM represents the compiler version, and N represents the executable file name.
[0047] Preferably, the initial application source code is specified by the user in advance when there are no historical production records. When there are historical production records, the application source code of the last production record is used as the initial application source code.
[0048] This invention achieves code-level heterogeneity by using several functional functions with the same functionality but different internal logic while keeping the logical framework of the source code unchanged. It then generates an executable application through compilation by a compiler, thus achieving application heterogeneity.
[0049] Specifically, when randomly selecting a compiler from the heterogeneous compiler library to compile the heterogeneous application source code, it is determined whether there are any functions in the heterogeneous application source code that have been marked with tagged information. If so, the compiler version in the heterogeneous compiler library that is not included in the tagged information is used as a candidate compiler version, and a compiler is randomly selected from the candidate compiler versions to compile the heterogeneous application source code; otherwise, all compiler versions in the heterogeneous compiler library are directly used as candidate compiler versions, and a compiler is randomly selected from the candidate compiler versions to compile the heterogeneous application source code.
[0050] When further searching for the existence of all pre-installed compiler versions in the heterogeneous compiler library in all production records containing heterogeneous application source code, first determine whether there are function functions with added marking information in the heterogeneous application source code. If not, further search for the existence of all pre-installed compiler versions in the heterogeneous compiler library in the corresponding production records. If all compiler versions are found, return to execute the heterogeneous application source code generation step. If not all compiler versions are found, use the compiler versions in the heterogeneous compiler library that are not found in the production records as candidate compiler versions, and randomly select a compiler version from the candidate compiler versions to compile the heterogeneous application source code.
[0051] Otherwise, further search the corresponding production records to see if there are any compiler versions other than those in the tag information. If all compiler versions other than those in the tag information are found, return to the heterogeneous application source code generation step; if no compiler versions other than those in the tag information are found, use the compiler version in the heterogeneous compiler library that is neither included in the tag information nor found in the production records as a candidate compiler version, and randomly select a compiler version from the candidate compiler versions to compile the heterogeneous application source code.
[0052] The marking information includes compiler versions that failed to compile. When building a heterogeneous function library, each time a function is designed, it is compiled once using all compiler versions in the heterogeneous compiler library. If the function can be successfully compiled by all compiler versions, no marking is required; if the function cannot be successfully compiled by individual compiler versions, the marking information is added to the function; otherwise, the function is redesigned.
[0053] It is understandable that the faster the application is generated, the shorter the execution cleanup time, and the better the security of the mimicry system. However, the compilation process takes a lot of time during application generation. Therefore, when randomly selecting a compiler version from the candidate compiler versions to compile the heterogeneous application source code, the total compilation time of each candidate compiler version for the heterogeneous application source code can be obtained based on the compilation schedule of all functional functions in the heterogeneous application source code. The candidate compiler version with the shortest total compilation time can then be selected to compile the heterogeneous application source code, thereby improving compilation efficiency and ensuring the rapid generation of heterogeneous applications.
[0054] The compilation schedule for each function includes the compiler version and compilation time. The total compilation time for the heterogeneous application source code for each candidate compiler version is equal to the sum of the compilation times for each function for each candidate compiler version. When building the heterogeneous function library, for each function designed, it is compiled once using all compiler versions in the heterogeneous compiler library, and the compilation time when the function is successfully compiled for each compiler version is recorded. The compilation schedule for the function is established based on the compilation times of the function for different compiler versions.
[0055] Example 2
[0056] This embodiment provides a dynamic heterogeneous device for mimicry application business code, including:
[0057] Heterogeneous function library, which includes multiple sets of functional functions that make up the application source code. Each set of functional functions includes multiple functional functions that have the same functionality but different internal implementation logic.
[0058] The heterogeneous compiler library comes pre-loaded with different versions of the same compiler. Each version of the compiler is used to compile the source code of heterogeneous applications, generate executable applications, and save the production records of the applications to the historical production record library.
[0059] A historical production record library is used to store the production records of each application, including heterogeneous application source code and compiler version;
[0060] A heterogeneous application source code generator is used to randomly select at least one function from a heterogeneous function library to heterogeneously process the initial application source code after receiving a request, thereby generating heterogeneous application source code; and when the generated heterogeneous application source code has a corresponding production record in the historical production record library, and the corresponding production record contains all compiler versions, it is used to randomly select at least one function from a heterogeneous function library to heterogeneously process the initial application source code, thereby generating heterogeneous application source code.
[0061] The compiler version selector is used to randomly select a compiler version from the heterogeneous compiler library to compile the heterogeneous application source code when no production record containing the heterogeneous application source code exists in the historical production record library; and to randomly select a compiler version from the compiler versions not included in the corresponding production record to compile the heterogeneous application source code when a production record containing the heterogeneous application source code exists in the historical production record library and the corresponding production record does not contain all compiler versions.
[0062] This invention achieves code-level heterogeneity by using several functionally identical but internally different functions while maintaining the logical framework of the source code. It then generates an executable application through compilation, thus achieving application heterogeneity. Since different applications do not share the same vulnerabilities or underlying code, the same attack cannot simultaneously target multiple applications. This ensures that the response information returned by different executors cannot pass the consistency test, resulting in the attack failing and improving the security of the mimicry network.
[0063] Since the number of application source codes is limited, in order to enhance the heterogeneity of the application, this embodiment sets up different versions of the same compiler. When compiling heterogeneous application source code, the compiler version is randomly selected for compilation, which further improves the heterogeneity of the generated application.
[0064] When a function embeds a system function call, some compiler versions may fail to compile. To avoid this, when building the heterogeneous function library, each designed function is compiled using all compiler versions in the heterogeneous compiler library. If the function can be successfully compiled by all compiler versions, no marking is needed; if the function cannot be successfully compiled by a particular compiler version, the marking information is added to the function, including the compiler versions that failed to compile; otherwise, the function is redesigned.
[0065] It is understood that when the compiler version selector randomly selects a compiler version from the heterogeneous compiler library to compile the heterogeneous application source code, it first determines whether there are any functions in the heterogeneous application source code that have been marked with tagged information. If so, the compiler version in the heterogeneous compiler library that is not included in the tagged information is used as a candidate compiler version, and a compiler version is randomly selected from the candidate compiler versions to compile the heterogeneous application source code; otherwise, all compiler versions in the heterogeneous compiler library are directly used as candidate compiler versions, and a compiler version is randomly selected from the candidate compiler versions to compile the heterogeneous application source code.
[0066] Before randomly selecting a compiler version from those not included in the corresponding production record to compile the heterogeneous application source code, the compiler version selector first determines whether there are any functions with added marking information in the heterogeneous application source code. If not, it further searches in the corresponding production record to see if all the compiler versions pre-installed in the heterogeneous compiler library exist. If all compiler versions are found, it returns to the heterogeneous application source code generation step. If not all compiler versions are found, the compiler version in the heterogeneous compiler library that is not found in the production record is used as a candidate compiler version, and a compiler version is randomly selected from the candidate compiler versions to compile the heterogeneous application source code.
[0067] Otherwise, further search the corresponding production records to see if there are any compiler versions other than those in the tag information. If all compiler versions other than those in the tag information are found, return to the heterogeneous application source code generation step; if no compiler versions other than those in the tag information are found, use the compiler version in the heterogeneous compiler library that is neither included in the tag information nor found in the production records as a candidate compiler version, and randomly select a compiler version from the candidate compiler versions to compile the heterogeneous application source code.
[0068] Clearly, when selecting a compiler version, choosing one that is not included in the tag information ensures that the selected compiler can successfully compile heterogeneous application source code, thus improving the speed of application generation.
[0069] Furthermore, when the compiler version selector randomly selects a compiler version from the candidate compiler versions to compile the heterogeneous application source code, it obtains the total compilation time of each candidate compiler version for the heterogeneous application source code based on the compilation schedule of all functional functions in the heterogeneous application source code, and selects the candidate compiler version with the shortest total compilation time to compile the heterogeneous application source code.
[0070] The compilation timeline for each function includes the compiler version and compilation time. The total compilation time for each alternative compiler version of the heterogeneous application source code is equal to the sum of the compilation times for each function of each alternative compiler version.
[0071] The steps for constructing the compilation schedule for each function are as follows: When constructing the heterogeneous function library, for each function designed, all compiler versions in the heterogeneous compiler library are used for compilation once, and the compilation time when the function is successfully compiled by each compiler version is recorded. The compilation schedule for the function is established based on the compilation time of the function by different compiler versions.
[0072] It is understandable that when selecting a compiler version, prioritizing a compiler with a shorter compilation time can improve compilation efficiency and ensure the rapid generation of heterogeneous applications.
[0073] Example 3
[0074] This embodiment provides a mimicry application system, such as Figure 2 As shown, it includes an adjudicator, a scheduler, several executors, and the dynamic heterogeneous device for mimicry application business code as described in Embodiment 2. The several executors are each connected to a dynamic heterogeneous device for mimicry application business code and are used to load the application generated by the dynamic heterogeneous device for mimicry application business code. In the initial state, the several executors share a single heterogeneous application source code.
[0075] The arbitrator is connected to several execution entities and is used to make decisions on the several execution entities;
[0076] The scheduler is connected to the arbiter and the mimicry application business code dynamic heterogeneous device respectively, and is used to notify the mimicry application business code dynamic heterogeneous device to generate a new application and send it to the abnormal execution body adjudicated by the arbiter;
[0077] After generating heterogeneous application source code, the dynamic heterogeneous device for mimicry application business code determines whether the heterogeneous application source code is consistent with the current application source code corresponding to the normal executor. If they are consistent, the heterogeneous application source code is regenerated; if they are inconsistent, the step of checking if the generated heterogeneous application source code has a corresponding production record in the historical production record database continues.
[0078] The steps for obtaining the current application source code corresponding to the normal executor are as follows: The mimicry application business code dynamic heterogeneous device obtains the current application of the normal executor based on the built-in sending records, and searches for the corresponding production records to obtain the current application source code corresponding to each normal executor.
[0079] The heterogeneous process of the application in the mimicry application system is as follows: In the initial state, the production records of the currently online executor are pre-set in the historical production record library. In order to distinguish the application production process of each executor, each executor corresponds to a production record set. The production record set of executor 1 is N1P={S, COM, N}, the production record set of executor 2 is N2P={S, COM, N}, and the production record set of executor 3 is N3P={S, COM, N}. S represents the application source code, COM represents the compiler version, and N represents the executable file name. In the initial state, the production record sets are N1P1={S1, COM1, N1}, N2P1={S1, COM1, N1}, and N3P1={S1, COM1, N1}.
[0080] When the arbiter detects an abnormality in Executor 1, it sends the abnormality information to the scheduler. Upon receiving the abnormality ruling information, the scheduler cleans up Executor 1. The cleaning process is as follows:
[0081] First, the scheduler notifies the dynamic heterogeneous device of the mimicry application business code that Executor 1 needs to generate a new application.
[0082] After receiving the task, the heterogeneous application business code dynamic heterogeneous device first checks the production record of Executor 1 from the historical production record library, obtains the application source code status S1={F1.A1, F2.B1, F3.C1, V1, V2, V3} from the N1P set, then obtains F1={A1, A2, A3} from the heterogeneous function library, replaces the F1.A1 function in S1, and generates new application source code S2={F1.A2, F2.B1, F3.C1, V1, V2, V3}.
[0083] After generating the heterogeneous application source code S2, the dynamic heterogeneous device for mimicking application business code determines whether the heterogeneous application source code S2 is consistent with the application source code in the production records N2P1 and N3P1 of the normal executor. If they are consistent, the heterogeneous application source code is regenerated; if they are inconsistent, the compiler COM1 is randomly selected to compile the application source code S2, and a new application name N2 is generated. Then, a new record N1P2={S2, COM2, N2} is added to the historical production record database.
[0084] The mimicry application business code dynamic heterogeneous device passes the newly generated application to Executor 1. Executor 1 completes the loading of the new application. At this point, the cleaning of Executor 1 is complete.
[0085] In this invention, when different executors are connected to the same dynamic heterogeneous device for mimicry application business code, the heterogeneous application source code is compared with the application source code of other online executors during the process of generating the heterogeneous application. Only when the generated heterogeneous application source code is inconsistent with the application source code of other online executors can subsequent steps be performed, further ensuring the heterogeneity of the source code between different executors.
[0086] Example 4
[0087] This embodiment provides a mimicry application system, such as Figure 3 As shown, the system includes an adjudicator, a scheduler, several execution units, and the dynamic heterogeneous device for mimicry application business code as described in Embodiment 2. Each execution unit is also connected to a corresponding dynamic heterogeneous device for mimicry application business code, used to load the application generated by the dynamic heterogeneous device for mimicry application business code. In the initial state, different execution units each have heterogeneous application source code in their own languages. The adjudicator is connected to several execution units and is used to adjudicate on several execution units. The scheduler is connected to the adjudicator and the dynamic heterogeneous device for mimicry application business code, and is used to notify the corresponding dynamic heterogeneous device for mimicry application business code to generate a new application based on the abnormal execution unit adjudicated by the adjudicator, and send it to the abnormal execution unit.
[0088] Since different executors correspond to different dynamic heterogeneous devices for mimicry application business code, and different executors have heterogeneous application source code built into different languages, the heterogeneity of applications built into different executors can be achieved through different dynamic heterogeneous devices for mimicry application business code.
[0089] In practice, after the heterogeneous function library is built in each mimicry application business code dynamic heterogeneous device, for each application source code in the heterogeneous function library, the code similarity between it and each application source code in other mimicry application business code dynamic heterogeneous devices is calculated, and an application source code similarity table is generated.
[0090] When the scheduler notifies the corresponding mimicry application business code dynamic heterogeneous device to generate a new application based on the abnormal execution body decided by the arbiter, the mimicry application business code dynamic heterogeneous device obtains the last production record of other mimicry application business code dynamic heterogeneous devices.
[0091] After generating heterogeneous application source code, the dynamic heterogeneous device for mimicry application business code searches the application source code similarity table to determine whether the similarity between the heterogeneous application source code and the application source code in the last production record of other dynamic heterogeneous application generation devices is lower than a preset threshold. If it is lower, it searches the historical production records to determine whether the heterogeneous application source code has existed before; otherwise, it re-executes the heterogeneous application source code generation step.
[0092] It is understandable that by using a source code similarity table, it is ensured that only heterogeneous application source codes whose similarity to the current application source code of other heterogeneous application dynamic generation devices is lower than a preset threshold can continue to the subsequent application generation steps. In other words, the linkage of the mimicry application business code dynamic heterogeneous device further ensures the heterogeneity of applications of different executors.
[0093] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them; although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications can still be made to the specific implementation of the present invention or equivalent substitutions can be made to some technical features without departing from the spirit of the technical solutions of the present invention, and all such modifications and substitutions should be covered within the scope of the technical solutions claimed in the present invention.
Claims
1. A method for dynamic heterogeneity of mimicry application business code, characterized in that, Includes the following steps: Upon receiving a request, at least one function is randomly selected from the heterogeneous function library to heterogeneously process the initial application source code, generating heterogeneous application source code. The heterogeneous function library includes multiple sets of functions that make up the application source code, and each set of functions includes multiple functions with the same functionality but different internal implementation logic. The system searches the historical production record database for a production record containing the heterogeneous application source code. If no such record exists, it randomly selects a compiler from the heterogeneous compiler library to compile the heterogeneous application source code, generating an executable application. The heterogeneous application source code and the compiler version are then saved as the application's production record in the historical production record database. The heterogeneous compiler library contains different versions of the same compiler. Otherwise, further search in all production records containing heterogeneous application source code to see if all the compiler versions pre-installed in the heterogeneous compiler library exist. If they exist, return to execute the heterogeneous application source code generation step. If they do not exist, randomly select a compiler version from the compiler versions not included in the corresponding production record to compile the heterogeneous application source code, generate an executable application, and save the heterogeneous application source code and compiler version as the production record of the application to the historical production record library. When randomly selecting a compiler from the heterogeneous compiler library to compile the heterogeneous application source code, it is determined whether there are any functions with added marking information in the heterogeneous application source code. If so, the compiler version in the heterogeneous compiler library that is not included in the marking information is used as a candidate compiler version, and a compiler is randomly selected from the candidate compiler versions to compile the heterogeneous application source code; otherwise, all compiler versions in the heterogeneous compiler library are directly used as candidate compiler versions, and a compiler is randomly selected from the candidate compiler versions to compile the heterogeneous application source code. When further searching for the existence of all pre-installed compiler versions in the heterogeneous compiler library in all production records containing heterogeneous application source code, first determine whether there are function functions with added marking information in the heterogeneous application source code. If not, further search for the existence of all pre-installed compiler versions in the heterogeneous compiler library in the corresponding production records. If all compiler versions are found, return to execute the heterogeneous application source code generation step. If not all compiler versions are found, use the compiler versions in the heterogeneous compiler library that are not found in the production records as candidate compiler versions, and randomly select a compiler version from the candidate compiler versions to compile the heterogeneous application source code. Otherwise, further search the corresponding production records to see if there are any compiler versions other than those in the tag information. If all compiler versions other than those in the tag information are found, return to the heterogeneous application source code generation step; if no compiler versions other than those in the tag information are found, use the compiler version in the heterogeneous compiler library that is neither included in the tag information nor found in the production records as a candidate compiler version, and randomly select a compiler version from the candidate compiler versions to compile the heterogeneous application source code. The marking information includes compiler versions that failed to compile. When building a heterogeneous function library, each time a function is designed, it is compiled once using all compiler versions in the heterogeneous compiler library. If the function can be successfully compiled by all compiler versions, no marking is required; if the function cannot be successfully compiled by individual compiler versions, the marking information is added to the function; otherwise, the function is redesigned.
2. The method for dynamic heterogeneity of mimicry application business code according to claim 1, characterized in that: The historical production record database is initialized at preset time intervals, and the process of generating heterogeneous application source code is returned. If, within a preset time interval, all heterogeneous application source codes obtained consecutively N times have corresponding production records in the historical production record library, and each heterogeneous application source code's corresponding production record contains all the compiler versions pre-set in the heterogeneous compiler library, then the historical production record library is directly initialized, and the heterogeneous application source code generation step is returned to be executed, where N is the preset number of times.
3. The method for dynamic heterogeneity of mimicry application business code according to claim 1, characterized in that: When randomly selecting a compiler version from the candidate compiler versions to compile the heterogeneous application source code, the total compilation time of each candidate compiler version for the heterogeneous application source code is obtained based on the compilation schedule of all functional functions in the heterogeneous application source code. The candidate compiler version with the shortest total compilation time is selected to compile the heterogeneous application source code. The compilation timeline for each function includes the compiler version and compilation time. The total compilation time for each alternative compiler version of the heterogeneous application source code is equal to the sum of the compilation times for each function of each alternative compiler version. When building the heterogeneous function library, for each designed function, it is compiled once using all compiler versions in the heterogeneous compiler library, and the compilation time of each compiler version when the function is successfully compiled is recorded; a compilation timetable for the function is established based on the compilation time of the function for different compiler versions.
4. A dynamic heterogeneous device for mimicry application business code, characterized in that: include Heterogeneous function library, which includes multiple sets of functional functions that make up the application source code. Each set of functional functions includes multiple functional functions that have the same functionality but different internal implementation logic. The heterogeneous compiler library comes pre-loaded with different versions of the same compiler. Each version of the compiler is used to compile the source code of heterogeneous applications, generate executable applications, and save the production records of the applications to the historical production record library. A historical production record library is used to store the production records of each application, including heterogeneous application source code and compiler version; Heterogeneous application source code generator is used to randomly select at least one function from the heterogeneous function library to heterogeneously process the initial application source code after receiving a request, and generate heterogeneous application source code. And when the generated heterogeneous application source code has a corresponding production record in the historical production record library, and the corresponding production record contains all compiler versions, randomly select at least one function from the heterogeneous function library to heterogeneously process the initial application source code and generate heterogeneous application source code. The compiler version selector is used to randomly select a compiler version from the heterogeneous compiler library to compile the heterogeneous application source code when no production record containing the heterogeneous application source code exists in the historical production record library. And, when there is a production record containing heterogeneous application source code in the historical production record library, and the corresponding production record does not contain all the compiler versions, a compiler version not included in the corresponding production record is randomly selected to compile the heterogeneous application source code. When the compiler version selector randomly selects a compiler version from the heterogeneous compiler library to compile the heterogeneous application source code, it first determines whether there are any function functions with added marking information in the heterogeneous application source code. If so, the compiler version in the heterogeneous compiler library that is not included in the marking information is used as a candidate compiler version, and a compiler version is randomly selected from the candidate compiler versions to compile the heterogeneous application source code; otherwise, all compiler versions in the heterogeneous compiler library are directly used as candidate compiler versions, and a compiler version is randomly selected from the candidate compiler versions to compile the heterogeneous application source code. Before randomly selecting a compiler version from those not included in the corresponding production record to compile the heterogeneous application source code, the compiler version selector first determines whether there are any functions with added marking information in the heterogeneous application source code. If not, it further searches in the corresponding production record to see if all the compiler versions pre-installed in the heterogeneous compiler library exist. If all compiler versions are found, it returns to the heterogeneous application source code generation step. If not all compiler versions are found, the compiler version in the heterogeneous compiler library that is not found in the production record is used as a candidate compiler version, and a compiler version is randomly selected from the candidate compiler versions to compile the heterogeneous application source code. Otherwise, further search the corresponding production records to see if there are any compiler versions other than those in the tag information. If all compiler versions other than those in the tag information are found, return to the heterogeneous application source code generation step; if no compiler versions other than those in the tag information are found, use the compiler version in the heterogeneous compiler library that is neither included in the tag information nor found in the production records as a candidate compiler version, and randomly select a compiler version from the candidate compiler versions to compile the heterogeneous application source code. The marking information includes compiler versions that failed to compile. When building a heterogeneous function library, each time a function is designed, it is compiled once using all compiler versions in the heterogeneous compiler library. If the function can be successfully compiled by all compiler versions, no marking is required; if the function cannot be successfully compiled by individual compiler versions, the marking information is added to the function; otherwise, the function is redesigned.
5. The dynamic heterogeneous device for mimicry application business code according to claim 4, characterized in that: When the compiler version selector randomly selects a compiler version from the candidate compiler versions to compile the heterogeneous application source code, it obtains the total compilation time of each candidate compiler version for the heterogeneous application source code based on the compilation schedule of all functional functions in the heterogeneous application source code, and selects the candidate compiler version with the shortest total compilation time to compile the heterogeneous application source code. The compilation timeline for each function includes the compiler version and compilation time. The total compilation time for each alternative compiler version of the heterogeneous application source code is equal to the sum of the compilation times for each function of each alternative compiler version. The steps for constructing the compilation schedule for each function are as follows: When constructing the heterogeneous function library, for each function designed, all compiler versions in the heterogeneous compiler library are used for compilation once, and the compilation time when the function is successfully compiled by each compiler version is recorded. The compilation schedule for the function is established based on the compilation time of the function by different compiler versions.
6. A dynamic heterogeneous system for mimicry application business code, characterized in that: It includes an adjudicator, a scheduler, several executors, and the mimicry application business code dynamic heterogeneous device as described in claim 4 or 5. The several executors are each connected to a mimicry application business code dynamic heterogeneous device and are used to load the application generated by the mimicry application business code dynamic heterogeneous device. In the initial state, the several executors share a single heterogeneous application source code. The arbitrator is connected to several execution entities and is used to make decisions on the several execution entities; The scheduler is connected to the arbiter and the mimicry application business code dynamic heterogeneous device respectively, and is used to notify the mimicry application business code dynamic heterogeneous device to generate a new application and send it to the abnormal execution body adjudicated by the arbiter; After generating heterogeneous application source code, the dynamic heterogeneous device for mimicry application business code determines whether the heterogeneous application source code is consistent with the current application source code corresponding to the normal executor. If they are consistent, the heterogeneous application source code is regenerated. If there is a discrepancy, continue with the step of ensuring that the generated heterogeneous application source code has a corresponding production record in the historical production record database. The steps for obtaining the current application source code corresponding to the normal executor are as follows: The mimicry application business code dynamic heterogeneous device obtains the current application of the normal executor based on the built-in sending records, and searches for the corresponding production records to obtain the current application source code corresponding to each normal executor.
7. A dynamic heterogeneous system for mimicry application business code, characterized in that: The system includes an adjudicator, a scheduler, several executors, and the dynamic heterogeneous device for mimicking application business code as described in claim 4 or 5. Each executor is also connected to a corresponding dynamic heterogeneous device for mimicking application business code, used to load the application generated by the dynamic heterogeneous device for mimicking application business code. In the initial state, different executors each have heterogeneous application source code in a different language built-in. The adjudicator is connected to several executors and is used to adjudicate on several executors. The scheduler is connected to the adjudicator and the dynamic heterogeneous device for mimicking application business code, and is used to notify the corresponding dynamic heterogeneous device for mimicking application business code to generate a new application based on the abnormal executor adjudicated by the adjudicator, and send it to the abnormal executor.
8. The dynamic heterogeneous system for mimicry application business code according to claim 7, characterized in that: After the heterogeneous function library is built in each mimicry application business code dynamic heterogeneous device, for each application source code in the heterogeneous function library, the code similarity between it and each application source code in other mimicry application business code dynamic heterogeneous devices is calculated, and an application source code similarity table is generated. When the scheduler notifies the corresponding mimicry application business code dynamic heterogeneous device to generate a new application based on the abnormal execution body decided by the arbiter, the mimicry application business code dynamic heterogeneous device obtains the last production record of other mimicry application business code dynamic heterogeneous devices. After generating heterogeneous application source code, the dynamic heterogeneous device for mimicry application business code searches the application source code similarity table to determine whether the similarity between the heterogeneous application source code and the application source code in the last production record of other dynamic heterogeneous application generation devices is lower than a preset threshold. If it is lower, it searches the historical production records to determine whether the heterogeneous application source code has existed before; otherwise, it re-executes the heterogeneous application source code generation step.
Citation Information
Patent Citations
Mimetic defense-based network function deploying method in software defined network
CN109587168A
Multi-variant user program compiling method based on multi-heterogeneous executive controller
CN112363710A