An executable file that runs a harmless program most of the time, but will run a different, hidden code if deployed on a specific target host.
See Creating a "Two-Face" Rust binary on Linux.
You need a Rust build environment for example from rustup.
A nightly toolchain is required (to support the ! "never" type).
The test-example script will build and run a complete example.
The following packages are provided in the repository:
evil_binary: an example of "hidden" binary, that will be run when host data matches what was set inexample/host.jsonharmless_binary: an example of "normal" binary that will be run on other hostsexample: the resulting "Two-Face" binary that will pack both previous binaries, and dispatch execution to either one depending on the hosttwoface: the library that provides the build-time and run-time features
