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.
85 lines
2.7 KiB
85 lines
2.7 KiB
3 years ago
|
#include "../../include/vmprofiler.hpp"
|
||
|
|
||
|
namespace vm
|
||
|
{
|
||
|
namespace handler
|
||
|
{
|
||
|
namespace profile
|
||
|
{
|
||
|
vm::handler::profile_t divq =
|
||
|
{
|
||
|
// MOV RDX, [RBP]
|
||
|
// MOV RAX, [RBP+0x8]
|
||
|
// DIV [RBP+0x10]
|
||
|
// MOV [RBP+0x8], RDX
|
||
|
// MOV [RBP+0x10], RAX
|
||
|
// PUSHFQ
|
||
|
// POP [RBP]
|
||
|
"DIVQ", DIVQ, NULL,
|
||
|
{
|
||
|
{
|
||
|
// MOV RDX, [RBP]
|
||
|
[](const zydis_decoded_instr_t& instr) -> bool
|
||
|
{
|
||
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||
|
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||
|
instr.operands[0].reg.value == ZYDIS_REGISTER_RDX &&
|
||
|
instr.operands[1].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||
|
instr.operands[1].mem.base == ZYDIS_REGISTER_RBP;
|
||
|
},
|
||
|
// MOV RAX, [RBP+0x8]
|
||
|
[](const zydis_decoded_instr_t& instr) -> bool
|
||
|
{
|
||
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||
|
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||
|
instr.operands[0].reg.value == ZYDIS_REGISTER_RAX &&
|
||
|
instr.operands[1].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||
|
instr.operands[1].mem.base == ZYDIS_REGISTER_RBP &&
|
||
|
instr.operands[1].mem.index == 0x8;
|
||
|
},
|
||
|
// DIV [RBP+0x10]
|
||
|
[](const zydis_decoded_instr_t& instr) -> bool
|
||
|
{
|
||
|
return instr.mnemonic == ZYDIS_MNEMONIC_DIV &&
|
||
|
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||
|
instr.operands[0].mem.base == ZYDIS_REGISTER_RBP &&
|
||
|
instr.operands[0].mem.index == 0x10;
|
||
|
},
|
||
|
// MOV [RBP+0x8], RDX
|
||
|
[](const zydis_decoded_instr_t& instr) -> bool
|
||
|
{
|
||
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||
|
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||
|
instr.operands[0].mem.base == ZYDIS_REGISTER_RBP &&
|
||
|
instr.operands[0].mem.index == 0x8 &&
|
||
|
instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||
|
instr.operands[1].reg.value == ZYDIS_REGISTER_RDX;
|
||
|
},
|
||
|
// MOV [RBP+0x10], RAX
|
||
|
[](const zydis_decoded_instr_t& instr) -> bool
|
||
|
{
|
||
|
return instr.mnemonic == ZYDIS_MNEMONIC_MOV &&
|
||
|
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||
|
instr.operands[0].mem.base == ZYDIS_REGISTER_RBP &&
|
||
|
instr.operands[0].mem.index == 0x10 &&
|
||
|
instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
||
|
instr.operands[1].reg.value == ZYDIS_REGISTER_RAX;
|
||
|
},
|
||
|
// PUSHFQ
|
||
|
[](const zydis_decoded_instr_t& instr) -> bool
|
||
|
{
|
||
|
return instr.mnemonic == ZYDIS_MNEMONIC_PUSHFQ;
|
||
|
},
|
||
|
// POP [RBP]
|
||
|
[](const zydis_decoded_instr_t& instr) -> bool
|
||
|
{
|
||
|
return instr.mnemonic == ZYDIS_MNEMONIC_POP &&
|
||
|
instr.operands[0].type == ZYDIS_OPERAND_TYPE_MEMORY &&
|
||
|
instr.operands[0].mem.base == ZYDIS_REGISTER_RBP;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
}
|