中文
English |Preface
By chance, I ran into the iOS vest bag business . I also used other tools on the market in the early stage, but the actual effect was not ideal. After a lot of practice, a full-featured obfuscation tool has been developed . The tool have been packaged into a Mac application which support multiple programming languages, such as OC, C++, Swift. More functions are still being packaged, so stay tuned.
Prompt
In order to let everyone get started quickly and compare the effects of confusion, a new test project confuse_test was created. If you encounter problems during actual use, welcome to extend the test project. Please indicate the bug details in the project, and there will be rewards.
Test engineering description:
confuse_test: Contains oc, c++, swift and some third-party use cases to quickly verify the overall effect
confuse_test_oc: only contains oc, which is convenient to verify the effect of each function
confuse_test_oc_fast: only contains oc, which is convenient to quickly verify the effect of some functions
confuse_test_swift: only contains swift, the code comes from Apple's official example code, which is convenient to verify the effect of each function
The source code can be modified arbitrarily to verify the actual effect. It is recommended to use different tools to confuse the above test projects or third-party open source library projects to compare the effects.
Instructions for the old version before 1.2.0: Introduction: No grammar and compilation requirements are involved, but partial omissions or corrections may occur after confusion, please add to the blacklist filter by yourself. Applicable projects: RN and other mixed projects that have not yet been adapted. Conditions of use: temporarily unavailable, reopen later
Readme
The essence of vest bag:
- The first stage reduces the repetition rate. The initial version of my development is basically similar to other tools currently on the market, mainly the basic function of global substitution of class name, method name, and variable name.
- The second stage reduces the similarity (normal distribution of the same elements). At present, the tool has been greatly improved after optimization and continuous reconstruction, and it basically meets the requirements in this respect. For details, see the following function introduction. There are two sides to everything. The more powerful the function, the longer it will take to confuse. If your project is large, it is possible to confuse for a few hours. Please do not take offense, and continue to optimize.
Distinguish the pros and cons of tools
In fact, to identify the pros and cons of a tool, just look at the following points:
- Can modify all attributes, methods, and all parameter names of methods
- Modify the name of the member (attribute, method), can it be distinguished by class, or a simple global replacement
- Can modify the method with block parameters, a typical network request
For example:+ (BOOL)post:(NSString *)url parameters:(NSDictionary *)parameters success:(HttpRequestResponse)success error:(HttpRequestResponse)error;
- The length of the changed name of the method name and attribute name (this tool can guarantee that 60~80% of the changed name is a common word, such as name, title, etc., and ensure that it does not conflict with the system.
Completely abandon the simple practice of relying on a large number of word libraries to ensure the uniqueness of naming, The real simulation of manual development) - Modify the layout (Frame, Masonry, SDAutoLayout)
- Is the code inserted or "garbage" (this tool creates custom controls, encapsulates network requests, and uses MVC pattern association between files to completely bid farewell to "garbage" and mix the spurious with the genuine).
- Not to mention "Who else..." can identify macros, distinguish contextual content such as inheritance chains, and intelligently identify unmodifiable parts
For example: + (void)init ;-(void)reloadData; basically can be changed, who else can do it? "
- Normal projects (or third-party libraries) basically do not report errors after obfuscation (except for some individual improper grammars that cause confusion and report errors)
Features
confuse is a confusion tool that simulates manual development as much as possible, imitates some functions of Xcode, and avoids machine core 4.3, 2.1, 2.3.1, account surveys, etc.
Goal: Simulate manually modify everything that can be changed , which is why this tool only has a blacklist and no whitelist
The detailed functions are as follows (the basic functions are not described, see other tools for details):
Completed
The following functions are supported:
- Blacklist (secondary) filtering, freely control the obfuscated content of each function, and adapt to almost all projects.
- Confusion percentage control, you can freely adjust according to the actual needs of your own project
- Smart noun substitution:
- When renaming, use the combination of related type existing information + similar semantics + type + some old vocabulary, and filter sensitive words. At the same time, users can also customize sensitive words.
Deprecate'random word brainless combination' - Different types of members with the same name -> different types of members with different names, and different types of different name members -> different types of members with the same name, simulating normal development. Members refer to methods, attributes, and functions
- When renaming, use the combination of related type existing information + similar semantics + type + some old vocabulary, and filter sensitive words. At the same time, users can also customize sensitive words.
- Intelligent identification of unmodifiable parts: Identifying systems, third parties, and Pod methods through types and inheritance chains is not a'simple' equality judgment, for example:
General part
- [Project Configuration], as long as you select the project path, other default configurations will be automatically completed
- Global setting "Ignore path", support regular, better use with blacklist
- ' xcodeproj' setting, for multiple xcodeproj projects and xx.xcodeproj is not in the project root directory
- 'Scheme' is confused and consistent with Xcode
- 'Debug mode', It is convenient to view the comparison before and after the modification in the source file, and insert some special annotations to facilitate the location of the bug.
- 'Hybrid mode', this mode is used to process the swift call oc part of the mixed project, to ensure that the call relationship is maintained after confusion
- 'proto' setting, used for separate obfuscation of protobuf files
- 'Environmental inspection mode' setting, which is convenient for correcting irregular codes in advance
- 'Reference project root path' setting, read the word and UUID of the reference project
- 'Sensitive words' filtering
- ' Version iteration confusion ', iteratively update after review, continue to use the last time (you can also choose the version arbitrarily) to obfuscate the record incremental confusion, maintain version continuity, and simulate normal development. Advantages: Development and obfuscation are synchronized and independent . The main functions currently support update confusion
- [Antivirus], Xcode poisoning, XCSSET Malware
- 'UUID suffix', the virus will randomly insert UUID with a fixed suffix, regular scanning
- 'Script path feature', a suspicious script will be executed before virus compilation, support regular scanning
- 'Run script code flag', a suspicious script code will be executed before virus compilation, support regular scanning
- [Resource replacement], specify the resource folder that needs to be replaced before obfuscation , and automatically replace the file with the same name, which is convenient and quick
- [Modify sks],modify the layout and node names of sks files in SpriteKit
- 'Run splicing name', which is used for the image name generated by splicing strings at runtime
- [Remove comment], identify single-line, multi-line comments
- [Modify picture], each sub-function can be run independently
- 'Custom path', convenient for debugging and targeted confusion
- 'Custom RGBA', 'RGBA Offset', specify random color modificatio
- 'Theme color', generate a unified color style
- 'Hue shift', 'saturation shift', 'lightness shift', detail adjustment
- 'Pixel Points', local pixel fine-tuning
- 'Quality adjustment', 'Size offset', overall control
- 'Mode modification', multiple modes support
- [Modify Lottie], simulate the real Lottie file structure, modify and expand the source file, basically does not affect the actual effect
- [Modify file attributes], such as creation time, access time, modification time
- [Modify item], no need to delete Cocoapods
- Can be set to'modify uuid', completely refurbished
- Customize the name of the'modify target', and the associated information will be updated synchronously
- Automatic source code backup
Objective-C
- [Rename picture], intelligent noun replacement, automatically process binary sks files, automatically correct the situation that the picture name and the xcassets folder name do not correspond
- You can set the 'Run splicing name', which is used for the image name generated by splicing strings at runtime
- You can set the 'rename associated string' to modify the situation where the string is equal to the picture name
- You can set the 'specified ignore length', the length of the picture name is less than the specified length is a dangerous name, it will be ignored
- You can set 'ignore danger', which has the same name as the dictionary key, and it will be ignored
- You can set 'associated files', other files containing picture names
- [Insert picture], automatically insert pictures, and simulate manual calls according to context and type, and the number of inserts can be specified
- [Rename property], support all types of @property , Support Protobuf, advantages:
- Identify grammar, identify type, inheritance relationship, attribute name confusion and class name (including inheritance chain) association , automatically identify system attributes
- You can set the 'Model suffix' to filter by the suffix of the class name, which is convenient for filtering Model
- You can set 'Model Mapping' to automatically insert the mapping relationship (customized, and automatically complete other attributes) to ensure that the background data is matched
- [Insert property], creation, assignment, and modification are all associated with existing types, smart noun replacement
- 'Percentage control'
- You can set the 'Model suffix' to filter by the suffix of the class name, the purpose: to avoid Model archiving or data transfer model failure
- Can be executed multiple times, the index x2 increases
- [Rename method], similar to Xcode's Rename function , advantages:
- Syntax-related, identification of types, inheritance relationships, support for multi-parameter modification, confusion of method names, class names (including inheritance chains) and type associations , automatic identification of system methods
- [Insert method], insert and call context-related methods, bid farewell to "garbage code", advantages:
- According to the return value type of the method, create the corresponding method in the category. At the same time , the return value of the original method is encapsulated and use (local variables, attributes, formal parameters) called.
- Can be executed multiple times, the index x2 increases
- [Modification method], simulating manual package call, advantages:
- Split the call to the original method and adjust it locally according to the parameter type (support inheritance) . For details, see the summary table of supported parameter types.
- Can be executed multiple times, the index x2 increases
- [Rename global variables], smart noun substitution
- [Modify global variables], replace global variable names, convert global variables into global functions , and confuse string variable values
- [Insert local variable], single-line compound call becomes simple multi-line call, change the execution order
- [Modify local variable], simulate manual encapsulation call, variable name association type, advantages:
- Local variable values remain unchanged during operation, see the summary table of supported types for details
- Can be executed multiple times, the index x2 increases
- [Rename multilingual], using a system of direct or indirect methods NSLocalizedString , NSLocalizedStringFromTable multilingual modified,The custom packaging methods require manual processing
- [Modify string], support arbitrary string, encryption processing (hard code -> memory), the original string is kept in the comment for easy inspection
- Set the'minimum length' filter
- You can also set the " effective number" to use together
- [Modify xib, storyboard], automatically insert the view, and modify the internal structure properties
- [Modify font] , randomly fine-tune the font used in the project, and identify macros
- [Modify color], randomly shift the color of the UI controls in the project, and identify the macro
- [UI layout offset], support Frame, Masonry, SDAutoLayout common layout fine-tuning
- [Insert file], generate other files (Combined with network, storage, and MVC to ensure that the code has high relevance and practical significance), automatic high-related calls in the project ; Note: (Under the project root path, a folder of " other_xxx_file " will be generated , and the sub-option Target controls Import method, if it is empty, you need to manually import, just drag the generated folder into the project; otherwise, automatically import)
- [Insert text], Generate json, txt, plist and other common text files, automatic high-related calls in the project ; note: (under the project root path, a folder of " other_xxx_text " will be generated , and the generated files will be automatically imported )
- [Rename class], the class name is not limited (for example: my, My), you can specify to add a prefix, support class and category name|struct|protocol,advantages:
C++
- [Rename attribute], support all type attributes, recognize syntax, recognize type, inherit
- [Insert attributes], insert attributes (member variables) and call each other to modify, automatic initialization, destruction, and assignment modification in other methods and other similar manual operations, support'percentage control'
- [Rename method], similar to Xcode's Rename function, identifying types, templates, overloading, rewriting, inheritance, etc.
- [Modification method], use overloading technology to modify the function prototype and call the modified parameter
- [Modify string], support arbitrary string, encryption processing (hard code -> memory), the original string is kept in the comment for easy inspection
- Set the'minimum length' filter
- You can also set the " effective number" to use together
- [Rename class], support template and other types
Cocos2d-x
This part of the function is integrated into C++ and supports cocos2dx automatic filtering
Swift
Adapt to Swift5.3, the SPM package management project has not yet been tested
- [Rename global method] to automatically identify system methods
- Can set 'parameter label', support hidden parameter label and trailing closure usage
- [Rename picture], smart noun replacement, automatically process binary sks files, and automatically correct the situation where the picture name and the xcassets folder name do not correspond to each other
- You can set the 'Run splicing name', which is used for the image name generated by splicing strings at runtime
- You can set the 'specified ignore length', the length of the picture name is less than the specified length is a dangerous name, it will be ignored
- You can set 'ignore danger', which has the same name as the dictionary key, and it will be ignored
- You can set 'associated files', other files containing picture names
- [Rename lottie] to adapt to various scenarios
- You can set the 'run splicing name', which is used for the lottie name generated by string splicing at runtime
- You can set the 'specified Ignore Length', if the length of the lottie name is less than the specified length, it is a dangerous name and will be ignored
- You can set 'ignore danger', which has the same name as the dictionary key, and it will be ignored
- [Insert picture], which automatically inserts pictures, and simulates manual calls according to the context and type, and the number of insertions can be specified
- [rename enum], identify associated and primitive values
- 'Original value' can be set to refine the control range
- [Rename attribute], basic function, without too much description, advantages:
- Similar to OC [Rename attribute], identify inheritance chain and nested type, support storage and calculation of attributes, observers, wrappers, class attributes
- You can set the 'Model suffix' to filter by the suffix of the class name, which is convenient for filtering Model
- You can set the 'Model mapping', automatically insert the mapping relationship, and match the background data
- [Insert property], use calculated properties to wrap and call and replace the original properties
- Support storage and calculation of attributes, observers, wrappers, class attributes
- You can set the 'Model suffix' to filter by the suffix of the class name, the purpose: to avoid Model archiving or data transfer model failure
- [Rename method], the basic functions are renamed similar to other tools, without too much description, advantages:
- Can set 'parameter label', support hidden parameter label and trailing closure usage
- Identification of inheritance chain nested types, support for (class, struct, enum) static methods and instance methods, and optional chains, etc.
- [Insert method], encapsulate the return value of the original method and use the context to call additional associated methods, saying goodbye to "garbage code"
- [Modification method], use overloading technology to modify the function prototype and call the modified parameter
- [Rename global variables], smart noun substitution
- [Modify font] , randomly fine-tune the font used in the project, and identify macros
- [Modify color], randomly shift the color of UI controls in the project
- [UI layout offset], support Frame, SnapKit, common layout fine-tuning
- [Insert local variable], split single-line compound calls, change the execution order
- [Modify local variable], simulate manual encapsulation call, variable name association type (support nesting), advantages:
- The value of the local variable remains unchanged during operation. For details, see the summary table of supported types.
- Can be executed multiple times, the index x2 increases
- [Modify string], recognize single-line, multi-line, string interpolation, and extended string. After the modification, it can be freely combined by a variety of methods such as encryption and split character groups, and the comments of the original characters are reserved for easy inspection
- Set the'minimum length' filter
- You can also set the "effective number" to use together
- [Modify xib, storyboard], automatically insert the view, and modify the internal structure properties
- [Insert file], close to actual development (combined with network, storage, MVC, xib, etc., to ensure that the code has high relevance and practical significance), and strengthen contextual relevance. Can set 'file name prefix', set 'Target import' in the same way as OC
- [Insert text], generate common text files such as json, txt, plist, etc., and automatically high-related calls in the project (introduction of attributes, initialization, automatic destruction, etc.). Note: (under the project root path, the folder "other_xxx_text" will be generated, and the generated files will be automatically imported)
- [Rename class], the class name is not limited (for example: my, My), identify nested types and typealias, support class|struct|enum|protocol
- Can be set to'rename files with the same name'
- 'Prefix' can be set
Note: At present, the Swift and OC mixed project, the OC calling Swift part will not be processed for the time being, and will be optimized in the future.
Planning
Update iterations will be carried out in the following order
- Objective-C (95%), mainly to improve the versatility and stability of the tool, and strengthen the function
- Audio and video files are used less and will be added later
- Swift (95%), under development...
- Enhanced performance
- C++ (60%), under development...
- Method: Insert
- Property: modify
- Global variables: modify
- Lua (0%) is too specific, and it is temporarily closed. If users have this demand, we will refactor this part
- C# (0%), I don’t use much in actual projects, so I ranked last, depending on user needs before deciding
- Other functions:
Graphic introduction
Run the APP rendering, please read the tool usage tutorial in detail before use
Update log
v6.9.1 (2023.08.27)
- Optimize and modify the project, adapt to multiple targets, and the names contain each other, etc.
- Rename the class, actively avoid additional inserted files in the new mode
- Fix the small probability of NSArray being called NSMutableArray imprecisely
- Optimize multi-line special comment problem
- Part of the log output is adapted to Chinese
View more historical update records
Thanks for the feedback
shizu2014、myhonior、imbahong、tabier008
Link navigation
- Tool usage tutorial
- Software Questions and Answers (Q&A)
- OC[Modification method] Parameter type summary table
- OC[Modify local variables] Modify local variables-summary table of supported types
- OC[Rename multilingual] processing custom packaging method
- Swift[Modification method] Parameter type summary table