Resource file protection method, device, computer equipment and storage medium

By listening and intercepting the loading action of resource files during the application operation and decrypting them in the running memory, the problem of security risks after decrypting resource files in traditional technology is solved, and advanced security protection of resource files is achieved to prevent data leakage and pirated.

CN112417484BActive Publication Date: 2024-11-22JIANGSU PAYEGIS INFORMATION SECURITY TECH CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011355186.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-26
Publication Date
2024-11-22
Estimated Expiration
2040-11-26

AI Technical Summary

Technical Problem

In traditional technology, encrypted and protected resource files still have security risks after decryption, resulting in data leakage and piracy applications.

Method used

During the operation of the application, listen to the loading action of the target resource file, intercept and load it into the running memory for decryption, avoiding the generation of decrypted resource files in the local storage space, thereby ensuring that the resource file is always encrypted.

Benefits of technology

It effectively improves the security strength of resource files, prevents data leakage and the occurrence of pirated applications, and ensures the encryption status of resource files in the local storage space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112417484B_ABST
    Figure CN112417484B_ABST
Patent Text Reader

Abstract

The present application relates to a resource file protection method, device, computer equipment and storage medium. During the operation of the application, the loading action of the target resource file is monitored, and the target resource file is obtained by encrypting the resource file of the application; if the loading action is monitored, the loading action is intercepted, and the target resource file is loaded into the running memory of the application; in the running memory of the application, the target resource file is decrypted to obtain a decrypted resource file; and the decrypted resource file is read from the running memory. Avoiding the generation of decrypted resource files in the local storage space, ensuring that the resource files in the local storage space are always in an encrypted state, and improving the security strength of the resource files, thereby avoiding data leakage and the generation of pirated applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet security technology, and in particular to a resource file protection method, device, computer equipment and storage medium. Background Art

[0002] The installation package of an application includes various types of resource files. When attacked, a common attack method is to replace or tamper with the original resource files of the application, such as replacing them with advertising images, or modifying the application configuration, or even reading personal privacy information hidden in the resource files.

[0003] In traditional technology, resource files are encrypted and protected mainly through the following two technical means: one is resource file obfuscation protection, such as obfuscating the path of the resource file, shortening the folder and file name, and replacing or deleting the name of a resource file; the other is resource file encryption protection, which encrypts, hides and compresses the contents of some installation directories, and then decompresses and decrypts the resource files when used.

[0004] However, in traditional technologies, encrypted resource files still face security risks due to insufficient security strength, resulting in problems such as data leakage and pirated applications. Summary of the invention

[0005] Based on this, it is necessary to provide a resource file protection method, device, computer equipment and storage medium that can improve the security strength of resource files and avoid data leakage and pirated applications in response to the above technical problems.

[0006] A resource file protection method, the method comprising:

[0007] During the running of the application, monitoring the loading action of the target resource file, wherein the target resource file is obtained by encrypting the resource file of the application;

[0008] If the loading action is detected, the loading action is intercepted, and the target resource file is loaded into the running memory of the application program;

[0009] In the running memory of the application, decrypting the target resource file to obtain a decrypted resource file;

[0010] The decryption resource file is read from the running memory.

[0011] In one embodiment, the method for generating the target resource file includes:

[0012] Parsing the installation package of the application and extracting the resource files to be encrypted from the installation package;

[0013] The resource file to be encrypted is compressed and encrypted to obtain the target resource file.

[0014] In one of the embodiments, the number of the resource files to be encrypted is greater than one; and the compressing and encrypting the resource files to be encrypted to obtain the target resource files includes:

[0015] According to the file type of each resource file to be encrypted, determining whether each resource file to be encrypted is compressible;

[0016] If the resource file to be encrypted is compressible, compressing the resource file to be encrypted to obtain a compressed file;

[0017] If the resource file to be encrypted is incompressible, retaining the resource file to be encrypted;

[0018] The compressed file and the reserved resource file to be encrypted are merged, and the merged file is encrypted to obtain the target resource file.

[0019] In one embodiment, the method further comprises:

[0020] The extracted resource file to be encrypted is deleted from the installation package.

[0021] In one embodiment, the method further comprises:

