preface

I have been doing iOS development for several years. I usually pack up my projects and upload them to Appstore directly after finishing them, and then put them on the shelf. But recently, the customer side has raised the requirement of code security. Said to do code obfuscation, this aspect of work has never been touched before. Then I looked it up on the Internet, and it turned out that there were a lot of apps that had code obfuscations. It seems that I am stuck in a rut……

The cause of

Using classdump to dump the original program, you can dump all the function information of the source program: all the function types of the source program and all variables are leaked. In this way, the attacker, the hacker, understands the structure of the program and can reverse it. Because in the project, our variable or function names are certain readability, such as related to the userName, there will be userName in it, and related to the passWord, there will be passWord, this definition is for our own code more readable, when we modify more convenient. But we believe that with this definition, we just want to make it easier for ourselves, we don’t want to make it easier for hackers to crack our APP. The bottom line: “Will list all the methods and variables in your project.”

Get confused:

1.

Before we confuse the code, we need to add two files to our project :confuse.sh&func.list We open our terminal command line




touch confuse.sh
func.list


2

At this point, we can click on our confuse.sh file and see that it is empty. We need to fill in some code. To paste this code into our own confuse.sh file, click on this link

3

Add one to your project. PCH file. If you say you don’t know how to add.pCH, that’s fine. After successfully adding the.pch file, we need to add the code #import”codeObfuscation. H “to the.pch file. Is that right?

Build Phases
+
New Run Script Phase
confuse.sh

4

Then the next thing is how to code the confusion.

At this point you will find a class (.h. m) file that you want to confuse. Copy the code you want to confuse and paste it into our func.list file. Then compile it and switch to this interface

5

Finish work, Over!!!!!

6

Note: this method can only be used to confuse classes with.m.h. Static libraries with.h files cannot be used to confuse static libraries with.h files

7

Portal:Objective-c code obfuscation