A method, device, equipment and medium for reinforcing an iOS application

By reading the directory structure and original code files of the iOS application, generating random names to replace the names to be obfuscated, and performing iterative obfuscation, the problem of iOS applications being unable to run obfuscation again after being hardened is solved, improving the reliability and efficiency of hardening.

CN116305012BActive Publication Date: 2026-01-23INSPUR GENERSOFT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310356019.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2026-01-23
Estimated Expiration
2043-03-31

AI Technical Summary

Technical Problem

Existing iOS application hardening methods cannot run obfuscation again after the code has been obfuscated once, making it difficult to completely obfuscate the code files, resulting in low security and efficiency.

Method used

By reading the directory structure and original code files of the iOS application, a random name is generated to replace the name to be obfuscated, and iterative obfuscation is performed based on the matching relationship to generate a hardened obfuscated project file.

Benefits of technology

This technology enables code to continue running after one obfuscation, improving the reliability and efficiency of hardening and solving the problem of not being able to run obfuscation again in existing technologies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116305012B_ABST
    Figure CN116305012B_ABST
Patent Text Reader

Abstract

The embodiment of the specification discloses a kind of iOS application's reinforcement method, device, equipment and medium, method includes: reading the directory structure of the project corresponding to the iOS application to be reinforced, and project original code file;Based on original code file, obtain the name to be confused, according to the random name corresponding to each name to be confused according to preset configuration file;Based on project directory structure, sequentially parse the project engineering file in the project directory of the iOS application to be reinforced;Based on random name, replace the corresponding name to be confused in each project engineering file, realize the confusion of each project engineering file, obtain the reinforced confused project engineering file;The matching relationship of original prefix and current prefix of confused project engineering file is obtained, to carry out iterative confusion to confused project engineering file based on matching relationship.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present specification relates to the technical field of computer technology, and particularly relates to a reinforcement method, device, equipment and medium of an iOS application program. BACKGROUND

[0002] With the development of computer technology, the development and use of mobile applications (Application, APP for short) are becoming more and more common, and the security problems exposed by APP are also increasing. With the continuous development of the mobile application market, the growth rate of malicious applications on the iOS platform has exceeded that of the Android platform. iOS application programs APP also face security problems such as reverse cracking of application programs, cracking of in-app purchases, and second packaging and signing. Because the core code logic is leaked, third parties can attack using the vulnerabilities in the code, so the security requirements for iOS application programs APP are becoming higher and higher.

[0003] At present, when reinforcing iOS, the current project code is generally encrypted according to the characters input by the user, the class name, the method name, and the picture hash value are changed to realize basic code obfuscation, but this kind of way cannot run the obfuscation again after experiencing a code obfuscation because the target file does not exist, resulting in that it is difficult to complete the code obfuscation of all the code files in the directory of the iOS application program. SUMMARY

[0004] In order to solve the above technical problems, the present specification provides a reinforcement method, device, equipment and medium of an iOS application program.

[0005] One or more embodiments of the present specification adopt the following technical solutions:

[0006] One or more embodiments of the present specification provide a reinforcement method of an iOS application program, the method comprising:

[0007] reading the directory structure of the project corresponding to the iOS application program to be reinforced and the original code file of the project;

[0008] obtaining the names to be obfuscated based on the original code file, and obtaining the random names corresponding to each name to be obfuscated according to a preset configuration file;

[0009] sequentially parsing the project engineering files in the project directory of the iOS application program to be reinforced based on the project directory structure;

[0010] replacing the corresponding names to be obfuscated in each project engineering file based on the random names, realizing the obfuscation of each project engineering file, and obtaining the obfuscated project engineering file after reinforcement;

[0011] Obtaining a matching relationship between an original prefix and a current prefix of the obfuscated project engineering file, and iteratively obfuscating the obfuscated project engineering file based on the matching relationship.

[0012] Optionally, in one or more embodiments of the present specification, based on the original code file, the method further comprises, before obtaining the random name corresponding to each to-be-obfuscated name according to the preset configuration file, the method further comprises:

[0013] Obtaining a to-be-obfuscated name corresponding to sensitive information of the to-be-hardened iOS application; wherein the to-be-obfuscated name includes a class name, a method name, and a variable name;

[0014] Determining an effective character coverage range of the random name based on a preset sensitive word, and determining a character length of the random name based on a preset character amount range;

[0015] Based on the effective character coverage range and the character length, a multi-dimensional array corresponding to each to-be-obfuscated name is randomly generated, and the multi-dimensional array is used as a random name corresponding to each to-be-obfuscated name;

[0016] Determining a correspondence between the to-be-obfuscated name and the random name, and writing the correspondence into the preset configuration file.

