Skip to content

Commit e40efd2

Browse files
committed
Initial commit
0 parents  commit e40efd2

21 files changed

+3669
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build
2+
*.ll
3+
*.o
4+
test/test

CMakeLists.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cmake_minimum_required(VERSION 3.4)
2+
3+
find_package(LLVM REQUIRED CONFIG)
4+
add_definitions(${LLVM_DEFINITIONS})
5+
include_directories(${LLVM_INCLUDE_DIRS})
6+
link_directories(${LLVM_LIBRARY_DIRS})
7+
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
8+
include(HandleLLVMOptions)
9+
include(AddLLVM)
10+
11+
add_subdirectory(obfuscator-llvm)

LICENSE.TXT

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
==============================================================================
2+
Obfuscator-LLVM Release License
3+
==============================================================================
4+
University of Illinois/NCSA
5+
Open Source License
6+
7+
Copyright (c) 2014 Haute Ecole d'Ingénierie et de Gestion du Canton de Vaud (HEIG-VD). All rights reserved.
8+
9+
Developed by:
10+
11+
Obfuscator-LLVM Team
12+
13+
Haute-Ecole d'Ingénierie et de Gestion du Canton de Vaud (HEIG-VD), a part
14+
of the University of Applied Sciences and Arts Western Switzerland (HES-SO)
15+
16+
http://o-llvm.org
17+
18+
Permission is hereby granted, free of charge, to any person obtaining a copy of
19+
this software and associated documentation files (the "Software"), to deal with
20+
the Software without restriction, including without limitation the rights to
21+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
22+
of the Software, and to permit persons to whom the Software is furnished to do
23+
so, subject to the following conditions:
24+
25+
* Redistributions of source code must retain the above copyright notice,
26+
this list of conditions and the following disclaimers.
27+
28+
* Redistributions in binary form must reproduce the above copyright notice,
29+
this list of conditions and the following disclaimers in the
30+
documentation and/or other materials provided with the distribution.
31+
32+
* Neither the names of the Obfuscator-LLVM Team, the Haute Ecole d'Ingénierie
33+
et de Gestion du Canton de Vaud (HEIG-VD), the University of Applied Sciences
34+
and Arts Western Switzerland (HES-SO) nor the names of its contributors
35+
may be used to endorse or promote products derived from this Software
36+
without specific prior written permission.
37+
38+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
40+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
41+
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
43+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
44+
SOFTWARE.

README.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Obfuscator-LLVM
2+
3+
Obfuscator-LLVM is a project initiated in June 2010 by the information security group of the University of Applied Sciences and Arts Western Switzerland of Yverdon-les-Bains ([HEIG-VD](http://www.heig-vd.ch/international)). The aim of this project is to provide increased software security through code obfuscation and tamper-proofing. As the obfuscator currently mostly works at the Intermediate Representation (IR) level, the tool is compatible with all programming languages (C, C++, Objective-C, Ada and Fortran) and target platforms (x86, x86-64, PowerPC, PowerPC-64, ARM, Thumb, SPARC, Alpha, CellSPU, MIPS, MSP430, SystemZ, and XCore) currently supported by LLVM. The initially published source code and research paper can be found [here](https://github.com/obfuscator-llvm/obfuscator). This fork makes the obfuscator available as an extension to most available LLVM installations. It doesn't require any changes to existing LLVM installations, unlike the project published by the authors of Obfuscator-LLVM.
4+
5+
## Features
6+
7+
Here is a list of the different features that are currently available:
8+
9+
* [Instructions Substitution](https://github.com/obfuscator-llvm/obfuscator/wiki/Instructions-Substitution) `-mllvm -sub`
10+
* [Bogus Control Flow](https://github.com/obfuscator-llvm/obfuscator/wiki/Bogus-Control-Flow) `-mllvm -bcf`
11+
* [Control Flow Flattening](https://github.com/obfuscator-llvm/obfuscator/wiki/Control-Flow-Flattening) `-mllvm -fla`
12+
* [Functions annotations](https://github.com/obfuscator-llvm/obfuscator/wiki/Functions-annotations)
13+
14+
## Building
15+
16+
To build this project it's required to have Clang 3.3+, LLVM 3.3+ and CMake 3.4+ installed. On Ubuntu 18.04+ you can use `sudo apt install clang-7 llvm-7-dev cmake` to install the required softwre. To compile the obfuscator simply run `./build.sh` or execute the following commands in this directory:
17+
18+
```bash
19+
mkdir -p build
20+
cd build
21+
cmake ../
22+
cmake --build .
23+
```
24+
25+
## Usage
26+
27+
Adding the obfuscator to existing projects which use an LLVM compiler is very easy. For the Make (or rather Makefile) buildsystem simply adjust the small example below to fit your needs:
28+
29+
```makefile
30+
OBFUSCATOR_FLAGS=-Xclang -load -Xclang /path/to/ObfuscatorLLVM.so
31+
32+
# ... your targets
33+
34+
tool: tool.c utils.c helper.c clangtool.so
35+
$(CC) $(CXXFLAGS) $(OBFUSCATOR_FLAGS) -O0 -o test test.c
36+
```
37+
38+
You can also integrate the obfuscator to your existing CMake projects for any project that uses LLVM:
39+
40+
```cmake
41+
target_compile_options(<name> PRIVATE -Xclang -load -Xclang /path/to/ObfuscatorLLVM.so)
42+
```
43+
44+
## Testing
45+
46+
The [Himeno benchmark](http://accc.riken.jp/en/supercom/documents/himenobmt/) is used to test the effectiveness of the obfuscation techniques. To execute the obfuscator test run `./test.sh`. This will generate LLVM IR from `./test/test.c`, apply obfuscations on it and run the obfuscated program. The obfuscated LLVM IR can be found in `./test/test_obfuscated.ll` and the non-obfuscated LLVM IR in `./test/test.ll`.

build.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
mkdir -p build
4+
cd build
5+
cmake ../
6+
cmake --build .

0 commit comments

Comments
 (0)