also move the code that checks to see if the section is .obf to outside of routine_t so that you can re-use routine_t to decompose entire functions after running them through obfuscation passes....3.0
parent
9199d5bef7
commit
df0ba19093
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include <obf/transform/operation.hpp>
|
||||
|
||||
namespace theo::obf::transform {
|
||||
class and_op_t : public operation_t {
|
||||
explicit and_op_t()
|
||||
: operation_t([&](std::size_t val,
|
||||
std::uint32_t imm) -> std::size_t { return val & imm; },
|
||||
XED_ICLASS_AND) {}
|
||||
|
||||
public:
|
||||
static and_op_t* get() {
|
||||
static and_op_t obj;
|
||||
return &obj;
|
||||
}
|
||||
};
|
||||
} // namespace theo::obf::transform
|
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include <obf/transform/operation.hpp>
|
||||
|
||||
namespace theo::obf::transform {
|
||||
class or_op_t : public operation_t {
|
||||
explicit or_op_t()
|
||||
: operation_t([&](std::size_t val,
|
||||
std::uint32_t imm) -> std::size_t { return val | imm; },
|
||||
XED_ICLASS_OR) {}
|
||||
|
||||
public:
|
||||
static or_op_t* get() {
|
||||
static or_op_t obj;
|
||||
return &obj;
|
||||
}
|
||||
};
|
||||
} // namespace theo::obf::transform
|
@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <obf/transform/operation.hpp>
|
||||
|
||||
namespace theo::obf::transform {
|
||||
class rol_op_t : public operation_t {
|
||||
explicit rol_op_t()
|
||||
: operation_t(
|
||||
[&](std::size_t val, std::uint32_t imm) -> std::size_t {
|
||||
return _rotl64(val, (std::uint8_t)imm);
|
||||
},
|
||||
XED_ICLASS_ROL) {}
|
||||
|
||||
public:
|
||||
static rol_op_t* get() {
|
||||
static rol_op_t obj;
|
||||
return &obj;
|
||||
}
|
||||
};
|
||||
} // namespace theo::obf::transform
|
@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <obf/transform/operation.hpp>
|
||||
|
||||
namespace theo::obf::transform {
|
||||
class ror_op_t : public operation_t {
|
||||
explicit ror_op_t()
|
||||
: operation_t(
|
||||
[&](std::size_t val, std::uint32_t imm) -> std::size_t {
|
||||
return _rotr64(val, (std::uint8_t)imm);
|
||||
},
|
||||
XED_ICLASS_ROR) {}
|
||||
|
||||
public:
|
||||
static ror_op_t* get() {
|
||||
static ror_op_t obj;
|
||||
return &obj;
|
||||
}
|
||||
};
|
||||
} // namespace theo::obf::transform
|
@ -1,10 +1,18 @@
|
||||
#pragma once
|
||||
#include <obf/transform/add_op.hpp>
|
||||
#include <obf/transform/operation.hpp>
|
||||
|
||||
#include <obf/transform/add_op.hpp>
|
||||
#include <obf/transform/and_op.hpp>
|
||||
#include <obf/transform/or_op.hpp>
|
||||
#include <obf/transform/rol_op.hpp>
|
||||
#include <obf/transform/ror_op.hpp>
|
||||
#include <obf/transform/sub_op.hpp>
|
||||
#include <obf/transform/xor_op.hpp>
|
||||
|
||||
namespace theo::obf::transform {
|
||||
inline std::map<xed_iclass_enum_t, operation_t*> operations = {
|
||||
{XED_ICLASS_ADD, add_op_t::get()},
|
||||
{XED_ICLASS_SUB, sub_op_t::get()}};
|
||||
{XED_ICLASS_ADD, add_op_t::get()}, {XED_ICLASS_SUB, sub_op_t::get()},
|
||||
{XED_ICLASS_AND, and_op_t::get()}, {XED_ICLASS_OR, or_op_t::get()},
|
||||
{XED_ICLASS_ROL, rol_op_t::get()}, {XED_ICLASS_ROR, ror_op_t::get()},
|
||||
{XED_ICLASS_XOR, xor_op_t::get()}};
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include <obf/transform/operation.hpp>
|
||||
|
||||
namespace theo::obf::transform {
|
||||
class xor_op_t : public operation_t {
|
||||
explicit xor_op_t()
|
||||
: operation_t([&](std::size_t val,
|
||||
std::uint32_t imm) -> std::size_t { return val ^ imm; },
|
||||
XED_ICLASS_XOR) {}
|
||||
|
||||
public:
|
||||
static xor_op_t* get() {
|
||||
static xor_op_t obj;
|
||||
return &obj;
|
||||
}
|
||||
};
|
||||
} // namespace theo::obf::transform
|
Loading…
Reference in new issue