[0022] The target resource file is stored in a specified path in the installation package of the application.

[0023] In one embodiment, parsing the installation package of the application and extracting the resource file to be encrypted from the installation package includes:

[0024] Parsing the installation package of the application to obtain the directory address of the resource file to be encrypted in the installation package;

[0025] According to the directory address, the resource file to be encrypted is extracted from the installation package.

[0026] In one embodiment, if the loading action is monitored, intercepting the loading action includes:

[0027] If the loading action is monitored, the loading action is intercepted based on the hook mechanism Hook, and the loading action includes at least one of open, read and memory mapping mmap.

[0028] A resource file protection device, the device comprising:

[0029] A monitoring module, used for monitoring the loading action of a target resource file during the running of the application, wherein the target resource file is obtained by encrypting the resource file of the application;

[0030] An interception module, configured to intercept the loading action if the loading action is monitored, and load the target resource file into the running memory of the application program;

[0031] A decryption module, used to decrypt the target resource file in the running memory of the application to obtain a decrypted resource file;

[0032] A reading module is used to read the decrypted resource file from the running memory.

[0033] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the method steps in the above embodiment when executing the computer program.

[0034] A computer-readable storage medium stores a computer program, which implements the method steps in the above embodiment when executed by a processor.

[0035] The resource file protection method, device, computer equipment and storage medium described above monitor the loading action of the target resource file during the operation of the application, and the target resource file is obtained by encrypting the resource file of the application; if the loading action is monitored, the loading action is intercepted, and the target resource file is loaded into the running memory of the application; in the running memory of the application, the target resource file is decrypted to obtain a decrypted resource file; and the decrypted resource file is read from the running memory. The generation of decrypted resource files in the local storage space is avoided, and the resource files in the local storage space are ensured to be always in an encrypted state, which improves the security strength of the resource files, thereby avoiding data leakage and the generation of pirated applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 A process environment diagram of a resource file protection method in one embodiment;

[0037] Figure 2 A schematic diagram of a process for generating a target resource file in one embodiment;

[0038] Figure 3 is a flow chart of step S210 in one embodiment;

[0039] Figure 4 is a flow chart of step S220 in another embodiment;

[0040] Figure 5 is a flowchart of a resource file protection method in another embodiment;

[0041] Figure 6 is a structural block diagram of a resource file protection device in an embodiment;

[0042] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0044] The installation package of an application includes various types of resource files, and the common attack method when it is attacked is to replace or tamper with the original resource files of the application, such as replacing them with advertising images, or modifying the application configuration, or even reading personal privacy information hidden in the resource files, etc. The technical means related to the encryption of Android resource files are used as an example to illustrate.

[0045] One is the resource file obfuscation protection mode. By obfuscating the names of resource files, the difficulty of crackers to understand these files is increased to a certain extent, thereby improving the security of resource files to a certain extent. In the development process of normal Android applications (Android APP), in order to ensure the unified standard of applications, naming standardization is generally advocated. Therefore, it is very easy to understand its meaning through the file name, which is conducive to developers to understand and maintain applications. But it also provides convenience for crackers. Crackers can easily find the location of required resource files through file names and understand the intentions of these resource files. For example, the original resource file res / layout / activity_main.xml is named res / a / a.xml. Through layout and activity_main.xml, crackers can easily know that the file may be a layout-related file, and may be the layout file of the main interface (activity). After the file name is obfuscated and becomes res / a / a.xml, it is difficult for crackers to know the role of a.xml file by name. However, after analysis, the inventor found that: 1) the resource file obfuscation protection mode only increases the reading difficulty during cracking, increases the time cost of crackers, and the security strength of this mode is limited. 2) The technical difficulty of implementation is relatively high. For example, when protecting assets resource files, the resources under the assets directory need to be obfuscated, which requires modifying the Java program code or DEX file. This is difficult and complex, and it is easy for developers to make mistakes.

