Encode all hard code string in objective-c project. Of course, you can decode the changes too.
- (1) put files in /oc-class into your project
- (2) pipenv install
- (3) start encode/decode action by command:
python param1 --encode/--decode param2
param1: path of this script
param2: root path of project
- (4) import
NSString+BAHCCategory.h
andBAHCDefenitions.h
globally
Also, you can use option --encrypt/--decrypt to encrypt/decrypt individual content
You can set rules of exception by change these vlaues in BAHardCodeEncoder.py
Exception_File_Names
: file nameException_File_Prefix
: file name prefixException_File_Suffix
: file name suffixException_Folder_Names
: folder nameException_Folder_Prefix
: folder name prefixException_Folder_Suffix
: folder name suffixException_String_Format_Specifiers
: string format specifiers like%@
. If string contain one of these, then shall skip it
You must skip these files: NSString+BAHCCategory.h
, NSString+BAHCCategory.m
, BAHCDefenitions.h
, GTMBase64.h
, GTMBase64.m
, GTMDefines.h
You should change Key_salt
in BAHardCodeEncoder.py
every time, to keep encoded content on code file alaways different
The default encode logic is AES, you can just change key and iv of it, or rewrite encode logic
Change AES_key
and AES_iv
in BAHardCodeEncoder.py
Length of Key and iv for AES must be a multiple of 16
You can make it by rewrite function __encryptFunc
in BAHardCodeEncoder.py
GitHub Link: https://github.com/BenArvin/BAHardCodeEncoder