|
|
|
@ -16,7 +16,11 @@ namespace vm
|
|
|
|
|
SREGW,
|
|
|
|
|
|
|
|
|
|
LREGQ,
|
|
|
|
|
LREGDW
|
|
|
|
|
LREGDW,
|
|
|
|
|
|
|
|
|
|
LCONSTQ,
|
|
|
|
|
LCONSTBZXW,
|
|
|
|
|
LCONSTBSXDW
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum extention_t
|
|
|
|
@ -207,6 +211,7 @@ namespace vm
|
|
|
|
|
|
|
|
|
|
inline vm::handler::profile_t lregdw =
|
|
|
|
|
{
|
|
|
|
|
// MOVZX AL, [RSI]
|
|
|
|
|
// MOV RDX, [RAX + RDI]
|
|
|
|
|
// SUB RBP, 0x4
|
|
|
|
|
// MOV [RBP], EDX
|
|
|
|
@ -247,11 +252,108 @@ namespace vm
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline vm::handler::profile_t lconstq =
|
|
|
|
|
{
|
|
|
|
|
// MOV RAX, [RSI]
|
|
|
|
|
// SUB RBP, 8
|
|
|
|
|
// MOV [RBP], RAX
|
|
|
|
|
"LCONSTQ", LCONSTQ, 64,
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
// SUB RBP, 8
|
|
|
|
|
[](const zydis_decoded_instr_t& instr) -> bool
|
|
|
|
|
{
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_SUB &&
|
|
|
|
|
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[0].reg.value == ZYDIS_REGISTER_RBP &&
|
|
|
|
|
instr.operands[1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE &&
|
|
|
|
|
instr.operands[1].imm.value.u == 0x8;
|
|
|
|
|
},
|
|
|
|
|
// MOV [RBP], 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[1].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[1].reg.value == ZYDIS_REGISTER_RAX;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline vm::handler::profile_t lconstbzxw =
|
|
|
|
|
{
|
|
|
|
|
// MOV AL, [RSI]
|
|
|
|
|
// SUB RBP, 2
|
|
|
|
|
// MOV [RBP], AX
|
|
|
|
|
"LCONSTBZXW", LCONSTBZXW, 8,
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
// SUB RBP, 2
|
|
|
|
|
[](const zydis_decoded_instr_t& instr) -> bool
|
|
|
|
|
{
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_SUB &&
|
|
|
|
|
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[0].reg.value == ZYDIS_REGISTER_RBP &&
|
|
|
|
|
instr.operands[1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE &&
|
|
|
|
|
instr.operands[1].imm.value.u == 0x2;
|
|
|
|
|
},
|
|
|
|
|
// MOV [RBP], AX
|
|
|
|
|
[](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[1].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[1].reg.value == ZYDIS_REGISTER_AX;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline vm::handler::profile_t lconstbsxdw =
|
|
|
|
|
{
|
|
|
|
|
// CWDE
|
|
|
|
|
// SUB RBP, 4
|
|
|
|
|
// MOV [RBP], EAX
|
|
|
|
|
"LCONSTBSXDW", LCONSTBSXDW, 8,
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
// CWDE
|
|
|
|
|
[](const zydis_decoded_instr_t& instr) -> bool
|
|
|
|
|
{
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_CWDE;
|
|
|
|
|
},
|
|
|
|
|
// SUB RBP, 4
|
|
|
|
|
[](const zydis_decoded_instr_t& instr) -> bool
|
|
|
|
|
{
|
|
|
|
|
return instr.mnemonic == ZYDIS_MNEMONIC_SUB &&
|
|
|
|
|
instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[0].reg.value == ZYDIS_REGISTER_RBP &&
|
|
|
|
|
instr.operands[1].type == ZYDIS_OPERAND_TYPE_IMMEDIATE &&
|
|
|
|
|
instr.operands[1].imm.value.u == 0x4;
|
|
|
|
|
},
|
|
|
|
|
// MOV [RBP], EAX
|
|
|
|
|
[](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[1].type == ZYDIS_OPERAND_TYPE_REGISTER &&
|
|
|
|
|
instr.operands[1].reg.value == ZYDIS_REGISTER_EAX;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline std::vector<vm::handler::profile_t*> all =
|
|
|
|
|
{
|
|
|
|
|
&sregq, &sregdw, &sregw,
|
|
|
|
|
|
|
|
|
|
&lregq, &lregdw
|
|
|
|
|
&lregq, &lregdw,
|
|
|
|
|
|
|
|
|
|
&lconstq, &lconstbzxw, &lconstbsxdw
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|