[0046] One is resource file encryption protection, which encrypts and hides the resource files in the application (such as some assets resource files and some res resource files), and decrypts and restores the resource files when the application APP is running, so that the application can access the resource files normally. Since some resource files are encrypted, the real resource files cannot be seen by decompiling the application, thereby ensuring the security of the resource files. However, after analysis, the inventor found that: 1) After the encrypted files are finally decrypted by the Android system, unprotected resource files are generated in the local storage space, then the cracker can obtain the resource files of the application through the unprotected resource files in the local storage space, thereby exposing the data information and resource information of the application. 2) There are still certain security risks in the partial encryption of asset resource files.

[0047] Based on this, the present application provides a resource file protection method, during the operation of the application, by monitoring the loading action of the target resource file, the target resource file is obtained by encrypting the resource file of the application; if the loading action is monitored, the loading action is intercepted, and the target resource file is loaded into the running memory of the application; in the running memory of the application, the target resource file is decrypted to obtain a decrypted resource file; the decrypted resource file is read from the running memory (RAM). The resource file is loaded through the running memory innovatively, and the resource file is returned to the application from the running memory, ensuring that the resource file in the local storage space (storage memory ROM) is always in an encrypted state, avoiding the generation of decrypted resource files in the local storage space. It can be seen that the resource file protection method disclosed in the present application improves the security strength of the resource file, thereby avoiding data leakage and the generation of pirated applications.

[0048] In one embodiment, Figure 1 As shown, a resource file protection method is provided, the method comprising the following steps:

[0049] S110. During the running of the application program, the loading action of the target resource file is monitored.

[0050] Among them, the resource file is a file from which the required resources can be read, and the type of resource can be a picture, audio, video, text resource, or other content that can be displayed in a computer, etc. It is read by a special program interface and displayed to the user as needed in the application. The target resource file is obtained by encrypting the resource file of the application. For example, the resource file can be an assets resource file and a res resource file in an Android resource file, and the target resource file is a file obtained by encrypting the assets resource file and the res resource file. It can be understood that the method disclosed in this application is also applicable to other systems such as IOS mobile operating system, MacOS operating system, and Microsoft Windows operating system. Specifically, since in the traditional technology, an encrypted resource file is stored in the local storage memory ROM, when the resource file is called, the resource file is decrypted, and a corresponding local resource file is formed in the local storage memory ROM, and the system directly calls the local resource directory for reading or loading. At this time, the local resource file in the local storage memory ROM is in a decrypted state, which means that an attacker can read the local resource file from the local storage memory ROM, which has a great security risk. Therefore, in order to avoid generating unencrypted resource files in the storage memory ROM after the target resource files are decrypted, during the running of the application, the present application innovatively monitors the loading action of the target resource files and captures the loading action of the target resource files.

[0051] S120: If a loading action is detected, the loading action is intercepted and the target resource file is loaded into the running memory of the application.

[0052] Among them, the running memory is also called the main memory, which refers to the memory required when the program is running, and is a random access memory (RAM). Compared with the local storage memory ROM, the biggest difference between the running memory RAM and the local storage memory ROM is that the data stored on the running memory RAM will automatically disappear after power failure, while the local storage memory ROM will not. Specifically, in order to avoid the generation of unencrypted resource files in the storage memory ROM after the target resource file is decrypted, after monitoring the loading action of the target resource file, the loading action is intercepted, and the target resource file is loaded into the running memory of the application. It is creatively proposed to load the target resource file into the running memory RAM to avoid the decrypted resource file from landing in the local storage memory ROM, thereby realizing the non-landing decryption of the target resource file (that is, the decryption operation is not performed in the ROM), thereby avoiding the security risks of reading the local resource file from the local storage memory ROM.

[0053] S130. Decrypt the target resource file in the running memory of the application program to obtain a decrypted resource file.

[0054] S140: Read the decrypted resource file from the running memory.

[0055] Specifically, during the running of the application, when the target resource file needs to be called, the target resource file is loaded into the running memory RAM, and the target resource file is decrypted in the running memory RAM to form a decrypted resource file in the running memory RAM. The system reads the decrypted resource file from the running memory RAM, and the application APP can use the contents of the resource file normally.