[0017] Optionally, in one or more embodiments of the present specification, before sequentially parsing project engineering files in a project directory of the to-be-hardened iOS application based on the project directory structure, the method further comprises:

[0018] According to the directory structure of the corresponding project of the to-be-hardened iOS application, obtaining a root directory path of the corresponding project, and uploading the configuration file to the corresponding root directory according to the root directory path;

[0019] Inputting the pre-set obfuscated file prefix identifier, the configuration file, and the root directory path into a preset obfuscated script template to generate an obfuscated script corresponding to the to-be-hardened iOS application;

[0020] Uploading the obfuscated script to the corresponding root directory according to the root directory path.

[0021] Optionally, in one or more embodiments of the present specification, based on the project directory structure, sequentially parsing project engineering files in a project directory of the to-be-hardened iOS application, specifically comprising:

[0022] According to the project directory structure, generating an obfuscated project directory structure corresponding to the to-be-hardened iOS application;

[0023] The project engineering files in the project directory of the to-be-reinforced iOS application are parsed into corresponding obfuscated project directory structures based on the obfuscated script in sequence.

[0024] Before the project engineering files in the project directory of the to-be-reinforced iOS application are parsed into corresponding obfuscated project directory structures based on the obfuscated script in sequence, the method further comprises:

[0025] The prefix identifiers of the project engineering files in the project directory of the to-be-reinforced iOS application are determined based on the obfuscated script.

[0026] If the project engineering files are determined to be unobfuscated project engineering files based on the prefix identifiers, the unobfuscated project engineering files are input into a preset to-be-obfuscated queue to wait for obfuscation.

[0027] Optionally, in one or more embodiments of the present specification, the obfuscation of the project engineering files is implemented by replacing the corresponding to-be-obfuscated names in the project engineering files with random names based on the random names, and the reinforced obfuscated project engineering files are obtained, specifically comprising:

[0028] The unobfuscated project engineering files in the preset to-be-obfuscated queue are obtained in sequence.

[0029] The corresponding to-be-obfuscated names in the unobfuscated project engineering files are replaced with corresponding random names based on the obfuscated script to obfuscate the unobfuscated project engineering files.

[0030] The reinforced obfuscated project engineering files are obtained before the current prefix of the obfuscated script is determined to be written before the original prefix of the unobfuscated project engineering files.

[0031] After the reinforced obfuscated project engineering files are obtained, the method further comprises:

[0032] The mapping relationship in the project engineering files and the obfuscated project engineering files is extracted, and the mapping relationship is recorded in a preset mapping file.

[0033] Optionally, in one or more embodiments of the present specification, the matching relationship between the original prefix and the current prefix of the obfuscated project engineering files is obtained to iteratively obfuscate the project engineering files based on the matching relationship, specifically comprising:

[0034] The original prefix and the current prefix of the obfuscated project engineering files are obtained to match the original prefix with the current prefix to obtain the corresponding matching relationship.

[0035] determining a preset reinforcement iteration strategy of the project engineering file, and if it is determined that the reinforcement iteration number of the project engineering file is greater than 1 based on the preset reinforcement iteration strategy, obtaining a project engineering file corresponding to the obfuscated project engineering file based on a matching relationship between the original prefix and the current prefix.

[0036] Optionally, in one or more embodiments of the present specification, after obtaining the matching relationship between the original prefix and the current prefix of the obfuscated project engineering file and performing iterative obfuscation on the project engineering file based on the matching relationship, the method further comprises:

[0037] determining client information corresponding to the to-be-reinforced iOS application;

[0038] obtaining context information of the client information corresponding to the obfuscated project engineering file;

[0039] if it is determined that the iOS application has a stack phenomenon based on the context information, determining the original code of the project engineering file corresponding to the obfuscated project engineering file based on the preset mapping file.

[0040] One or more embodiments of the present specification provide a reinforcement device for an iOS application, the device comprising:

[0041] a reading unit configured to read a directory structure of a project corresponding to a to-be-reinforced iOS application and a project original code file;

[0042] a obtaining unit configured to obtain to-be-obfuscated names based on the original code file and obtain random names corresponding to each to-be-obfuscated name according to a preset configuration file;

[0043] a parsing unit configured to sequentially parse project engineering files in a project directory of the to-be-reinforced iOS application project based on the project directory structure;

[0044] an obfuscating unit configured to replace each to-be-obfuscated name in each project engineering file with a corresponding random name, to realize obfuscation of each project engineering file, and to obtain an obfuscated project engineering file after reinforcement;

[0045] an iterating unit configured to obtain a matching relationship between an original prefix and a current prefix of the obfuscated project engineering file, and to obtain a project engineering file corresponding to the obfuscated project engineering file to perform iterative obfuscation.

[0046] One or more embodiments of the present specification provide a reinforcement device for an iOS application, the device comprising:

[0047] at least one processor; and

[0048] a memory in communication connection with the at least one processor; wherein

[0049] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to:

[0050] read the directory structure of the project corresponding to the iOS application to be hardened, and the original code file of the project;

[0051] obtain the names to be obfuscated based on the original code file, and obtain the random names corresponding to each name to be obfuscated according to a preset configuration file;

[0052] resolve the project engineering files in the project directory of the iOS application to be hardened in sequence based on the project directory structure;

[0053] replace the corresponding names to be obfuscated in each project engineering file based on the random names, realize the obfuscation of each project engineering file, and obtain the hardened obfuscated project engineering file;

[0054] obtain the matching relationship between the original prefix and the current prefix of the obfuscated project engineering file, and iteratively obfuscate the project engineering file based on the matching relationship.

[0055] One or more embodiments of the present specification provide a non-volatile computer storage medium storing computer executable instructions, which are configured to:

[0056] read the directory structure of the project corresponding to the iOS application to be hardened, and the original code file of the project;

[0057] obtain the names to be obfuscated based on the original code file, and obtain the random names corresponding to each name to be obfuscated according to a preset configuration file;

[0058] resolve the project engineering files in the project directory of the iOS application to be hardened in sequence based on the project directory structure;

[0059] replace the corresponding names to be obfuscated in each project engineering file based on the random names, realize the obfuscation of each project engineering file, and obtain the hardened obfuscated project engineering file;

[0060] obtain the matching relationship between the original prefix and the current prefix of the obfuscated project engineering file, and iteratively obfuscate the project engineering file based on the matching relationship.

[0061] The above at least one technical solution adopted by the embodiments of the present specification can achieve the following beneficial effects:

[0062] After the obfuscation and reinforcement of the project engineering file in the iOS application to be reinforced is completed, the matching relationship between the original prefix and the current prefix of the obfuscated project engineering file is obtained, so as to obtain the target project engineering file according to the matching relationship, thereby realizing the purpose of continuing to run the obfuscated code after one-time code obfuscation, solving the problem that the obfuscated code cannot be run again due to the unavailability of the target file in the prior art, and improving the reliability and efficiency of reinforcement. BRIEF DESCRIPTION OF DRAWINGS

[0063] In order to more clearly illustrate the technical solutions in the embodiments of the present specification or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments described in the present specification, and other drawings can also be obtained according to these drawings without creative labor. In the drawings:

[0064] Figure 1 A flowchart of an iOS application reinforcement method provided by an embodiment of the present specification;

[0065] Figure 2 A code obfuscation flowchart of an iOS application in a certain application scenario provided by an embodiment of the present specification;

[0066] Figure 3 A code obfuscation logic diagram of an iOS application in a certain application scenario provided by an embodiment of the present specification;

[0067] Figure 4 An internal structure diagram of an iOS application reinforcement device provided by an embodiment of the present specification;

[0068] Figure 5 An internal structure diagram of an iOS application reinforcement device provided by an embodiment of the present specification;

[0069] Figure 6 An internal structure diagram of a non-volatile storage medium provided by an embodiment of the present specification. DETAILED DESCRIPTION

[0070] The embodiments of the present specification provide an iOS application reinforcement method, device, equipment and medium.

[0071] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments of this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.

[0072] like Figure 1 As shown, this specification provides a flowchart illustrating one or more embodiments of an iOS application hardening method. Figure 1 It is known that an iOS application hardening method includes the following steps:

[0073] S101: Reads the directory structure of the project corresponding to the iOS application to be hardened, as well as the project's original code files.

[0074] In order to harden the core code of the iOS application to be hardened and reduce the security risks caused by the analysis of code logic by decompilation tools, the embodiments of this specification first read the directory structure of the project corresponding to the iOS application to be hardened, so that the obfuscated files can be generated based on the corresponding directory structure. At the same time, the original code files of the project are obtained to analyze the core code in the original code files of the project and determine the information in the original code files of the project that needs to be hardened and obfuscated.

[0075] S102: Obtain the names to be obfuscated based on the original code file, and obtain random names corresponding to each name to be obfuscated according to the preset configuration file.

[0076] After obtaining the original code file according to step S101 above, in order to strengthen the core code and reduce the excessive amount of computation caused by aimless strengthening, in one or more embodiments of this specification, the names to be obfuscated in the original code file are obtained, and then random names corresponding to each name to be obfuscated are obtained according to a pre-set configuration file, so as to replace the names to be obfuscated with random names in the future and realize code obfuscation strengthening.

[0077] Specifically, in order to facilitate obtaining random names corresponding to the names to be obfuscated, in one or more embodiments of this specification, before obtaining the names to be obfuscated based on the original code file and obtaining random names corresponding to each name to be obfuscated according to a preset configuration file, the method further includes the following steps:

[0078] First, the sensitive information corresponding to the to-be-obfuscated name of the to-be-reinforced iOS application is obtained; it should be noted that the to-be-obfuscated name includes the class name, the method name, and the variable name. Then, the effective character coverage range of the random name is determined according to the pre-set sensitive word, and the character length of each random name is determined based on the pre-set character amount range. It should be noted that the sensitive word is a special character such as "*", "#", "!", and the like, and accordingly, the effective character coverage range is the character included except the special character. Then, a multi-dimensional array corresponding to each of the to-be-obfuscated names is randomly generated according to the effective character coverage range and the character length set in the above process, so as to splice the multi-dimensional array as the random name corresponding to each of the to-be-obfuscated names. Then, the correspondence between the to-be-obfuscated name and the random name is determined, and the correspondence is written into the pre-set configuration file, so as to quickly determine the random name corresponding to the to-be-obfuscated name based on the configuration file. Further, in one or more embodiments of the specification, a random class name and a random method name can also be generated according to a user-configured plist file or other types of configuration interface files.

[0079] S103: sequentially parsing the project engineering files in the project directory of the to-be-reinforced iOS application based on the project directory structure.

[0080] In order to make the reinforced iOS application still have corresponding functions and corresponding directory structures, in the embodiments of the specification, the project engineering files in the project directory of the to-be-reinforced iOS application are sequentially parsed based on the project directory structure obtained in the step S101, so that the reinforced project engineering files can be stored in the corresponding directory structure.

[0081] Further, in order to facilitate the obfuscation and reinforcement of the project file, in one or more embodiments of the specification, before sequentially parsing the project engineering files in the project directory of the to-be-reinforced iOS application based on the project directory structure, the method further includes the following steps:

[0082] First, the directory structure of the corresponding project of the to-be-reinforced iOS application is obtained, and then the configuration file is uploaded to the corresponding root directory according to the root directory path as shown in Figure 2 At the same time, the pre-set obfuscation file prefix identifier, the configuration file, and the root directory path are input into the pre-set obfuscation script template, so as to generate the obfuscation script corresponding to the to-be-reinforced iOS application according to the obfuscation script template. In order to facilitate the acquisition of the obfuscation script and improve the efficiency of the obfuscation and reinforcement, the obtained obfuscation script is uploaded to the corresponding root directory according to the root directory path.

[0083] Specifically, in one or more embodiments of this specification, the process of sequentially parsing the project files in the project directory of the iOS application to be hardened based on the project directory structure includes the following steps:

[0084] First, based on the project directory structure, an obfuscated project directory structure corresponding to the iOS application to be hardened is generated. Then, according to the obfuscation script, the project files in the iOS application's project directory are sequentially parsed into the corresponding obfuscated project directory structure. It should be noted that before sequentially parsing the project files in the iOS application's project directory into the corresponding obfuscated project directory structure according to the obfuscation script, the method also includes the following steps: determining the prefix identifier of each project file in the iOS application's project directory based on the obfuscation script. If the prefix identifier determines that a project file is an unobfuscated project file, then the unobfuscated project file is added to a pre-set obfuscation queue to await obfuscation.

[0085] S104: Replace the corresponding names to be obfuscated in each of the project files with the random names to achieve obfuscation of each of the project files and obtain the hardened obfuscated project files.

[0086] After obtaining the random name corresponding to the name to be obfuscated based on the above steps, the corresponding name to be obfuscated in each project file is replaced with the random name, thereby obfuscating each project file in the project directory and obtaining the hardened obfuscated project file.

[0087] Specifically, in one or more embodiments of this specification, obfuscation of each project file is achieved by randomly replacing the corresponding names to be obfuscated in each project file, resulting in a hardened obfuscated project file. This process includes the following steps: sequentially obtaining unobfuscated project files from a pre-set obfuscation queue, and then, according to the obfuscation script, sequentially replacing the corresponding names to be obfuscated in the unobfuscated project files with corresponding random names to obfuscate the unobfuscated project files. Furthermore, to avoid the problem of iterative obfuscation in existing methods, in this embodiment, after obfuscating the unobfuscated project files, the current prefix of the obfuscation script is determined and written before the original prefix of the unobfuscated project files, resulting in a hardened obfuscated project file with the current prefix.

[0088] Furthermore, in order to facilitate the resolution of the problem that the hardened iOS application cannot be used due to online crashes, in the embodiments of this specification, after obtaining the hardened obfuscated project file, the method further includes the following steps: that is, extracting the mapping relationship between the project file and the obfuscated project file, and recording the mapping relationship in a preset mapping file, so as to restore the code through string matching in the future, so as to resolve the problem that the iOS application cannot be used normally due to online crashes.

[0089] S105: Obtain the matching relationship between the original prefix and the current prefix of the obfuscated project file, and perform iterative obfuscation on the project file based on the matching relationship.

[0090] After obtaining the matching relationship between the original prefix and the current prefix of the obfuscated project file based on the above steps, the original project file, that is, the project file before obfuscation, can be iteratively obfuscated according to the matching relationship. This avoids the problem in the existing technology that after the code has been obfuscated once, it is impossible to run obfuscation again because the target file does not exist, which makes it difficult to completely obfuscate the code files in the iOS application directory.

[0091] Specifically, in one or more embodiments of this specification, the matching relationship between the original prefix and the current prefix of the obfuscated project file is obtained, and the project file is iteratively obfuscated based on the matching relationship. This process includes the following steps:

[0092] First, the original prefix and current prefix of the obfuscated project file are obtained, and then the original prefix and current prefix are matched to obtain the corresponding matching relationship. Then, the preset hardening iteration strategy of the project file is determined. If the hardening iteration number of the project file is determined to be greater than 1 according to the preset hardening iteration strategy, then the project file corresponding to the obfuscated project file is obtained based on the matching relationship between the original prefix and the current prefix, and the obfuscation continues.

[0093] Furthermore, in order to solve the problem of online crashes and enable the obfuscated file to be restored to its original state, in one or more embodiments of this specification, the method further includes the following steps after obtaining the matching relationship between the original prefix and the current prefix of the obfuscated project file and iteratively obfuscating the project file based on the matching relationship: first, determining the client information corresponding to the iOS application to be hardened, then monitoring and obtaining the context information of the client information corresponding to the obfuscated project file; if it is determined that a stack phenomenon has occurred in the iOS application based on the monitored context information, then determining the original code of the project file corresponding to the obfuscated project file based on the pre-set mapping file.

[0094] like Figure 2 and Figure 3 As shown in the flowchart and logic diagram of the code obfuscation process for an iOS application in a certain application scenario, the embodiment of this specification first configures the obfuscated class name, method name, and random string, and places the obfuscation script and configuration file in the project root directory. It then traverses the project directory of the iOS application and parses the project files one by one, thereby replacing the text information according to the configured script and determining whether the original string has been replaced. If the replacement is complete, the obfuscated project file replaces the original file in the project file, and the code of the obfuscated project file is generated for obfuscating the mapping file. If it is determined that all project files in the project directory of the iOS application have been obfuscated and hardened, then the hardening of the iOS application is complete.

[0095] like Figure 4 As shown, one or more embodiments of this specification provide a device for hardening an iOS application, comprising: Figure 4 It is known that an iOS application hardening device includes:

[0096] Reading unit 401 is used to read the directory structure of the project corresponding to the iOS application to be hardened, as well as the project's original code files;

[0097] The acquisition unit 402 is used to acquire the name to be obfuscated based on the original code file, and to obtain a random name corresponding to each name to be obfuscated according to a preset configuration file;

[0098] Parsing unit 403 is used to parse the project files in the project directory of the iOS application to be hardened sequentially based on the project directory structure.

[0099] The obfuscation unit 404 is used to replace the corresponding name to be obfuscated in each of the project files with the random name to achieve obfuscation of each of the project files and obtain the hardened obfuscated project files.

[0100] The iteration unit 405 is used to obtain the matching relationship between the original prefix and the current prefix of the obfuscated project file, and to obtain the project file corresponding to the obfuscated project file for iterative obfuscation.

[0101] like Figure 5 As shown, this specification provides a schematic diagram of the internal structure of a ruggedized device for an iOS application in one or more embodiments. Figure 5 It is known that an iOS application hardening device includes:

[0102] At least one processor 501; and,

[0103] A memory 502 is communicatively connected to the at least one processor 501; wherein,

[0104] The memory 502 stores instructions that can be executed by the at least one processor 501, the instructions being executed by the at least one processor 501 to enable the at least one processor 501 to:

[0105] Read the directory structure of the project corresponding to the iOS application to be hardened, as well as the project's original code files;

[0106] Based on the original code file, obtain the names to be obfuscated, and obtain random names corresponding to each name to be obfuscated according to the preset configuration file;

[0107] Based on the project directory structure, the project files in the iOS application project directory to be hardened are parsed sequentially.

[0108] Based on the random name replacement, the corresponding name to be obfuscated in each of the project files is replaced to achieve obfuscation of each of the project files, and the obfuscated project files are obtained after hardening.

[0109] Obtain the matching relationship between the original prefix and the current prefix of the obfuscated project file, and perform iterative obfuscation on the project file based on the matching relationship.

[0110] like Figure 6 As shown, this specification provides a schematic diagram of the internal structure of a non-volatile storage medium in one or more embodiments. Figure 6 It is known that a non-volatile storage medium stores computer-executable instructions 601, which are capable of:

