基于开源 Obfuscator-LLVM方案

下载安装最新版本 Obfuscator-LLVM,目前3.6.1

$ git clone -b llvm-3.6.1 https://github.com/obfuscator-llvm/obfuscator.git

$ mkdir build

$ cd build

$ cmake -DCMAKE_BUILD_TYPE:String=Release ../obfuscator/

$ make -j5

将build/bin加入环境变量

$vim ~/.bash_profile

export PATH=/Users/dream/ollvm/build/bin:$PATH

$source ~/.bash_profile

配置Xcode,当前版本 7.1

基于现有插件修改如下:

$ cd /Applications/Xcode-beta.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/

$ sudo cp -r Clang\ LLVM\ 1.0.xcplugin/ Obfuscator.xcplugin

$ cd Obfuscator.xcplugin/Contents/

$ sudo plutil -convert xml1 Info.plist

$ sudo vim Info.plist

修改文件内容(修改前->修改后)

<string>com.apple.compilers.clang</string> -> <string>com.apple.compilers.obfuscator</string>

<string>Clang LLVM 1.0 Compiler Xcode Plug-in</string> -> <string>Obfuscator Xcode Plug-in</string>

接下来修改Info.plist

$ sudo plutil -convert binary1 Info.plist

$ cd Resources/

$ sudo mv Clang\ LLVM\ 1.0.xcspec Obfuscator.xcspec

$ sudo vim Obfuscator.xcspec

修改为:

Identifier = "com.apple.compilers.llvm.clang.1_0"; -> Identifier = "com.apple.compilers.llvm.obfuscator.3_6_1";

Name = "Apple LLVM 7.0"; -> Name = "Obfuscator 3.6.1";

Description = "Apple LLVM 7.0 compiler"; -> Description = "Obfuscator 3.6.1";

Vendor = Apple; -> Vendor = HEIG-VD;

Version = "7.0"; -> Version = "3.6.1";

ExecPath = "clang"; -> ExecPath = "/Users/dream/ollvm/build/bin/clang";

接下来修改显示:

$ cd English.lproj/

$ sudo mv Apple\ LLVM\ 7.0.strings "Obfuscator 3.6.1.strings"

$ sudo vim Obfuscator\ 3.6.1.strings

修改为:

"Name" = "Apple LLVM 7.0"; -> "Name" = "Obfuscator 3.6.1";

"Description" = "Apple LLVM 7.0 Compiler"; -> "Description" = "Obfuscator 3.6.1";

"Version" = "7.0"; -> "Version" = "3.6.1";

"Vendor" = "Apple"; -> "Vendor" = "HEIG-VD";

重启Xcode,Build Options里面,可以设置Compiler for C/C++/Objective-C为Obfuscator 3.6.1, 在CustomFlags中自行添加 flag:

-mllvm -sub -mllvm -fla -mllvm -bcf

解决几个问题

编译时出错,提示信息如下:

clang-3.6: error: unknown argument: '-gmodules'

clang-3.6: error: unknown argument: '-fembed-bitcode-marker'

Command /Users/dream/ollvm/build/bin/clang failed with exit code 1

在 Build Settings中搜索并修改:

-gmodules: Obfuscator 3.6.1 - Code Generation: Generate Debug Symbols: 原来yes,改成no

-fembed-bitcode-marker: Build Option: Enable Bitcode: 原来yes,改成no

补充

---

2016年10月28日18:56:14

目前该方法兼容最新版xcode:8.0