[0056] In the resource file protection method, during the running process of the application, the target resource file is monitored by monitoring the loading action of the target resource file, and the target resource file is obtained by encrypting the resource file of the application; if the loading action is monitored, the loading action is intercepted, and the target resource file is loaded into the running memory of the application; in the running memory of the application, the target resource file is decrypted to obtain a decrypted resource file; and the decrypted resource file is read from the running memory. Avoiding the generation of decrypted resource files in the local storage space ensures that the resource files in the local storage space (storage memory ROM) are always in an encrypted state, which improves the security strength of the resource files, thereby avoiding data leakage and the generation of pirated applications.

[0057] In one embodiment, Figure 2 As shown, the method of generating the target resource file includes the following steps:

[0058] S210: Parse the installation package of the application program, and extract resource files to be encrypted from the installation package.

[0059] S220: compress and encrypt the resource file to be encrypted to obtain a target resource file.

[0060] Among them, the installation package (Install Pack) is a software installation package, which is a collection of self-decompressible files, including all the files installed by the software. For example, taking the Android system as an example, the installation package is an Android application package, that is, an APK (Android Application Package) installation package. Specifically, the resource installation directory of the application's installation package is parsed, and the resource files to be encrypted are determined to be the extracted resource files to be encrypted, and the resource files to be encrypted are extracted from the installation package. First, the resource files to be encrypted are compressed, and then encrypted to obtain the target resource files, thereby realizing the security protection of the resource files to be encrypted.

[0061] In this embodiment, the installation package of the application is parsed to extract the resource file to be encrypted from the installation package. The resource file to be encrypted is compressed and encrypted to obtain the target resource file. This can prevent attackers from obtaining the original resource file from the installation package, thereby preventing them from performing malicious acts such as repackaging.

[0062] In one embodiment, Figure 3 As shown, in step S210, the installation package of the application is parsed, and the resource files to be encrypted are extracted from the installation package, including the following steps:

[0063] S310, parsing the installation package of the application to obtain the directory address of the resource file to be encrypted in the installation package;

[0064] S320. Extract the resource files to be encrypted from the installation package according to the directory address.

[0065] Specifically, the installation directory of the application's installation package is parsed, the resource file to be encrypted is determined to be the extracted resource file to be encrypted, and the directory address of the resource file to be encrypted in the installation package is obtained, so as to extract the resource file to be encrypted from the installation package according to the directory address of the resource file to be encrypted in the installation package. For example, when the resource file to be encrypted is the content in the assets resource folder and the res resource folder, before encrypting the assets resource folder and the res resource folder, the APP installation package is analyzed to obtain the directory address of the assets resource folder and the res resource folder, and the content of the assets resource folder and the res resource folder is extracted to obtain the resource file to be encrypted.

[0066] In one embodiment, the number of resource files to be encrypted is greater than one. Figure 4 As shown, compressing and encrypting the resource file to be encrypted to obtain the target resource file includes the following steps:

[0067] S410: Determine whether each resource file to be encrypted is compressible according to the file type of each resource file to be encrypted.

[0068] S420: If the resource file to be encrypted is compressible, compress the resource file to be encrypted to obtain a compressed file.

[0069] S430: If the resource file to be encrypted is incompressible, the resource file to be encrypted is retained.

[0070] S440: Merge the compressed file and the reserved resource file to be encrypted, encrypt the merged file, and obtain the target resource file.

[0071] Specifically, after extracting the resource files to be encrypted from the installation package, the file types of the resource files to be encrypted are analyzed, and the types of the resource files to be encrypted are analyzed according to the suffix names of the resource files to be encrypted, and it is determined whether the resource files to be encrypted are compressible. If the suffix names of the resource files to be encrypted determine that the resource files to be encrypted are multimedia files, then it is determined that the resource files to be encrypted are incompressible. If the suffix names of the resource files to be encrypted determine that the resource files to be encrypted are not multimedia files, then it is determined that the resource files to be encrypted are compressible. Exemplarily, if the suffix of the resource file to be encrypted is ".gif", ".wav", ".mp2", ".mp3", ".ogg", ".aac", ".mpg", ".mpeg", ".mid", ".midi", ".smf", ".jet", ".rtttl", ".imy", ".xmf", ".mp4", ".m4a", ".m4v", ".3gp", ".3gpp", ".3g2", ".3gpp2", ".amr", ".awb", ".wma", ".wmv", it indicates that the resource file to be encrypted is incompressible. If any of the resource files to be encrypted is incompressible, the resource file to be encrypted is retained and no compression operation is performed on it; if any of the resource files to be encrypted is compressible, the resource file to be encrypted is compressed to obtain a compressed file. The retained resource file to be encrypted is merged with the obtained compressed file to obtain an integrated file corresponding to the installation package, and the integrated file is encrypted as a whole to obtain a target resource file. Further, the resource file protection method also includes: storing the target resource file in a specified path in the installation package of the application. Delete the extracted resource files to be encrypted from the installation package.

