Files in the top-level directory from the latest check-in
- .fossil-settings
- examples
- LICENSES
- BCF.cpp
- BCF.h
- CMakeLists.txt
- FLA.cpp
- FLA.h
- PassManager.cpp
- Random.h
- README.md
- SUB.cpp
- SUB.h
- Viz.cpp
- Viz.h
Hellscape
Hellscape is a GCC plugin for obfuscating its IR GIMPLE, inspired by the Obfuscator-LLVM paper by Pascal Junod et al.
Installation
Currently only GNU/Linux is supported. You need CMake,
GCC >= 13.1 (with plugins enabled) and GMP. To install to $prefix, run
cmake -B build --install-prefix $prefix
cmake --build build --parallel
cmake --install build --parallel
Usage
gcc -fplugin=$prefix/share/hellscape.so \
[-fplugin-arg-hellscape-viz=DIR] \
[-fplugin-arg-hellscape-seed=HEX] \
[-fplugin-arg-hellscape-sub] \
[-fplugin-arg-hellscape-bcf] \
[-fplugin-arg-hellscape-fla] \
...
See examples for tutorials.
Adding a custom pass
If you ever get stuck, reference one of the existing passes, they're well documented. That being said, the general idea is as follows:
- Create a new pass class, e.g.:
ExamplePass, under the fileEX.cppandEX.h, - Copy the contents of
SUB.hand re-name the pass data, name of the pass as well as the constructor, - Create a function
executein the corresponding C++ file, and complete your pass, - Register it under the
PassManagerby adding a new option,register_pass_infoandregister_callback, as necessary, - Submit the pass for review.
Note that for as pass to be accepted upstream, it must compile for a gcc build that has --enable-checking=yes,rtl,tree added. (You will need to re-build gcc for your target architecture with --enable-checking.)
Additionally: If you experience crashes when developing your plug-in, you can debug them by passing -wrapper gdb,--args to gcc. (Run gcc in gdb, effectively.)
Copying
Hellscape is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.