iOS 静态库代码混淆方案的更多相关文章

  1. iOS - 静态库的创建与使用

    在日常项目开发中,不论是为了两个公司项目上的业务交流还是为了减少项目的编译时间,有的时候我们会把项目中的私密内容打包成静态库,或者是把项目中变动较少一部分打包成静态库以便提高编译效率,那么下面我们就来 ...

  2. iOS静态库 ---iOS-Apple苹果官方文档翻译

    iOS静态库 ---iOS-Apple苹果官方文档翻译 •什么是库? 库是共享程序代码的方式,一般分为静态库和动态库.静态库与动态库的区别? 静态库:链接时完整地拷贝至可执行文件中,被多次使⽤用就为什 ...

  3. iOS 静态库,动态库与 Framework

    iOS 静态库,动态库与 Framework     静态库与动态库的区别 首先来看什么是库,库(Library)说白了就是一段编译好的二进制代码,加上头文件就可以供别人使用. 什么时候我们会用到库呢 ...

  4. IOS静态库

    如何在Xcode中创建C++静态库 http://jingyan.baidu.com/article/03b2f78c111fca5ea237ae26.html iOS 如何创建和使用静态库 http ...

  5. iOS静态库.a文件制作和导入使用

    iOS静态库.a文件制作: 1.新建Cocoa Touch Static Library工程 新建工程 - 选择iOS-FrameWork&Libary,选择 Cocoa Touch Stat ...

  6. iOS静态库的制作与引用

    [iOS静态库的制作与引用] 1.Configuring Exported Headers To configure which headers are exported to clients, se ...

  7. 判断IOS静态库(.a文件)是否支持模拟器和真机运行

    判断IOS静态库(.a文件)是否支持模拟器和真机运行 在mac终端下,进入到.a文件目录下,然后输入: lipo -info libMyAlertView.a Architectures in the ...

  8. iOS静态库转Framework动态库

    参考文章: iOS静态库(.a 和framework)  XCode6制作动态及静态Framework  说说iOS中静态库的开发  dyld: Library not loaded: @rpath/ ...

  9. iOS静态库及Framework 创建

    本文转自cocoachina,尊重作者的汗水. 讲述的非常透彻,有需要的朋友可以阅读实践.转载请注明出处 //=================以下留着备份==================// 在 ...

随机推荐

  1. 数据库恢复(database restore)之兵不血刃——半小时恢复客户数据库

    昨天,一个客户打打来电话,说他们的数据库坏了,不能用了,需要我帮助恢复下,这马上要放假了,居然出了这事儿,自己也不太喜欢恢复数据库这类,尤其是他们的数据库是个win上的库,但心里很清楚,客户比咱着急, ...

  2. rsyslog+loganalyzer远程日志系统搭建教程(CentOS6.8)

    一.说明 本文主要是对“CentOS 6.7搭建Rsyslog日志服务器”进行整理,同时在本地进行环境搭建,验证在CentOS6.8上的正确性. 二.安装配置rsyslog 1.清空iptables关 ...

  3. Linux CPU信息和使用情况查看(CentOS)

    一.CPU信息查看 cat /proc/cpuinfo| grep "physical id"| sort -u | wc -l #查看是物理CPU个数,-u和uniq都是去重作用 ...

  4. 解决libvlc_media_player_stop时死锁的方法

    转自:http://www.jiazi.cn/blog/?id=56 扩散该解决方法 最近需要使用VLC控件来做一个简单的流媒体播放器,在实施过程中,发现在调用libvlc_media_player_ ...

  5. Ubuntu 下安装Go语言

    https://blog.csdn.net/ceciiiilia/article/details/71483221 (一)从官网安装Go语言 1.对于64位Linux: $ wget https:// ...

  6. powerdesidgner1

    '******************************************************************************'* File: comment2name ...

  7. Generative Model 与 Discriminative Model

      [摘要]    - 生成模型(Generative Model) :无穷样本==>概率密度模型 = 产生模型==>预测    - 判别模型(Discriminative Model): ...

  8. POJ 1006 生理周期(中国剩余定理)

    POJ 1006 生理周期 分析:中国剩余定理(注意结果要大于d即可) 代码: #include<iostream> #include<cstdio> using namesp ...

  9. do_bootrk

    1. LMB (logical memory blocks) lmb为uboot下的一种内存管理机制,用于管理镜像的内存.lmb所记录的内存信息最终会传递给kernel.在/include/lmb.h ...

  10. JNA调用DLL(入门):让你一眼就学会

    DLL(Dynamic Link Library)文件,是基于C语言的动态链接库文件,就是一些封装好的方法,打成dll格式包,供别人调用 JNA是一种能够使Java语言使调用DLL的一种技术, 首先, ...