[0111] Read the directory structure of the project corresponding to the iOS application to be hardened, as well as the project's original code files;

[0112] Based on the original code file, obtain the names to be obfuscated, and obtain random names corresponding to each name to be obfuscated according to the preset configuration file;

[0113] Based on the project directory structure, the project files in the iOS application project directory to be hardened are parsed sequentially.

[0114] Based on the random name replacement, the corresponding name to be obfuscated in each of the project files is replaced to achieve obfuscation of each of the project files, and the obfuscated project files are obtained after hardening.

[0115] Obtain the matching relationship between the original prefix and the current prefix of the obfuscated project file, and perform iterative obfuscation on the project file based on the matching relationship.

[0116] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, devices, and non-volatile computer storage media are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0117] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0118] The above description is merely one or more embodiments of this specification and is not intended to limit this specification. Various modifications and variations can be made to the one or more embodiments of this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of one or more embodiments of this specification should be included within the scope of the claims of this specification.

Claims

1. A method for hardening an iOS application, characterized in that, The method includes: Read the directory structure of the project corresponding to the iOS application to be hardened, as well as the project's original code files; Based on the original code file, obtain the names to be obfuscated, and obtain random names corresponding to each name to be obfuscated according to the preset configuration file; Based on the project directory structure, the project files in the iOS application project directory to be hardened are parsed sequentially. Based on the random name replacement, the corresponding name to be obfuscated in each of the project files is replaced to achieve obfuscation of each of the project files, and the obfuscated project files are obtained after hardening. Obtain the matching relationship between the original prefix and the current prefix of the obfuscated project file, and perform iterative obfuscation on the obfuscated project file based on the matching relationship; Based on the project directory structure, the project files in the iOS application project directory to be hardened are parsed sequentially, specifically including: Based on the project directory structure, generate the obfuscated project directory structure corresponding to the iOS application to be hardened; Based on the obfuscation script, the project files in the project directory of the iOS application to be hardened are parsed into the corresponding obfuscated project directory structure in sequence; Before the step of parsing the project files in the iOS application project directory to be hardened into the corresponding obfuscated project directory structure based on the obfuscation script, the method further includes: Based on the obfuscation script, determine the prefix identifier of each project file in the project directory of the iOS application to be hardened; If the project file is determined to be an unobfuscated project file based on the prefix identifier, then the unobfuscated project file is input into a preset obfuscation queue to wait for obfuscation. The process of replacing the corresponding names to be obfuscated in each of the project files with the random names to achieve obfuscation of each of the project files and obtaining the hardened obfuscated project files specifically includes: Sequentially retrieve the unobfuscated project files from the pre-set obfuscation queue; Based on the obfuscation script, the corresponding names to be obfuscated in the unobfuscated project files are replaced with corresponding random names in turn to obfuscate the unobfuscated project files; Before writing the current prefix of the obfuscated script to the original prefix of the unobfuscated project file, a hardened obfuscated project file is obtained; After obtaining the hardened and obfuscated project files, the method further includes: Extract the mapping relationship between the project engineering file and the obfuscated project engineering file, and record the mapping relationship in a preset mapping file; Obtain the matching relationship between the original prefix and the current prefix of the obfuscated project file, and perform iterative obfuscation on the project file based on the matching relationship, specifically including: Obtain the original prefix and the current prefix of the obfuscated project file, and match the original prefix and the current prefix to obtain the corresponding matching relationship; A pre-defined reinforcement iteration strategy for the project engineering file is determined. If the reinforcement iteration number of the project engineering file is determined to be greater than 1 based on the pre-defined reinforcement iteration strategy, then based on the matching relationship between the original prefix and the current prefix, the project engineering file corresponding to the obfuscated project engineering file is obtained and iteratively obfuscated.

2. The method for hardening an iOS application according to claim 1, characterized in that, Before obtaining the names to be obfuscated based on the original code file and obtaining random names corresponding to each name to be obfuscated according to a preset configuration file, the method further includes: Obtain the obfuscated names corresponding to the sensitive information of the iOS application to be hardened; wherein, the obfuscated names include: class names, method names, and variable names; The effective character coverage range of the random name is determined based on preset sensitive words, and the character length of the random name is determined based on preset character quantity range; Based on the effective character coverage range and the character length, a multidimensional array corresponding to each of the names to be confused is randomly generated, so that the multidimensional array is used as a random name corresponding to each name to be confused; The correspondence between the name to be obfuscated and the random name is determined, and the correspondence is written into the preset configuration file.

