|
|
|
#pragma once
|
|
|
|
#include <algorithm>
|
|
|
|
#include <obf/pass.hpp>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace theo::obf {
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// singleton obfuscation engine class. this class is responsible for keeping
|
|
|
|
/// track of the registered passes and the order in which to execute them.
|
|
|
|
/// </summary>
|
|
|
|
class engine_t {
|
|
|
|
explicit engine_t(){};
|
|
|
|
|
|
|
|
public:
|
|
|
|
/// <summary>
|
|
|
|
/// get the singleton object of this class.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>the singleton object of this class.</returns>
|
|
|
|
static engine_t* get();
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// add a pass to the engine. the order in which you call this function
|
|
|
|
/// matters as the underlying data structure that contains the passes is a
|
|
|
|
/// vector.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="pass">a pointer to the pass in which to add to the
|
|
|
|
/// engine.</param>
|
|
|
|
void add_pass(pass_t* pass);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// run all the passes on the symbol. this function will only run a pass if
|
|
|
|
/// the symbol is the same type as the pass requires.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sym">symbol to run all passes on.</param>
|
|
|
|
void run(decomp::symbol_t* sym);
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<pass_t*> passes;
|
|
|
|
};
|
|
|
|
} // namespace theo::obf
|