diff --git a/include/vmprofiler.hpp b/include/vmprofiler.hpp index 773331f..927809d 100644 --- a/include/vmprofiler.hpp +++ b/include/vmprofiler.hpp @@ -25,6 +25,14 @@ namespace vm LCONSTWSXQ, LCONSTDW, + READQ, + READDW, + READW, + + WRITEQ, + WRITEDW, + WRITEW, + PUSHVSP, ADDQ, @@ -32,6 +40,8 @@ namespace vm NANDQ, + JMP, + VMEXIT }; @@ -643,6 +653,55 @@ namespace vm } }; + inline vm::handler::profile_t jmp = + { + // MOV ESI, [RBP] + // ADD RSI, RAX + // MOV RBX, RSI + // ADD RSI, [RBP] + "JMP", JMP, NULL, + { + { + // MOV ESI, [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_ESI && + instr.operands[1].type == ZYDIS_OPERAND_TYPE_MEMORY && + instr.operands[1].mem.base == ZYDIS_REGISTER_RBP; + }, + // ADD RSI, RAX + [](const zydis_decoded_instr_t& instr) -> bool + { + return instr.mnemonic == ZYDIS_MNEMONIC_ADD && + instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER && + instr.operands[0].reg.value == ZYDIS_REGISTER_RSI && + instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER && + instr.operands[1].reg.value == ZYDIS_REGISTER_RAX; + }, + // MOV RBX, RSI + [](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_RBX && + instr.operands[1].type == ZYDIS_OPERAND_TYPE_REGISTER && + instr.operands[1].reg.value == ZYDIS_REGISTER_RSI; + }, + // ADD RSI, [RBP] + [](const zydis_decoded_instr_t& instr) -> bool + { + return instr.mnemonic == ZYDIS_MNEMONIC_ADD && + instr.operands[0].type == ZYDIS_OPERAND_TYPE_REGISTER && + instr.operands[0].reg.value == ZYDIS_REGISTER_RSI && + instr.operands[1].type == ZYDIS_OPERAND_TYPE_MEMORY && + instr.operands[1].mem.base == ZYDIS_REGISTER_RBP; + } + } + } + }; + inline vm::handler::profile_t vmexit = { // MOV RAX, RBP @@ -684,6 +743,8 @@ namespace vm &nandq, + &jmp, + &vmexit }; }