3. The method for hardening an iOS application according to claim 1, characterized in that, Before sequentially parsing the project files in the iOS application project directory to be hardened based on the project directory structure, the method further includes: Based on the directory structure of the corresponding project of the iOS application to be hardened, the root directory path of the corresponding project is obtained, and the configuration file is uploaded to the corresponding root directory according to the root directory path; Input the pre-set obfuscation file prefix identifier, the configuration file, and the root directory path into the pre-set obfuscation script template to generate an obfuscation script corresponding to the iOS application to be hardened. The obfuscation script is uploaded to the corresponding root directory according to the root directory path.

4. The method for hardening an iOS application according to claim 1, characterized in that, After obtaining the matching relationship between the original prefix and the current prefix of the obfuscated project file, and performing iterative obfuscation on the project file based on the matching relationship, the method further includes: Determine the client information corresponding to the iOS application to be hardened; Obtain context information for client information corresponding to the obfuscated project files; If the context information determines that the iOS application is experiencing a stacking issue, then the source code of the project file corresponding to the obfuscated project file is determined based on the preset mapping file.

5. A ruggedization device for an iOS application, characterized in that, The device includes: The reading unit is used to read the directory structure of the project corresponding to the iOS application to be hardened, as well as the project's original code files; The acquisition unit is used to acquire the names to be obfuscated based on the original code file, and to obtain random names corresponding to each name to be obfuscated according to a preset configuration file. The parsing unit is used to sequentially parse the project files in the project directory of the iOS application to be hardened based on the project directory structure. The obfuscation unit is used to replace the corresponding name to be obfuscated in each of the project files with the random name, thereby obfuscating each of the project files and obtaining the hardened obfuscated project files. An iterative unit is used to obtain the matching relationship between the original prefix and the current prefix of the obfuscated project file, and to obtain the project file corresponding to the obfuscated project file for iterative obfuscation; Based on the project directory structure, the project files in the iOS application project directory to be hardened are parsed sequentially, specifically including: Based on the project directory structure, generate the obfuscated project directory structure corresponding to the iOS application to be hardened; Based on the obfuscation script, the project files in the project directory of the iOS application to be hardened are parsed into the corresponding obfuscated project directory structure in sequence; Before the step of parsing the project files in the iOS application project directory to be hardened into the corresponding obfuscated project directory structure based on the obfuscation script, the method further includes: Based on the obfuscation script, determine the prefix identifier of each project file in the project directory of the iOS application to be hardened; If the project file is determined to be an unobfuscated project file based on the prefix identifier, then the unobfuscated project file is input into a preset obfuscation queue to wait for obfuscation. The process of replacing the corresponding names to be obfuscated in each of the project files with the random names to achieve obfuscation of each of the project files and obtaining the hardened obfuscated project files specifically includes: Sequentially retrieve the unobfuscated project files from the pre-set obfuscation queue; Based on the obfuscation script, the corresponding names to be obfuscated in the unobfuscated project files are replaced with corresponding random names in turn to obfuscate the unobfuscated project files; Before writing the current prefix of the obfuscated script to the original prefix of the unobfuscated project file, a hardened obfuscated project file is obtained; After obtaining the hardened and obfuscated project files, it also includes: Extract the mapping relationship between the project engineering file and the obfuscated project engineering file, and record the mapping relationship in a preset mapping file; Obtain the matching relationship between the original prefix and the current prefix of the obfuscated project file, and perform iterative obfuscation on the project file based on the matching relationship, specifically including: Obtain the original prefix and the current prefix of the obfuscated project file, and match the original prefix and the current prefix to obtain the corresponding matching relationship; A pre-defined reinforcement iteration strategy for the project engineering file is determined. If the reinforcement iteration number of the project engineering file is determined to be greater than 1 based on the pre-defined reinforcement iteration strategy, then based on the matching relationship between the original prefix and the current prefix, the project engineering file corresponding to the obfuscated project engineering file is obtained and iteratively obfuscated.

