Code obfuscation method and apparatus
By generating and managing secondary function symbols and indicator information, the linking error problem caused by obfuscation of function symbols in static and dynamic link libraries in the prior art is solved, achieving efficient obfuscation of code files and ensuring the correctness of compilation and execution.
Patent Information
- Application Number
- CN202111397996.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-23
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2041-11-23
AI Technical Summary
Existing technologies, when obfuscating application code, struggle to efficiently obfuscate other function symbols in the code file while avoiding obfuscation of function symbols in static and dynamic link libraries, leading to linking errors or execution failures.
By obtaining the second function symbol and indication information generated by the function name generation component, it is determined whether the code file depends on the target function. Code obfuscation is only performed when the target function is included in the dependent code file. The local symbol cache table and the remote symbol cache table are used to manage function symbols to avoid obfuscating function symbols in static and dynamic link libraries.
It achieves efficient code obfuscation of function symbols in code files without affecting the functionality of static and dynamic link libraries, ensuring correct compilation and execution.
Smart Images

Figure CN114090966B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] One or more embodiments of the present specification relate to the field of computers, and in particular, to a code obfuscation method and device. BACKGROUND
[0002] Security protection of an application is one of the key research contents in the field of computer security. In order to avoid intruders from using various static analysis tools to disassemble or decompile the executable file of the application, thereby obtaining the execution logic of the application to illegally steal relevant information, it is necessary to implement code obfuscation on the code file of the application. SUMMARY
[0003] A code obfuscation method and device are provided in one or more embodiments of the present specification.
[0004] In a first aspect, a code obfuscation method is provided, comprising: obtaining, for a first function symbol in a first code file currently to be subjected to code obfuscation, a second function symbol and indication information generated by a function name generation component for the first function symbol, wherein the indication information is used to indicate whether a target function identified by the first function symbol is contained in the first code file; when the target function is not contained in the first code file, determining whether the target function is contained in a second code file depended by the first code file according to the second function symbol; and when the target function is contained in the second code file, performing code obfuscation on the first function symbol.
[0005] In a possible implementation, the method further comprises: when the target function is contained in the first code file, performing code obfuscation on the first function symbol.
[0006] In a possible implementation, the method further comprises: when the target function is contained in the first code file, adding the second function symbol to a local symbol cache table maintained by a compiler for a first compilable unit, the first code file belonging to the first compilable unit.
[0007] In a possible implementation, the method further comprises: when the target function is contained in the first code file, sending the second function symbol to a package manager through inter-process communication, so that the package manager adds the second function symbol to a remote symbol cache table maintained by the package manager for a first project, wherein a compilable unit to which the first code file belongs is contained in the first project.
[0008] In a possible implementation, the determining whether the target function is contained in the second code file relied by the first code file according to the second function symbol comprises: determining whether the second function symbol is contained in a local symbol cache table maintained by a compiler for a first compilable unit, wherein the first code file belongs to the first compilable unit.
[0009] In a possible implementation, the determining whether the target function is contained in the second code file relied by the first code file according to the second function symbol further comprises: when the second function symbol is not contained in the local symbol cache table, sending a query request containing the second function symbol to a package manager through inter-process communication, and causing the package manager to return a query result through inter-process communication, wherein the query result is used to indicate whether the second function symbol is contained in a remote symbol cache table maintained by the package manager for a first project, and a compilable unit to which the first code file belongs is contained in the first project.
[0010] In a possible implementation, the code obfuscating the first function symbol comprises: calculating a digest value of the second function symbol, and replacing the first function symbol in the first code file with the digest value.
[0011] In a second aspect, a code obfuscating apparatus is provided, comprising: a listening processing unit configured to, for a first function symbol in a first code file currently to be subjected to code obfuscation, acquire a second function symbol and indication information generated by a function name generation component for the first function symbol, wherein the indication information is used to indicate whether a target function identified by the first function symbol is contained in the first code file; a determining unit configured to, when the target function is not contained in the first code file, determine whether the target function is contained in a second code file relied by the first code file according to the second function symbol; and an obfuscating processing unit configured to, when the target function is contained in the second code file, obfuscate the first function symbol.
[0012] In a possible implementation, the obfuscating processing unit is further configured to, when the target function is contained in the first code file, obfuscate the first function symbol.
[0013] In a possible implementation, the apparatus further comprises: a storage management unit configured to, when the target function is contained in the first code file, add the second function symbol to a local symbol cache table maintained by a compiler for a first compilable unit, wherein the first code file belongs to the first compilable unit.
[0014] In a possible implementation, the apparatus further includes a communication management unit, configured to send the second function symbol to a package manager through inter-process communication when the first code file contains the target function, so that the package manager adds the second function symbol to a remote symbol cache table maintained by the package manager for a first project, wherein the first code file belongs to a compilable unit included in the first project.
[0015] In a possible implementation, the determination unit is configured to determine whether the second function symbol is included in a local symbol cache table maintained by a compiler for a first compilable unit, wherein the first code file belongs to the first compilable unit.
[0016] In a possible implementation, the determination unit is configured to send a query request containing the second function symbol to a package manager through inter-process communication when the second function symbol is not included in the local symbol cache table, so that the package manager returns a query result through inter-process communication, wherein the query result is used to indicate whether the second function symbol is included in a remote symbol cache table maintained by the package manager for a first project, wherein the first code file belongs to a compilable unit included in the first project.
[0017] In a possible implementation, the obfuscation processing unit is specifically configured to calculate a digest value of the second function symbol, and replace the first function symbol in the first code file with the digest value.
[0018] In a third aspect, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program / instruction. When the computer program / instruction is executed in a computing device, the computing device performs the method according to any one of the first aspect.
[0019] In a fourth aspect, a computing device is provided, and the computing device includes a memory and a processor. The memory stores a computer program / instruction, and the processor executes the computer program / instruction to implement the method according to any one of the first aspect.
[0020] By the method and apparatus provided in one or more embodiments of the present specification, other function symbols in a code file can be obfuscated more efficiently without obfuscating function symbols related to static link libraries and dynamic link libraries. BRIEF DESCRIPTION OF DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present specification, the drawings needed in the embodiment description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present specification, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0022] Figure 1 The schematic diagram of the technical scene to which the technical solutions provided in the embodiments of the present specification are applicable;
[0023] Figure 2 The flowchart of the code obfuscation method provided in the embodiments of the present specification;
[0024] Figure 3 The flowchart of another code obfuscation method provided in the embodiments of the present specification;
[0025] Figure 4 The schematic diagram of a code obfuscation device provided in the embodiments of the present specification. DETAILED DESCRIPTION
[0026] The various non-limiting embodiments provided by the present specification will be described in detail below with reference to the drawings.
[0027] Code obfuscation (obfuscated code) is the behavior of converting the code of a computer program into a form that is functionally equivalent but more difficult to read and understand. Among them, the code obfuscation of the function symbol (i.e. function name) in the code file is a typical code obfuscation scheme. By rewriting the function symbol in the code file into a symbol that is difficult for an intruder to understand, the intruder can not correctly understand the real purpose of the corresponding function based on the function symbol. However, the function symbol in the code file may involve a static link library or a dynamic link library provided by the outside world, i.e. the function symbol in the code file may be the identification of the function in the static link library or the dynamic link library; if the function symbol involving the static link library or the dynamic link library is obfuscated, it may cause the project to be unable to accurately link to the static link library or the dynamic link.
[0028] Take the source code written in Rust programming language as an example. Please refer to Figure 1Crate A includes code file 1, and code file 1 includes function A1 written in Rust programming language; Crate A is compiled by a compiler to generate executable file / library A, and executable file / library A includes the implementation of function A1. Crate B includes code file 2 and code file 3, code file 2 includes function B1 written in Rust programming language, and code file 3 includes function B2 written in Rust programming language. In addition, it is assumed that function B2 needs to call function B1, function A1, function C1 in static link library C, and function D1 in dynamic link library D. Crate B is compiled by a compiler to generate executable file / library B, and executable file / library B includes the implementation of function B2, function B1, function C1, and function A1. It needs to be particularly pointed out that for code file 3, if the function symbols of function C1 and / or function D1 are code obfuscated in the code file, the compiler may not be able to accurately link static link library C during the compilation of Crate B, and in addition, executable file B may not be able to accurately link dynamic link library D during its execution.
[0029] The embodiments of the present specification at least provide a code obfuscation method and device, which can more efficiently implement code obfuscation on other function symbols in a code file while avoiding code obfuscation on function symbols related to static link libraries and dynamic link libraries.
[0030] The technical solutions provided in the embodiments of the present specification will be described in detail below in combination with the technical scenarios shown in the accompanying drawings. Figure 1 The technical solutions provided in the embodiments of the present specification will be described in detail below in combination with the technical scenarios shown in the accompanying drawings.
[0031] Figure 2 A flowchart of a code obfuscation method provided in the embodiments of the present specification. The method can be executed by any device, equipment or equipment cluster with computing and data processing capabilities, such as a server, a computer, a mobile phone, a tablet computer, a wearable device, a network device, a terminal device, a server cluster, a computer cluster, a mobile phone cluster, a tablet computer cluster, a wearable device cluster, a network device cluster, a terminal device cluster, or the like, as shown in Figure 2 The method can at least include the following steps 201 to 207.
[0032] First, in step 201, for a first function symbol in a first code file to be code obfuscated, a second function symbol and indication information generated by a function name generation component for the first function symbol are obtained.
[0033] The indication information can indicate whether the first code file includes a target function identified by the first function symbol. Therefore, based on the indication information, step 203 can be executed to determine whether the first code file includes the target function identified by the first function symbol according to the indication information.
[0034] Taking the compiler of Rust programming language as an example, the compiler can include a mangle component as a function name generation component. The mangle component can be specifically used for pre-processing of the code file in the process of compiling the code file using the compiler, completing the generation of the indication information corresponding to the function symbol in the code file and the new function symbol.
[0035] Please continue to refer to Figure 1 , Crate A, Crate B and static library C are all included in the project ZN created by the package manager Cargo; function B1, function A1, function C1 and function D1 need to be called in function B2, and the function symbol of function A1, the function symbol of function B1, the function symbol of function B2, the function symbol of function C1 and the function symbol of function D1 are included in code file 3. When compiling Crate B using the compiler through Cargo, the compiler will compile code file 2 and code file 3 in turn; for example, when the compiler is currently compiling code file 3, the mangle component can generate a new function symbol and indication information for each function symbol in code file 3, and at this time, code file 3 is the first code file to be code obfuscated.
[0036] For each first function symbol in the first code file, the mangle component can generate a second function symbol corresponding to the first function symbol, for example, by adding a prefix to the first function symbol or other ways. For example, when code file 3 is taken as the first code file to be code obfuscated, the mangle component can generate the output function symbol "ZN_B_B1" and the indication information "nonlocal" corresponding to the function symbol "B1" of function B1; the output function symbol "ZN_B_B2" and the indication information "local" corresponding to the function symbol "B2" of function B2; the output function symbol "ZN_A_A1" and the indication information "nonlocal" corresponding to the function symbol "A1" of function A1; the output function symbol "ZN_C_C1" and the indication information "nonlocal" corresponding to the function symbol "C_C1" of function C1. It can be understood that the indication information "local" can be used to indicate that the target function is included in the first code file, and the indication information "nonlocal" can be used to indicate that the target function is not included in the first code file.
[0037] Then, when the first code file does not include the target function, step 205 is performed to determine whether the target function is included in the second code file dependent on the first code file according to the second function symbol.
[0038] Then, when the second code file contains the target function, the step 207 is performed to code obfuscate the first function symbol in the first code file. It can be understood that when the second code file does not contain the target function, the first function symbol in the first code file does not need to be code obfuscated.
[0039] In a possible implementation, the compiler can maintain a local symbol cache table for the currently processed compilable unit; wherein for each code file belonging to the compilable unit, after the second function symbol corresponding to the function symbol of each function contained in the code file is generated by the function name generation component, the second function symbol can be stored in the local symbol cache table. In other words, referring to Figure 3 When the first code file contains the target function, the aforementioned step 207 can be directly performed, and in addition, the method can further include a step 301 of adding the second function symbol to a local symbol cache table maintained by the compiler for a first compilable unit, wherein the first code file belongs to the first compilable unit. For example, when the first code file is the code file 2, the mangle component correspondingly generates the indication information "local" for the function symbol "B1", and the indication information "local" is used to indicate that the code file 2 contains the target function identified by the function symbol "B1", at this time, the function symbol "ZN_B_B1" can be added to the local symbol cache table maintained by the compiler for Crate B based on the indication information "local".
[0040] Correspondingly, the aforementioned step 205 can specifically include a step 2051 of determining whether the second function symbol is included in a local symbol cache table maintained by the compiler for a first compilable unit, wherein the first code file belongs to the first compilable unit. When the second function symbol is included in the local symbol cache table maintained by the compiler for the first compilable unit, it indicates that the second code file relied on by the first code file contains the target function, and the aforementioned step 207 can be directly performed.
[0041] Please continue to refer to Figure 1For the compilable unit Crate B in the project ZN, since function B2 calls function Bl, i.e. code file 3 depends on code file 2. When compiling Crate B through the compiler, code file 2 and code file 3 need to be compiled in sequence; since the implementation of code obfuscation on code files depends on the preprocessing of the function name generation component in the compiler on the code files, the code obfuscation on code file 2 and code file 3 is essentially code obfuscation on code file 2 and code file 3 in sequence. It can be found that if the first code file to be obfuscated is code file 3, since code file 2 and code file 3 both belong to Crate B, it can be known from the description of step 301 above that the function symbol "ZN_B_B1" corresponding to the function symbol "Bl" has been added to the local symbol cache maintained by the compiler for Crate B when code obfuscation is implemented on code file 2; for the function symbol "ZN_B_B1" as the second function symbol at this time, it can be found that the function symbol "ZN_B_B1" has been stored in the local symbol cache table maintained by the compiler for Crate B, and accordingly it can be known that function Bl must be a function in a code file depended by code file 3, i.e. it is determined that the target function identified by the function symbol "Bl" is contained in the second code file depended by code file 3. In other words, the foregoing step 207 can include code obfuscation on the first function symbol when the second function symbol is contained in the local symbol cache table.
[0042] In a possible implementation, the package manager can maintain a remote symbol cache table for a project created by the package manager, the project can include one or more compilable units, and a single compilable unit can include one or more code files; for each code file belonging to the project, after the second function symbol corresponding to the function symbol of each function contained in the code file is generated by the function name generation component, the second function symbol can be stored in the remote symbol cache table. In other words, please continue to refer to Figure 3 When the first code file contains the target function, the method can further include step 303 of sending the second function symbol to the package manager through inter-process communication, so that the package manager adds the second function symbol to the remote symbol cache table maintained by the package manager for the first project, wherein the compilable unit to which the first code file belongs is contained in the first project. For example, when the first code file is code file 1, the mangle component generates the function symbol "ZN_A_A1" and the indication information "local" corresponding to the function symbol "Al", and the indication information "local" is used to indicate that code file 1 contains the target function identified by the function symbol "Al"; at this time, the function symbol "ZN_A_A1" can be added to the remote symbol cache table maintained by the compiler for the project ZN based on the indication information "local".
[0043] Correspondingly, when the second function symbol is not included in the local symbol cache table, the foregoing step 205 can further include 2053, sending a query request containing the second function symbol to the package manager through inter-process communication, so that the package manager returns a query result through inter-process communication, and the query result is used to indicate whether the second function symbol is included in the remote symbol cache table maintained by the package manager for the first project. The compilable unit to which the first code file belongs is included in the first project. In other words, it can be determined in step 2053 whether the second function symbol is included in the foregoing remote symbol table. When the second function symbol is included in the remote symbol cache table, it indicates that the target function included in the second code file dependent by the first code file, and the foregoing step 207 can be directly executed.
[0044] Please continue to refer to Figure 1 For the project ZN, since function B2 needs to call function A1, that is, code file 3 depends on code file 1; before compiling Crate B through the compiler, code file 1 needs to be compiled through the compiler; wherein since the code obfuscation implemented on the code file depends on the preprocessing of the code file by the function name generation component in the compiler, in terms of the order of code obfuscation on code file 1 and code file 3, code file 1 will be obfuscated first, and then code file 3 will be obfuscated. It is not difficult to find that if the first code file to be obfuscated at present is code file 3, since code file 1 and code file 3 belong to different compilable units, referring to the related description of steps 301 and 303 above, the function symbol "ZN_A_A1" corresponding to the function symbol "A1" has been added to the remote symbol cache table maintained by the package manager for the project ZN. The local symbol cache table maintained by the compiler for Crate B does not store the function symbol "ZN_A_A1". When the mangle component generates the function symbol "ZN_A_A1" and the indication information "nonlocal" for the function symbol "A1" in code file 3, for the function symbol "ZN_A_A1" as the second function symbol at this time, it can be found that the function symbol "ZN_A_A1" has been stored in the remote symbol cache table maintained by cargo for the project ZN. Accordingly, it can be known that function A1 is necessarily a function in a code file dependent by code file 3, that is, it is determined that the second code file dependent by code file 3 contains the target function identified by the function symbol "A1".
[0045] Correspondingly, if the second function symbol generated by the mangle component is not queried in the foregoing local symbol cache table and remote symbol cache table, it indicates that the target function identified by the first function symbol is not contained in each second code file dependent on the first code file, and the target function identified by the first function symbol can belong to a static link library or a dynamic link library. At this time, the first function symbol does not need to be obfuscated.
[0046] In a possible implementation, when the target function is contained in the second code file, a digest value of the second function symbol or a corresponding first function symbol can be specifically calculated, and the digest value is used to replace the corresponding first function symbol in the first code file, so as to complete code obfuscation of the first function symbol in the first code file.
[0047] In a possible implementation, after the function symbol in the first code file is obfuscated by the method provided in each embodiment, the compiler can continue to compile the first code file after code obfuscation.
[0048] It should be noted that in each of the foregoing embodiments, the second function symbol is described as being added to the local symbol cache table and / or the remote symbol cache table in a specific case. In actual business scenarios, the first function symbol corresponding to the second function symbol can also be added to the local symbol cache table and / or the remote symbol cache table. Correspondingly, whether the first function symbol is obfuscated needs to be decided based on the corresponding first function symbol and the local symbol cache table and / or the remote symbol cache table.
[0049] Based on the same concept as the foregoing method embodiments, the present specification embodiments also provide a code obfuscation apparatus. As shown in the Figure 4 The code obfuscation apparatus can include: a listening processing unit 401 configured to, for a first function symbol in a first code file currently to be obfuscated, acquire a second function symbol and indication information generated by a function name generation component for the first function symbol, wherein the indication information is used to indicate whether a target function identified by the first function symbol is contained in the first code file; a determination unit 403 configured to, when the target function is not contained in the first code file, determine whether the target function is contained in a second code file dependent on the first code file according to the second function symbol; and an obfuscation processing unit 405 configured to, when the target function is contained in the second code file, obfuscate the first function symbol.
[0050] In a possible implementation, the obfuscation processing unit 405 is further configured to, when the target function is contained in the first code file, obfuscate the first function symbol.
[0051] In a possible implementation, the apparatus further includes a storage management unit, configured to add the second function symbol to a local symbol cache table maintained by a compiler for a first compilable unit when the target function is contained in the first code file, the first code file belonging to the first compilable unit.
[0052] In a possible implementation, the apparatus further includes a communication management unit, configured to send the second function symbol to a package manager through inter-process communication to make the package manager add the second function symbol to a remote symbol cache table maintained by the package manager for a first project when the target function is contained in the first code file, the compilable unit to which the first code file belongs being contained in the first project.
[0053] In a possible implementation, the determination unit 403 is specifically configured to determine whether the second function symbol is included in a local symbol cache table maintained by a compiler for a first compilable unit, the first code file belonging to the first compilable unit.
[0054] In a possible implementation, the determination unit 403 is specifically configured to send a query request containing the second function symbol to a package manager through inter-process communication to make the package manager return a query result through inter-process communication when the second function symbol is not included in the local symbol cache table, the query result being used to indicate whether the second function symbol is included in a remote symbol cache table maintained by the package manager for a first project, the compilable unit to which the first code file belongs being contained in the first project.
[0055] In a possible implementation, the obfuscation processing unit 405 is specifically configured to calculate a digest value of the second function symbol, and replace the first function symbol in the first code file with the digest value.
[0056] Those skilled in the art can realize that, in one or more examples described above, the functions described in the specification can be implemented by hardware, software, firmware or any combination thereof. When implemented by software, the computer program corresponding to the functions can be stored in a computer readable medium or transmitted as one or more instructions / code on a computer readable medium, so that the computer program corresponding to the functions is executed by a computer to implement the method described in any one of the embodiments of the specification.
[0057] The computer readable storage medium provided in the embodiments of the specification has computer programs / instructions stored thereon, and when the computer programs / instructions are executed in a computing device, the computing device executes the code obfuscation method provided in any one of the embodiments of the specification.
[0058] The embodiment of the present specification also provides a computing device, comprising a memory and a processor, the memory stores executable code, and the processor executes the executable code to implement the code obfuscation method provided in any one of the embodiments of the present specification.
[0059] Each of the embodiments in the present specification is described in a progressive manner, and the same and similar parts in each of the embodiments can be referred to each other. In each of the embodiments, the difference from other embodiments is mainly described. In particular, for the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiments.
[0060] The above describes specific embodiments of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different than the order in which the actions or steps are recited in the embodiments and still achieve the desired result. In addition, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order, to achieve the desired results. In some implementations, multitasking and parallel processing can be advantageous or possible.
[0061] The above specific embodiments further explain the purpose, technical solutions and beneficial effects of the present application. It should be understood that the above description is only a specific embodiment of the present application and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made on the basis of the technical solutions of the present application shall be included in the protection scope of the present application.
Claims
1. A code obfuscation method, comprising: obtaining, for a first function symbol in a first code file currently to be subjected to code obfuscation, a second function symbol and indication information generated by a function name generation component for the first function symbol, wherein the indication information is used to indicate whether a target function identified by the first function symbol is contained in the first code file; when the target function is contained in the first code file, adding the second function symbol to a local symbol cache table maintained by a compiler for a first compilable unit to which the first code file belongs; when the target function is not contained in the first code file, determining whether the target function is contained in a second code file depended by the first code file according to the second function symbol; when the target function is contained in the second code file, code obfuscating the first function symbol.
2. The method of claim 1, further comprising: when the target function is contained in the first code file, code obfuscating the first function symbol.
3. The method of claim 1, further comprising: when the target function is contained in the first code file, sending the second function symbol to a package manager through inter-process communication, so that the package manager adds the second function symbol to a remote symbol cache table maintained by the package manager for a first project to which a compilable unit to which the first code file belongs is contained.
4. The method of claim 1, wherein, The determining whether the target function is contained in the second code file depended by the first code file according to the second function symbol comprises: determining whether the second function symbol is included in a local symbol cache table maintained by a compiler for a first compilable unit to which the first code file belongs.
5. The method of claim 4, wherein, The determining whether the target function is contained in the second code file depended by the first code file according to the second function symbol further comprises: when the second function symbol is not included in the local symbol cache table, sending a query request containing the second function symbol to a package manager through inter-process communication, so that the package manager returns a query result through inter-process communication, wherein the query result is used to indicate whether the second function symbol is included in a remote symbol cache table maintained by the package manager for a first project to which a compilable unit to which the first code file belongs is contained.
6. The method of any one of claims 1-5, wherein, The code obfuscating the first function symbol comprises: calculating a digest value of the second function symbol, and replacing the first function symbol in the first code file with the digest value. 7.A code obfuscation apparatus, comprising: a listening processing unit configured to obtain, for a first function symbol in a first code file currently to be subjected to code obfuscation, a second function symbol and indication information generated by a function name generation component for the first function symbol, wherein the indication information is used to indicate whether a target function identified by the first function symbol is contained in the first code file; a storage management unit, configured to add the second function symbol to a local symbol cache table maintained by a compiler for a first compilable unit when the target function is contained in the first code file, the first code file belonging to the first compilable unit; a determination unit, configured to determine whether the target function is contained in a second code file relied on by the first code file according to the second function symbol when the target function is not contained in the first code file; a confusion processing unit, configured to perform code confusion on the first function symbol when the target function is contained in the second code file.
8. The apparatus of claim 7, wherein, The confusion processing unit is further configured to perform code confusion on the first function symbol when the target function is contained in the first code file.
9. The apparatus of claim 7, wherein, The apparatus further includes a communication management unit, configured to send the second function symbol to a package manager through inter-process communication when the target function is contained in the first code file, so that the package manager adds the second function symbol to a remote symbol cache table maintained by the package manager for a first project, wherein a compilable unit to which the first code file belongs is contained in the first project.
10. The apparatus of claim 7, wherein, The determination unit is configured to determine whether the second function symbol is included in a local symbol cache table maintained by a compiler for a first compilable unit, wherein the first code file belongs to the first compilable unit.
11. The apparatus of claim 10, wherein, The determination unit is configured to send a query request containing the second function symbol to a package manager through inter-process communication when the second function symbol is not included in the local symbol cache table, so that the package manager returns a query result through inter-process communication, wherein the query result is used to indicate whether the second function symbol is included in a remote symbol cache table maintained by the package manager for a first project, wherein a compilable unit to which the first code file belongs is contained in the first project.
12. The apparatus of any one of claims 7-11, wherein, The confusion processing unit is specifically configured to calculate a digest value of the second function symbol, and replace the first function symbol in the first code file with the digest value.
13. A computer readable storage medium having stored thereon a computer program which, when executed in a computing device, causes the computing device to perform the method of any one of claims 1-6.
14. A computing device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the method of any one of claims 1-6 when executing the computer program.
Citation Information
Patent Citations
Code obfuscation method and code running method and device
CN107038354A