[0072] Exemplarily, the APP installation package is first analyzed, the directory addresses of the res resource folder and the assets resource folder are obtained, and the contents of the two resource folders are extracted. After the extraction is completed, the suffix of each resource file is used to determine whether the file is compressible. If it is compressible, the resource file is compressed. If it is not compressible, the original resource file is retained. Then, the compressed resource file and the uncompressed original resource file are merged into a new zip file. Finally, the zip file is encrypted as a whole and stored in the assets directory of the APP installation package, and the original assets resource folder and res resource folder of the installation package are deleted. In this way, when the attacker gets the APP installation package, he cannot obtain the original resource files from the res directory and the assets directory, nor can he perform malicious behaviors such as repackaging.

[0073] In this embodiment, by identifying the type of resource file, determining whether to compress it based on the type of resource file, and integrating the compressed resource file with the retained resource file, the innovative technology of overall encryption of resource files is adopted, the encryption strength is increased, and the security strength of the file is improved.

[0074] In one embodiment, if a loading action is monitored, intercepting the loading action includes: if a loading action is monitored, intercepting the loading action based on a hook mechanism Hook.

[0075] Among them, the loading action includes at least one of open, read and memory mapping mmap (memory-mapped). Mmap maps a file or other object into memory. When the file is mapped to the process, the virtual address can be directly operated to perform operations such as reading and writing the file. Hook is also called "hook". It can intercept and monitor the transmission of events during event transmission and integrate its own code with system methods. In this way, when these system methods are called, their own code is executed to implement the corresponding resource protection method to avoid the formation of decrypted resource files in the local storage space ROM. Specifically, in the process of loading Android resource files, it is necessary to call methods such as open, read, mmap in the libc.so library. Hooking these loading methods will monitor the loading actions such as open, read, mmap of resource files. When the system calls open, read, mmap to load or read resource files, these loading actions are captured, thereby intercepting these loading actions and starting to load the resource files into the running memory of the application to decrypt them without landing.

[0076] In this embodiment, the system's Open, Read, Mmap and other functions are hooked based on the hook mechanism to achieve non-landing decryption of resource files in the running memory, ensuring that the Android system can read resource files normally, while avoiding the formation of decrypted resource files in the local storage space ROM, thereby making up for the security loopholes in traditional decryption methods.

[0077] In one embodiment, the present application provides a resource file protection method, such as Figure 5 As shown, the method comprises the following steps:

[0078] S502: Parse the installation package of the application to obtain the directory address of the resource file to be encrypted in the installation package.

[0079] S504: Extract the resource files to be encrypted from the installation package according to the directory address.

[0080] The number of resource files to be encrypted is greater than one.

[0081] S506: Determine whether each resource file to be encrypted is compressible according to the file type of each resource file to be encrypted.

[0082] S508: If the resource file to be encrypted is compressible, compress the resource file to be encrypted to obtain a compressed file.

[0083] S510: If the resource file to be encrypted is incompressible, the resource file to be encrypted is retained.

[0084] S512: Merge the compressed file and the reserved resource file to be encrypted, encrypt the merged file, and obtain the target resource file.

[0085] S514: Delete the extracted resource files to be encrypted from the installation package.

[0086] S516: Store the target resource file in a specified path in the installation package of the application.

[0087] S518. During the running of the application, the loading action of the target resource file is monitored, and the target resource file is obtained by encrypting the resource file of the application.

[0088] S520: If a loading action is detected, intercept the loading action and load the target resource file into the running memory of the application.

[0089] S522. Decrypt the target resource file in the running memory of the application program to obtain a decrypted resource file.