6. A ruggedized device for iOS applications, characterized in that, The device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to: Read the directory structure of the project corresponding to the iOS application to be hardened, as well as the project's original code files; Based on the original code file, obtain the names to be obfuscated, and obtain random names corresponding to each name to be obfuscated according to the preset configuration file; Based on the project directory structure, the project files in the iOS application project directory to be hardened are parsed sequentially. Based on the random name replacement, the corresponding name to be obfuscated in each of the project files is replaced to achieve obfuscation of each of the project files, and the obfuscated project files are obtained after hardening. Obtain the matching relationship between the original prefix and the current prefix of the obfuscated project file, and perform iterative obfuscation on the project file based on the matching relationship; Based on the project directory structure, the project files in the iOS application project directory to be hardened are parsed sequentially, specifically including: Based on the project directory structure, generate the obfuscated project directory structure corresponding to the iOS application to be hardened; Based on the obfuscation script, the project files in the project directory of the iOS application to be hardened are parsed into the corresponding obfuscated project directory structure in sequence; Before the step of parsing the project files in the iOS application project directory to be hardened into the corresponding obfuscated project directory structure based on the obfuscation script, the method further includes: Based on the obfuscation script, determine the prefix identifier of each project file in the project directory of the iOS application to be hardened; If the project file is determined to be an unobfuscated project file based on the prefix identifier, then the unobfuscated project file is input into a preset obfuscation queue to wait for obfuscation. The process of replacing the corresponding names to be obfuscated in each of the project files with the random names to achieve obfuscation of each of the project files and obtaining the hardened obfuscated project files specifically includes: Sequentially retrieve the unobfuscated project files from the pre-set obfuscation queue; Based on the obfuscation script, the corresponding names to be obfuscated in the unobfuscated project files are replaced with corresponding random names in turn to obfuscate the unobfuscated project files; Before writing the current prefix of the obfuscated script to the original prefix of the unobfuscated project file, a hardened obfuscated project file is obtained; After obtaining the hardened and obfuscated project files, it also includes: Extract the mapping relationship between the project engineering file and the obfuscated project engineering file, and record the mapping relationship in a preset mapping file; Obtain the matching relationship between the original prefix and the current prefix of the obfuscated project file, and perform iterative obfuscation on the project file based on the matching relationship, specifically including: Obtain the original prefix and the current prefix of the obfuscated project file, and match the original prefix and the current prefix to obtain the corresponding matching relationship; A pre-defined reinforcement iteration strategy for the project engineering file is determined. If the reinforcement iteration number of the project engineering file is determined to be greater than 1 based on the pre-defined reinforcement iteration strategy, then based on the matching relationship between the original prefix and the current prefix, the project engineering file corresponding to the obfuscated project engineering file is obtained and iteratively obfuscated.

7. A non-volatile storage medium storing computer-executable instructions, characterized in that, The computer-executable instructions are capable of: Read the directory structure of the project corresponding to the iOS application to be hardened, as well as the project's original code files; Based on the original code file, obtain the names to be obfuscated, and obtain random names corresponding to each name to be obfuscated according to the preset configuration file; Based on the project directory structure, the project files in the iOS application project directory to be hardened are parsed sequentially. Based on the random name replacement, the corresponding name to be obfuscated in each of the project files is replaced to achieve obfuscation of each of the project files, and the obfuscated project files are obtained after hardening. Obtain the matching relationship between the original prefix and the current prefix of the obfuscated project file, and perform iterative obfuscation on the project file based on the matching relationship; Based on the project directory structure, the project files in the iOS application project directory to be hardened are parsed sequentially, specifically including: Based on the project directory structure, generate the obfuscated project directory structure corresponding to the iOS application to be hardened; Based on the obfuscation script, the project files in the project directory of the iOS application to be hardened are parsed into the corresponding obfuscated project directory structure in sequence; Before the step of parsing the project files in the iOS application project directory to be hardened into the corresponding obfuscated project directory structure based on the obfuscation script, the method further includes: Based on the obfuscation script, determine the prefix identifier of each project file in the project directory of the iOS application to be hardened; If the project file is determined to be an unobfuscated project file based on the prefix identifier, then the unobfuscated project file is input into a preset obfuscation queue to wait for obfuscation. The process of replacing the corresponding names to be obfuscated in each of the project files with the random names to achieve obfuscation of each of the project files and obtaining the hardened obfuscated project files specifically includes: Sequentially retrieve the unobfuscated project files from the pre-set obfuscation queue; Based on the obfuscation script, the corresponding names to be obfuscated in the unobfuscated project files are replaced with corresponding random names in turn to obfuscate the unobfuscated project files; Before writing the current prefix of the obfuscated script to the original prefix of the unobfuscated project file, a hardened obfuscated project file is obtained; After obtaining the hardened and obfuscated project files, it also includes: Extract the mapping relationship between the project engineering file and the obfuscated project engineering file, and record the mapping relationship in a preset mapping file; Obtain the matching relationship between the original prefix and the current prefix of the obfuscated project file, and perform iterative obfuscation on the project file based on the matching relationship, specifically including: Obtain the original prefix and the current prefix of the obfuscated project file, and match the original prefix and the current prefix to obtain the corresponding matching relationship; A pre-defined reinforcement iteration strategy for the project engineering file is determined. If the reinforcement iteration number of the project engineering file is determined to be greater than 1 based on the pre-defined reinforcement iteration strategy, then based on the matching relationship between the original prefix and the current prefix, the project engineering file corresponding to the obfuscated project engineering file is obtained and iteratively obfuscated.

Citation Information

Patent Citations

  • Resource-confusing protection method and system and terminal device

    CN107967415A

  • Symbol confusion method and device, medium and computing equipment

    CN114547559A