Theodosius v3.0
Jit linker, symbol mapper, and obfuscator
Public Member Functions
theo::theo_t Class Reference

the main class which encapsulates a symbol table, decomp, and recomp objects. This class is a bridge that connects all three: decomp, obf, recomp. More...

#include "theo.hpp"

Public Member Functions

 theo_t (std::vector< std::uint8_t > &lib, lnk_fns_t lnkr_fns, const std::string &&entry_sym)
 explicit constructor for theo class. More...
 
std::optional< std::uint32_t > decompose ()
 decomposes the lib file and return the number of symbols that are used. More...
 
std::uintptr_t compose ()
 compose the decomposed module. This will run obfuscation passes, the map and resolve symbols to each other. More...
 
std::uintptr_t resolve (const std::string &&sym)
 given the name of a symbol, it returns the address of where its mapped. More...
 

Detailed Description

the main class which encapsulates a symbol table, decomp, and recomp objects. This class is a bridge that connects all three: decomp, obf, recomp.

You will create an object of this type when using theo.

Definition at line 70 of file theo.hpp.

Constructor & Destructor Documentation

◆ theo_t()

theo::theo_t::theo_t ( std::vector< std::uint8_t > &  lib,
lnk_fns_t  lnkr_fns,
const std::string &&  entry_sym 
)
explicit

explicit constructor for theo class.

Parameters
liba vector of bytes consisting of a lib
lnkr_fns
entry_symthe name of the function which will be used as the entry point

Definition at line 34 of file theo.cpp.

37 : m_dcmp(lib, &m_sym_tbl),
38 m_recmp(&m_dcmp, {}, {}, {}),
39 m_entry_sym(entry_sym) {
40 m_recmp.allocator(std::get<0>(lnkr_fns));
41 m_recmp.copier(std::get<1>(lnkr_fns));
42 m_recmp.resolver(std::get<2>(lnkr_fns));
43}

Member Function Documentation

◆ compose()

std::uintptr_t theo::theo_t::compose ( )

compose the decomposed module. This will run obfuscation passes, the map and resolve symbols to each other.

Returns
returns the address of the entry point symbol

Definition at line 56 of file theo.cpp.

56 {
57 // run obfuscation engine on all symbols...
58 //
59 auto engine = obf::engine_t::get();
60 m_sym_tbl.for_each([&](decomp::symbol_t& sym) { engine->run(&sym); });
61
62 m_recmp.allocate();
63 m_recmp.resolve();
64 m_recmp.copy_syms();
65 return m_recmp.resolve(m_entry_sym.data());
66}

References theo::recomp::recomp_t::allocate(), theo::recomp::recomp_t::copy_syms(), theo::recomp::symbol_table_t::for_each(), theo::obf::engine_t::get(), and theo::recomp::recomp_t::resolve().

Referenced by main().

◆ decompose()

std::optional< std::uint32_t > theo::theo_t::decompose ( )

decomposes the lib file and return the number of symbols that are used.

Returns
optional amount of symbols that are used. no value if decomposition fails.

Definition at line 45 of file theo.cpp.

45 {
46 auto res = m_dcmp.decompose(m_entry_sym);
47 if (!res.has_value()) {
48 spdlog::error("failed to decompose...\n");
49 return {};
50 }
51
52 spdlog::info("decompose successful... {} symbols", res.value()->size());
53 return res.value()->size();
54}

References theo::decomp::decomp_t::decompose().

Referenced by main().

◆ resolve()

std::uintptr_t theo::theo_t::resolve ( const std::string &&  sym)

given the name of a symbol, it returns the address of where its mapped.

Parameters
symthe name of the symbol
Returns
the address of the symbol

Definition at line 68 of file theo.cpp.

68 {
69 auto val = m_sym_tbl.sym_from_hash(decomp::symbol_t::hash(sym));
70 if (!val.has_value())
71 return {};
72
73 return val.value()->allocated_at();
74}

References theo::decomp::symbol_t::hash(), and theo::recomp::symbol_table_t::sym_from_hash().


The documentation for this class was generated from the following files: