2020-10-22 09:02:28 -07:00
|
|
|
/**
|
|
|
|
|
* @file ScriptEngine.c
|
2022-01-18 22:38:56 +03:30
|
|
|
* @author M.H. Gholamrezaei (mh@hyperdbg.org)
|
2020-10-29 07:05:20 -07:00
|
|
|
* @brief Script engine parser and wrapper functions
|
2020-10-22 09:02:28 -07:00
|
|
|
* @details
|
|
|
|
|
* @version 0.1
|
|
|
|
|
* @date 2020-10-22
|
|
|
|
|
*
|
|
|
|
|
* @copyright This project is released under the GNU Public License v3.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2022-05-04 16:38:21 -07:00
|
|
|
#include "pch.h"
|
2020-10-29 07:05:20 -07:00
|
|
|
|
2021-01-14 05:42:30 -08:00
|
|
|
/**
|
|
|
|
|
* @brief Get current ip from the debugger frame
|
2022-12-07 15:47:15 +09:00
|
|
|
*
|
2021-01-14 05:42:30 -08:00
|
|
|
* @return UINT64 returns the rip of the current debuggee state frame
|
|
|
|
|
*/
|
2020-10-29 07:05:20 -07:00
|
|
|
UINT64
|
|
|
|
|
ScriptEngineWrapperGetInstructionPointer()
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// Check if we are in vmx-root or not
|
|
|
|
|
//
|
2023-01-23 23:44:12 +09:00
|
|
|
if (VmFuncVmxGetCurrentExecutionMode() == TRUE)
|
2020-10-29 07:05:20 -07:00
|
|
|
{
|
2022-12-31 22:01:45 +09:00
|
|
|
return VmFuncGetRip();
|
2020-10-29 07:05:20 -07:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// Otherwise $ip doesn't mean anything
|
|
|
|
|
//
|
2024-03-01 21:02:52 +09:00
|
|
|
return (UINT64)NULL;
|
2020-10-29 07:05:20 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-14 05:42:30 -08:00
|
|
|
/**
|
|
|
|
|
* @brief Get the address of reserved buffer
|
2022-12-07 15:47:15 +09:00
|
|
|
*
|
2021-01-14 05:42:30 -08:00
|
|
|
* @param Action Corresponding action
|
|
|
|
|
* @return UINT64 returns the requested buffer address from user
|
|
|
|
|
*/
|
2020-10-29 07:05:20 -07:00
|
|
|
UINT64
|
|
|
|
|
ScriptEngineWrapperGetAddressOfReservedBuffer(PDEBUGGER_EVENT_ACTION Action)
|
|
|
|
|
{
|
|
|
|
|
return Action->RequestedBuffer.RequstBufferAddress;
|
|
|
|
|
}
|