基于开源 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. Homebrew 备忘

    每次都搜,写篇博客记录以备后续查看. 安装 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew ...

  2. Vue中 computed 和 methods的区别

    涉及到计算部分的时候,计算属性是基于它们的依赖进行缓存的,如果说值不变,那么它就不会去重新执行,只有当值发生了改变,它才会去重新执行一次,其它时候它都是缓存的.而方法则会反复计算处理.二者之间的差距就 ...

  3. 把旧系统迁移到.Net Core 2.0 日记 (17) --多租户和SoftDelete

    在EF Core 2.0版本中出现了全局过滤新特性即HasQueryFilter,它出现的意义在哪里?能够解决什么问题呢? 通过HasQueryFilter方法来创建过滤器能够允许我们对访问特定数据库 ...

  4. laravel Eloquent 查询数据库判断获取的内容是否为空

    原文地址:https://www.cnblogs.com/love-snow/articles/7205338.html 在使用 Laravel Eloquent 模型时,我们要判断取出的结果集是否为 ...

  5. Python 自然语言处理笔记(一)

    一. NLTK的几个常用函数 1. Concordance 实例如下: >>> text1.concordance("monstrous") Displaying ...

  6. 用linux命令连接无线网络-转载

    首先是用到的工具: ifconfigrouteiwlistiwconfig 后两个是无线工具 从现在开始,按我的步骤做 (##后面的是说明部分) 1.开启无线,如果是笔记本,开启无线开关,或用Fn+F ...

  7. struts访问

    struts基本工程结构: 1. struts.xml支持语法提示;2. struts.xml配置常量, 用来覆盖struts.properties中的默认常量配置  一般情况下, 这个配置放在str ...

  8. C++11新特性,bind,基于对象

    body, table{font-family: 微软雅黑; font-size: 10pt} table{border-collapse: collapse; border: solid gray; ...

  9. vue-6-事件处理

    <div id="example-2"> <button v-on:click="greet">Greet</button> ...

  10. 七. Python基础(7)--文件的读写

    七. Python基础(7)--文件的读写 1 ● 文件读取的知识补充 f = open('file', encoding = 'utf-8') content1 = f.read() content ...