All Projects → CoderMJLee → Mjcodeobfuscation

CoderMJLee / Mjcodeobfuscation

Licence: mit
一个用于代码混淆和字符串加密的Mac小Demo

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Mjcodeobfuscation

ColonialObfuscator
Java Obfuscator in Beta
Stars: ✭ 23 (-94.83%)
Mutual labels:  obfuscation, obfuscator
Alom
Alom PHP Obfuscator / Encoder can protect from your codes
Stars: ✭ 50 (-88.76%)
Mutual labels:  obfuscation, obfuscator
code-obfuscation
一款iOS代码混淆工具(A code obfuscation tool for iOS.)
Stars: ✭ 32 (-92.81%)
Mutual labels:  obfuscation, obfuscator
Vetric
WIP Java/Kotlin obfuscator
Stars: ✭ 39 (-91.24%)
Mutual labels:  obfuscation, obfuscator
ConfuserEx-Mod-By-Bed
Beds Protector | Best free obfuscation out right now
Stars: ✭ 297 (-33.26%)
Mutual labels:  obfuscation, obfuscator
Lua-Obfuscator
A Lua Obfuscator made for Roblox, but should work on most Lua applications
Stars: ✭ 84 (-81.12%)
Mutual labels:  obfuscation, obfuscator
Powershell-Obfuscator
Powerful script for logical obfuscation of powershell scripts
Stars: ✭ 27 (-93.93%)
Mutual labels:  obfuscation, obfuscator
Obfuscator Class
👨‍💻 Simple and effective Obfuscator PHP class (this is not a stupid base64 encoding script, but a real and effective obfuscation script)
Stars: ✭ 202 (-54.61%)
Mutual labels:  obfuscation, obfuscator
obfuscator
Obfuscate PHP source files with basic XOR encryption in userland code at runtime.
Stars: ✭ 20 (-95.51%)
Mutual labels:  obfuscation, obfuscator
data obfuscation
Data Obfuscation for C/C++ Code Based on Residue Number Coding (RNC)
Stars: ✭ 15 (-96.63%)
Mutual labels:  obfuscation, obfuscator
Mosey
A free and open source java bytecode obfuscator, experimental
Stars: ✭ 43 (-90.34%)
Mutual labels:  obfuscation, obfuscator
UniObfuscator
Java obfuscator that hides code in comment tags and Unicode garbage by making use of Java's Unicode escapes.
Stars: ✭ 40 (-91.01%)
Mutual labels:  obfuscation, obfuscator
AutoIt-Obfuscator
AutoIt Obfuscator lets you protect AutoIt script source code against analysis, reverse engineering & decompilation using advanced obfuscation techniques and polymorphic encryption.
Stars: ✭ 31 (-93.03%)
Mutual labels:  obfuscation, obfuscator
Forsaken
One of the best Python3.9 obfuscators.
Stars: ✭ 94 (-78.88%)
Mutual labels:  obfuscation, obfuscator
Radon
Experimental Java bytecode obfuscator
Stars: ✭ 243 (-45.39%)
Mutual labels:  obfuscation, obfuscator
gnirts
Obfuscate string literals in JavaScript code.
Stars: ✭ 65 (-85.39%)
Mutual labels:  obfuscation, obfuscator
Yguard
The open-source Java obfuscation tool working with Ant and Gradle by yWorks - the diagramming experts
Stars: ✭ 130 (-70.79%)
Mutual labels:  obfuscation, obfuscator
Stringobfuscator
Simple header-only compile-time library for string obfuscation (C++14)
Stars: ✭ 164 (-63.15%)
Mutual labels:  obfuscation, obfuscator
js-confuser
JS-Confuser is a JavaScript obfuscation tool to make your programs *impossible* to read.
Stars: ✭ 38 (-91.46%)
Mutual labels:  obfuscation, obfuscator
idy
👓 An ID obfuscator for ActiveRecord
Stars: ✭ 15 (-96.63%)
Mutual labels:  obfuscation, obfuscator

MJCodeObfuscation

一个用于代码混淆和字符串加密的Mac小Demo

  • 主要是利用libclang解析扫描源代码的语法树,搜索出所有的类名、方法名、字符串
  • 语法树解析的核心代码是:MJCodeObfuscation/Classes/Tool/MJClangTool.m,比较简单,不复杂
  • 这仅仅是个小Demo,大家可以根据自己需要去调整代码,比如混淆协议、属性等等,可以自行添加实现
  • 更多混淆相关,可以参考开源项目

代码混淆

将需要混淆的类名、方法名生成随机字符串的宏定义

  • 假设要对MJPerson的类名、方法名进行混淆
@interface MJPerson : NSObject
- (void)mj_run;
- (void)mj_setupName:(NSString *)name mj_no:(int)no mj_age:(int)age;
@end
    
@implementation MJPerson
- (void)mj_run {
    NSLog(@"%s", __func__);
}

- (void)mj_setupName:(NSString *)name mj_no:(int)no mj_age:(int)age {
    NSLog(@"%s - %@ %d %d", __func__, name, no, age);
}
@end
  • 点击【1.选择目录】
    • 选择需要扫描的代码目录
  • 点击【2.开始混淆】
    • 会扫描所选择的目录以及子目录下的所有代码文件
    • 根据前缀(下图实例用的前缀是MJmj_)搜索出需要混淆的类名、方法名

  • 最后会生成一个宏定义头文件MJCodeObfuscation.h
#define mj_run OmWJoTZfCqoPshvr
#define MJPerson egnjoOFDrFiQVRgr
#define mj_setupName HrZLzcgSoPhwMBwW
#define mj_age reXYcdSKKEUSMalJ
#define mj_no mHEQViTuoOvRtMuB
  • 点击【打开目录】
    • 可以打开刚才所生成的宏定义头文件的所在目录

  • 在项目的PCH文件中导入刚才的头文件
#ifndef PrefixHeader_pch
#define PrefixHeader_pch

#import "MJCodeObfuscation.h"

#endif /* PrefixHeader_pch */
  • 最后的效果
MJPerson *person = [[MJPerson alloc] init];
[person mj_run];
[person mj_setupName:@"jack" mj_no:20 mj_age:21];

// 打印结果
-[egnjoOFDrFiQVRgr OmWJoTZfCqoPshvr]
-[egnjoOFDrFiQVRgr HrZLzcgSoPhwMBwW:mHEQViTuoOvRtMuB:reXYcdSKKEUSMalJ:] - jack 20 21

字符串加密(方式1)

仅仅是将字符串进行了一个简单的异或处理(开发者可以自行制定加密算法)

  • 假设想对以下的C、OC字符串进行加密
NSString *str1 = @"小码哥mj123go";
const char *str2 = "小码哥mj123go";
NSLog(@"%@ %s", str1, str2);
  • 点击【字符串加密】
    • 弹出字符串加密窗口
  • 输入需要加密的字符串,点击【加密】

  • 加密后的内容如下所示,添加到项目中去(根据需要,声明和定义可以分别放.h和.m)
/* 小码哥mj123go */
extern const MJEncryptStringData * const _761622619;

/* 小码哥mj123go */
const MJEncryptStringData * const _761622619 = &(MJEncryptStringData){
    .factor = (char)-100,
    .value = (char []){121,44,19,123,60,29,121,15,57,-15,-10,-83,-82,-81,-5,-13,0},
    .length = 16
};
  • 由于上面代码依赖MJEncryptStringData结构,所以需要将MJEncryptString目录的内容加入到项目中

  • 在项目中的使用
#import "MJEncryptString.h"

NSString *str1 = mj_OCString(_761622619);
const char *str2 = mj_CString(_761622619);
NSLog(@"%@ %s", str1, str2);

// 打印结果如下
小码哥mj123go 小码哥mj123go

字符串加密(方式2)

  • 点击【1.选择目录】
    • 选择需要扫描的代码目录
  • 点击【2.开始加密】
    • 将开始自动扫描目录以及子目录下的所有字符串(C、OC字符串)

  • 加密完毕后,会自动生成一个MJEncryptString目录
    • 将这个目录添加到项目中
    • 并在PCH文件中导入头文件MJEncryptStringData.h(便于整个项目中共享使用加密的字符串)
#ifndef PrefixHeader_pch
#define PrefixHeader_pch

#import "MJEncryptStringData.h"

#endif /* PrefixHeader_pch */
  • MJEncryptStringData.h文件内容如下所示
    • 它将项目里的"%@ %s""小码哥mj123go"字符串都进行了加密
#ifndef MJEncryptStringData_h
#define MJEncryptStringData_h
#include "MJEncryptString.h"
/* %@ %s */
extern const MJEncryptStringData * const _1302706645;
/* 小码哥mj123go */
extern const MJEncryptStringData * const _761622619;
#endif
  • 在项目中的使用
NSString *str1 = mj_OCString(_761622619);
const char *str2 = mj_CString(_761622619);
NSLog(@"%@ %s", str1, str2);

// 打印结果如下
小码哥mj123go 小码哥mj123go
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].