A WIP Obfuscator based on llvm14.
The name, Buer, comes from a character of Genshin Impact, also known as Nahida
Develop based on ndk-r25b, source can be found in ndk-r25b (Without commit history)
- Function Name Obfuscate
- Global Variable Name Obfuscate
-
Set LLVM_HOME environment variable or add following code to env.cmake
set(ENV{LLVM_HOME} /path/to/llvm)
-
Build it.
-
Patch llvm-project/llvm/CMakeLists.txt
Index: llvm/CMakeLists.txt IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt --- a/llvm/CMakeLists.txt (revision 73fc653f7946653a0ed13958fd8fa5391024bd46) +++ b/llvm/CMakeLists.txt (date 1670200126146) @@ -1094,6 +1094,8 @@ add_subdirectory(examples) endif() +add_subdirectory(../../Obfuscator Obfuscator) + if( LLVM_INCLUDE_TESTS ) if(EXISTS ${LLVM_MAIN_SRC_DIR}/projects/test-suite AND TARGET clang) include(LLVMExternalProjectUtils)
-
If you want to build static plugin, uncomment below in src/CMakeLists.txt
# set(LLVM_OBFUSCATOR_LINK_INTO_TOOLS ON)
-
Build LLVM
mkdir build && cd build cmake -G "Ninja" \ -DLLVM_ENABLE_PROJECTS="clang" \ -DCMAKE_BUILD_TYPE=Debug \ -DDEFAULT_SYSROOT=$(xcrun --show-sdk-path) \ -DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path) \ -DCMAKE_OSX_ARCHITECTURES="arm64" .. ninja
- Run
clang -v -fpass-plugin=libObfuscator.so -Xclang -load -Xclang libObfuscator.so test.cpp -o test
- Get real clang command, which starts with
"/path/to/clang" -cc1
https://stackoverflow.com/questions/25076625/lldb-not-stopping-on-my-breakpoint
Mostly Chinese only