使用ollvm混淆你的源码
时间: 2023-11-01 09:11:48 浏览: 53
OLLVM是一种基于LLVM的混淆器,可以对源代码进行混淆,使其难以逆向和分析。下面是使用OLLVM混淆源码的步骤:
1. 安装OLLVM
首先需要安装OLLVM,可以从官方网站(https://github.com/obfuscator-llvm/obfuscator)下载源代码,然后编译安装。
2. 编写源代码
编写需要混淆的源代码,例如:
```
#include <stdio.h>
int main() {
int a = 10;
int b = 20;
int c = a + b;
printf("c = %d\n", c);
return 0;
}
```
3. 使用OLLVM混淆源代码
使用OLLVM混淆源代码可以通过以下命令:
```
clang -Xclang -load -Xclang /path/to/obfuscator.so -mllvm -obfuscator -o obfuscated.out source.c
```
其中,`/path/to/obfuscator.so`是OLLVM的插件,`source.c`是需要混淆的源代码文件,`obfuscated.out`是混淆后的输出文件。
4. 查看混淆后的源代码
使用反编译工具查看混淆后的源代码,可以看到代码已经被混淆,变得难以理解和分析,例如:
```
#include <stdio.h>
int main() {
int _0_hM5 = 10;
int _1_hM5 = 20;
int _2_hM5 = _0_hM5 + _1_hM5;
printf("c = %d\n", _2_hM5);
return 0;
}
```
可以看到变量名和表达式已经被混淆,使得代码变得更加复杂和难以理解。