You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
#pragma once
|
|
#include <Zydis/Utils.h>
|
|
#include <Zydis/Zydis.h>
|
|
#include <vector>
|
|
#include <xmmintrin.h>
|
|
|
|
using u8 = unsigned char;
|
|
using u16 = unsigned short;
|
|
using u32 = unsigned int;
|
|
using u64 = unsigned long long;
|
|
using u128 = __m128;
|
|
|
|
using zydis_decoded_instr_t = ZydisDecodedInstruction;
|
|
using zydis_register_t = ZydisRegister;
|
|
using zydis_mnemonic_t = ZydisMnemonic;
|
|
|
|
struct zydis_instr_t
|
|
{
|
|
zydis_decoded_instr_t instr;
|
|
std::vector< u8 > raw;
|
|
std::uintptr_t addr;
|
|
};
|
|
|
|
using zydis_routine_t = std::vector< zydis_instr_t >;
|
|
|
|
namespace vm
|
|
{
|
|
namespace util
|
|
{
|
|
namespace reg
|
|
{
|
|
// converts say... AL to RAX...
|
|
zydis_register_t to64( zydis_register_t reg );
|
|
bool compare( zydis_register_t a, zydis_register_t b );
|
|
} // namespace reg
|
|
|
|
void print( zydis_routine_t &routine );
|
|
void print( const zydis_decoded_instr_t &instr );
|
|
bool is_jmp( const zydis_decoded_instr_t &instr );
|
|
|
|
bool flatten( zydis_routine_t &routine, std::uintptr_t routine_addr, bool keep_jmps = false );
|
|
void deobfuscate( zydis_routine_t &routine );
|
|
} // namespace util
|
|
} // namespace vm
|