[0090] S524: Read the decrypted resource file from the running memory.

[0091] It should be understood that, although the various steps in the above flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above flowchart may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0092] In one embodiment, Figure 6As shown, a resource file protection device is provided, which includes a monitoring module 610, an interception module 620, a decryption module 630 and a reading module 640; wherein:

[0093] A monitoring module 610, used for monitoring the loading action of a target resource file during the running of the application, wherein the target resource file is obtained by encrypting the resource file of the application;

[0094] The interception module 620 is used to intercept the loading action if the loading action is monitored, and load the target resource file into the running memory of the application program;

[0095] A decryption module 630, configured to decrypt the target resource file in the running memory of the application program to obtain a decrypted resource file;

[0096] The reading module 640 is used to read the decrypted resource file from the running memory.

[0097] In one embodiment, the device further includes a generation module, which includes a parsing module and an encryption module; wherein:

[0098] A parsing module, used to parse the installation package of the application and extract the resource files to be encrypted from the installation package;

[0099] The encryption module is used to compress and encrypt the resource file to be encrypted to obtain the target resource file.

[0100] In one embodiment, the number of the resource files to be encrypted is greater than one; the encryption module is further used to determine whether each of the resource files to be encrypted is compressible according to the file type of each of the resource files to be encrypted; if the resource files to be encrypted are compressible, the resource files to be encrypted are compressed to obtain a compressed file; if the resource files to be encrypted are incompressible, the resource files to be encrypted are retained; the compressed file and the retained resource files to be encrypted are merged, and the merged file is encrypted to obtain the target resource file.

[0101] In one embodiment, the device further includes a deletion module for deleting the extracted resource file to be encrypted from the installation package.

[0102] In one embodiment, the device further includes a storage module, which is used to store the target resource file in a specified path in the installation package of the application.

[0103] In one embodiment, the parsing module is used to parse the installation package of the application to obtain the directory address of the resource file to be encrypted in the installation package; and extract the resource file to be encrypted from the installation package according to the directory address.

[0104] In one embodiment, the interception module is further used to intercept the loading action based on a hook mechanism Hook if the loading action is monitored, and the loading action includes at least one of open, read and memory mapping mmap.

[0105] For the specific definition of the resource file protection device, please refer to the definition of the resource file protection method in the above text, which will not be repeated here. Each module in the above resource file protection device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0106] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a resource file protection method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0107] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0108] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0109] During the running of the application, the loading action of the target resource file is monitored, and the target resource file is obtained by encrypting the resource file of the application; if the loading action is monitored, the loading action is intercepted, and the target resource file is loaded into the running memory of the application; in the running memory of the application, the target resource file is decrypted to obtain a decrypted resource file; and the decrypted resource file is read from the running memory.

[0110] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0111] The installation package of the application is parsed, and the resource file to be encrypted is extracted from the installation package; the resource file to be encrypted is compressed and encrypted to obtain the target resource file.

[0112] In one embodiment, the number of resource files to be encrypted is greater than one; when the processor executes the computer program, the processor further implements the following steps:

[0113] According to the file type of each resource file to be encrypted, determine whether each resource file to be encrypted is compressible; if the resource file to be encrypted is compressible, compress the resource file to be encrypted to obtain a compressed file; if the resource file to be encrypted is not compressible, retain the resource file to be encrypted; merge the compressed file and the retained resource file to be encrypted, encrypt the merged file, and obtain the target resource file.

[0114] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: deleting the extracted resource file to be encrypted from the installation package.

[0115] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: storing the target resource file in a specified path in the installation package of the application.

[0116] In one embodiment, when the processor executes the computer program, the following steps are also implemented: parsing the installation package of the application to obtain the directory address of the resource file to be encrypted in the installation package; and extracting the resource file to be encrypted from the installation package according to the directory address.

[0117] In one embodiment, when executing the computer program, the processor further implements the following steps: if the loading action is monitored, the loading action is intercepted based on the hook mechanism Hook, and the loading action includes at least one of open, read and memory mapping mmap.

[0118] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are further implemented:

[0119] During the running of the application, the loading action of the target resource file is monitored, and the target resource file is obtained by encrypting the resource file of the application; if the loading action is monitored, the loading action is intercepted, and the target resource file is loaded into the running memory of the application; in the running memory of the application, the target resource file is decrypted to obtain a decrypted resource file; and the decrypted resource file is read from the running memory.

[0120] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0121] The installation package of the application is parsed, and the resource file to be encrypted is extracted from the installation package; the resource file to be encrypted is compressed and encrypted to obtain the target resource file.

[0122] In one embodiment, the number of resource files to be encrypted is greater than one; when the computer program is executed by the processor, the following steps are also implemented:

[0123] According to the file type of each resource file to be encrypted, determine whether each resource file to be encrypted is compressible; if the resource file to be encrypted is compressible, compress the resource file to be encrypted to obtain a compressed file; if the resource file to be encrypted is not compressible, retain the resource file to be encrypted; merge the compressed file and the retained resource file to be encrypted, encrypt the merged file, and obtain the target resource file.

[0124] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: deleting the extracted resource file to be encrypted from the installation package.

[0125] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: storing the target resource file in a specified path in the installation package of the application.

[0126] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: parsing the installation package of the application to obtain the directory address of the resource file to be encrypted in the installation package; and extracting the resource file to be encrypted from the installation package according to the directory address.

[0127] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: if the loading action is monitored, the loading action is intercepted based on the hook mechanism Hook, and the loading action includes at least one of open, read and memory mapping mmap.

[0128] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0129] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0130] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A resource file protection method, characterized in that: The method comprises: During the running process of the application, the loading action of the target resource file is monitored; the target resource file is obtained by encrypting the resource file of the application; the encrypting the resource file of the application includes compressing the non-multimedia file, and merging the compressed file with the multimedia file and encrypting it; If the loading action is detected, the loading action is intercepted, and the target resource file is loaded into the running memory of the application program; wherein the running memory is a random access memory; and the loading action includes at least one of open, read, and mmap; In the running memory of the application, decrypting the target resource file to obtain a decrypted resource file; The decryption resource file is read from the running memory.

2. The method according to claim 1, characterized in that: The method for generating the target resource file includes: Parsing the installation package of the application and extracting the resource files to be encrypted from the installation package; The resource file to be encrypted is compressed and encrypted to obtain the target resource file.

3. The method according to claim 2, characterized in that The number of the resource files to be encrypted is greater than one; and the compressing and encrypting the resource files to be encrypted to obtain the target resource files includes: According to the file type of each resource file to be encrypted, determining whether each resource file to be encrypted is compressible; If the resource file to be encrypted is compressible, compressing the resource file to be encrypted to obtain a compressed file; If the resource file to be encrypted is incompressible, retaining the resource file to be encrypted; The compressed file and the reserved resource file to be encrypted are merged, and the merged file is encrypted to obtain the target resource file.

4. The method according to claim 2 or 3, characterized in that: The method further comprises: The extracted resource file to be encrypted is deleted from the installation package.

5. The method according to claim 2 or 3, characterized in that: The method further comprises: The target resource file is stored in a specified path in the installation package of the application.

6. The method according to claim 2, characterized in that The step of parsing the installation package of the application and extracting the resource file to be encrypted from the installation package includes: Parsing the installation package of the application to obtain the directory address of the resource file to be encrypted in the installation package; According to the directory address, the resource file to be encrypted is extracted from the installation package.

7. The method according to claim 1, characterized in that If the loading action is monitored, intercepting the loading action includes: If the loading action is monitored, the loading action is intercepted based on the hook mechanism Hook.

8. A resource file protection device, characterized in that: The device comprises: A monitoring module, used for monitoring the loading action of a target resource file during the running of the application, wherein the target resource file is obtained by encrypting the resource file of the application; the encrypting the resource file of the application includes compressing the non-multimedia file, and merging and encrypting the compressed file with the multimedia file; An interception module is used to intercept the loading action if the loading action is monitored, and load the target resource file into the running memory of the application; wherein the running memory is a random access memory; the loading action includes at least one of open, read and memory mapping mmap; A decryption module, used to decrypt the target resource file in the running memory of the application to obtain a decrypted resource file; A reading module is used to read the decrypted resource file from the running memory.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.