Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
ddkwork committed Nov 15, 2024
1 parent 512a121 commit 87cec4a
Show file tree
Hide file tree
Showing 36 changed files with 1,615 additions and 541 deletions.
Binary file modified sdk/bin/hyperdbg-cli.exe
Binary file not shown.
Binary file modified sdk/bin/hyperhv.dll
Binary file not shown.
Binary file modified sdk/bin/hyperkd.sys
Binary file not shown.
Binary file modified sdk/bin/hyperlog.dll
Binary file not shown.
Binary file modified sdk/bin/kdserial.dll
Binary file not shown.
Binary file modified sdk/bin/libhyperdbg.dll
Binary file not shown.
Binary file modified sdk/bin/msdia140.dll
Binary file not shown.
Binary file modified sdk/bin/pdbex.dll
Binary file not shown.
Binary file modified sdk/bin/script-engine.dll
Binary file not shown.
Binary file modified sdk/bin/symbol-parser.dll
Binary file not shown.
Binary file modified sdk/bin/symsrv.dll
Binary file not shown.
4 changes: 0 additions & 4 deletions sdk/bindgen/SDK/Examples/hyperdbg_app/hyperrev.vcxproj.user

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Code generated by Visual Studio kit, DO NOT EDIT.
set(SourceFiles
"header/core/Core.h"
"header/driver/Driver.h"
Expand All @@ -10,7 +11,7 @@ set(SourceFiles
"code/driver/Loader.c"
)
include_directories(
"../../../HyperDbg/include"
"../../../hyperdbg/include"
"header"
)
wdk_add_driver(hyperdbg_driver
Expand Down
3 changes: 2 additions & 1 deletion sdk/bindgen/SDK/Examples/user/hyperdbg_app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Code generated by Visual Studio kit, DO NOT EDIT.
set(SourceFiles
"../../../platform/user/header/Environment.h"
"header/pch.h"
"code/hyperdbg-app.cpp"
)
include_directories(
"../../../HyperDbg/include"
"../../../hyperdbg/include"
"header"
)
add_executable(hyperdbg_app ${SourceFiles})
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ hyperdbg_load()
//
hyperdbg_u_connect_remote_debugger_using_named_pipe("\\\\.\\pipe\\HyperDbgPipe", TRUE);
Sleep(10000);
hyperdbg_u_interpreter((CHAR *)"r");
hyperdbg_u_interpreter((CHAR *)".start path c:\\Windows\\system32\\calc.exe");
hyperdbg_u_run_command((CHAR *)"r");
hyperdbg_u_run_command((CHAR *)".start path c:\\Windows\\system32\\calc.exe");
hyperdbg_u_continue_debuggee();
hyperdbg_u_continue_debuggee();
hyperdbg_u_continue_debuggee();
Expand Down
11 changes: 6 additions & 5 deletions sdk/bindgen/SDK/Headers/BasicTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@ typedef struct GUEST_EXTRA_REGISTERS
/**
* @brief List of different variables
*/
typedef struct _SCRIPT_ENGINE_VARIABLES_LIST
typedef struct _SCRIPT_ENGINE_GENERAL_REGISTERS
{
UINT64 * TempList;
UINT64 * StackBuffer;
UINT64 * GlobalVariablesList;
UINT64 * LocalVariablesList;

} SCRIPT_ENGINE_VARIABLES_LIST, *PSCRIPT_ENGINE_VARIABLES_LIST;
UINT64 StackIndx;
UINT64 StackBaseIndx;
UINT64 ReturnValue;
} SCRIPT_ENGINE_GENERAL_REGISTERS, *PSCRIPT_ENGINE_GENERAL_REGISTERS;

/**
* @brief CR3 Structure
Expand Down
4 changes: 4 additions & 0 deletions sdk/bindgen/SDK/Headers/Connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ typedef enum _DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION
DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION_ON_VMX_ROOT_SET_SHORT_CIRCUITING_STATE,
DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION_ON_VMX_ROOT_INJECT_PAGE_FAULT,
DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION_ON_VMX_ROOT_WRITE_REGISTER,
DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION_ON_VMX_ROOT_QUERY_PCITREE,
DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION_ON_VMX_ROOT_PERFORM_ACTIONS_ON_APIC,

//
// Debuggee to debugger
Expand Down Expand Up @@ -129,6 +131,8 @@ typedef enum _DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION
DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION_DEBUGGEE_RESULT_OF_VA2PA_AND_PA2VA,
DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION_DEBUGGEE_RESULT_OF_BRINGING_PAGES_IN,
DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION_DEBUGGEE_RESULT_OF_WRITE_REGISTER,
DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION_DEBUGGEE_RESULT_OF_PCITREE,
DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION_DEBUGGEE_RESULT_OF_APIC_REQUESTS,

//
// hardware debuggee to debugger
Expand Down
10 changes: 4 additions & 6 deletions sdk/bindgen/SDK/Headers/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
//////////////////////////////////////////////////

#define VERSION_MAJOR 0
#define VERSION_MINOR 10
#define VERSION_PATCH 1
#define VERSION_MINOR 11
#define VERSION_PATCH 0

//
// Example of __DATE__ string: "Jul 27 2012"
Expand Down Expand Up @@ -76,7 +76,7 @@
#define BUILD_SEC_CH0 (__TIME__[6])
#define BUILD_SEC_CH1 (__TIME__[7])

#ifndef HYPERDBG_KERNEL_MODE
#ifdef __cplusplus // becasue it's not valid in C

const unsigned char BuildDateTime[] = {
BUILD_YEAR_CH0,
Expand Down Expand Up @@ -150,7 +150,7 @@ const unsigned char BuildSignature[] = {

'\0'};

#endif // SCRIPT_ENGINE_KERNEL_MODE
#endif

//////////////////////////////////////////////////
// Message Tracing //
Expand Down Expand Up @@ -563,8 +563,6 @@ const unsigned char BuildSignature[] = {
# define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF))
#endif // !HIBYTE

#define MAX_TEMP_COUNT 128

#define MAX_STACK_BUFFER_COUNT 256

#define MAX_EXECUTION_COUNT 1000000
Expand Down
6 changes: 6 additions & 0 deletions sdk/bindgen/SDK/Headers/ErrorCodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,12 @@
*/
#define DEBUGGER_ERROR_INVALID_PHYSICAL_ADDRESS 0xc0000052

/**
* @brief error, could not perform APIC actions
*
*/
#define DEBUGGER_ERROR_APIC_ACTIONS_ERROR 0xc0000053

//
// WHEN YOU ADD ANYTHING TO THIS LIST OF ERRORS, THEN
// MAKE SURE TO ADD AN ERROR MESSAGE TO ShowErrorMessage(UINT32 Error)
Expand Down
26 changes: 26 additions & 0 deletions sdk/bindgen/SDK/Headers/HardwareDebugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,31 @@
*/
#define DEFAULT_INITIAL_DEBUGGER_TO_DEBUGGEE_OFFSET 0x0

/**
* @brief Initial default buffer size (BRAN Size)
* @details Number of 4-Byte intergers (256 * 4 Byte * 8 bits = 8-kilobits)
*
*/
#define DEFAULT_INITIAL_BRAM_BUFFER_SIZE 256

/**
* @brief Path to read the sample of the instance info
*
*/
#define HWDBG_TEST_READ_INSTANCE_INFO_PATH "..\\..\\..\\..\\hwdbg\\sim\\hwdbg\\DebuggerModuleTestingBRAM\\bram_instance_info.txt"

/**
* @brief Path to write the sample of the script buffer
*
*/
#define HWDBG_TEST_WRITE_SCRIPT_BUFFER_PATH "..\\..\\..\\..\\hwdbg\\src\\test\\bram\\script_buffer.hex.txt"

/**
* @brief Path to write the sample of the instance info requests
*
*/
#define HWDBG_TEST_WRITE_INSTANCE_INFO_PATH "..\\..\\..\\..\\hwdbg\\src\\test\\bram\\instance_info.hex.txt"

//////////////////////////////////////////////////
// Enums //
//////////////////////////////////////////////////
Expand Down Expand Up @@ -119,6 +144,7 @@ typedef struct _HWDBG_INSTANCE_INFORMATION
UINT64 assign_registers : 1;
UINT64 assign_pseudo_registers : 1;
UINT64 conditional_statements_and_comparison_operators : 1;
UINT64 stack_assignments : 1;

UINT64 func_or : 1;
UINT64 func_xor : 1;
Expand Down
14 changes: 14 additions & 0 deletions sdk/bindgen/SDK/Headers/Ioctls.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,17 @@
*/
#define IOCTL_PREACTIVATE_FUNCTIONALITY \
CTL_CODE(FILE_DEVICE_UNKNOWN, 0x820, METHOD_BUFFERED, FILE_ANY_ACCESS)

/**
* @brief ioctl, to enumerate PCIe endpoints
*
*/
#define IOCTL_PCIE_ENDPOINT_ENUM \
CTL_CODE(FILE_DEVICE_UNKNOWN, 0x821, METHOD_BUFFERED, FILE_ANY_ACCESS)

/**
* @brief ioctl, to perform actions related to APIC
*
*/
#define IOCTL_PERFROM_ACTIONS_ON_APIC \
CTL_CODE(FILE_DEVICE_UNKNOWN, 0x822, METHOD_BUFFERED, FILE_ANY_ACCESS)
151 changes: 151 additions & 0 deletions sdk/bindgen/SDK/Headers/RequestStructures.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*
*/
#pragma once
#include "Pcie.h"

#define SIZEOF_DEBUGGER_READ_PAGE_TABLE_ENTRIES_DETAILS \
sizeof(DEBUGGER_READ_PAGE_TABLE_ENTRIES_DETAILS)
Expand Down Expand Up @@ -1022,6 +1023,139 @@ typedef struct _DEBUGGEE_STEP_PACKET
*/
#define DEBUGGER_REMOTE_TRACKING_DEFAULT_COUNT_OF_STEPPING 0xffffffff

/* ==============================================================================================
/**
* @brief Perform actions related to APIC
*
*/
typedef enum _DEBUGGER_APIC_REQUEST_TYPE
{
DEBUGGER_APIC_REQUEST_TYPE_READ_LOCAL_APIC,

} DEBUGGER_APIC_REQUEST_TYPE;

/**
* @brief The structure of actions for APIC
*
*/
typedef struct _DEBUGGER_APIC_REQUEST
{
DEBUGGER_APIC_REQUEST_TYPE ApicType;
BOOLEAN IsUsingX2APIC;
UINT32 KernelStatus;

} DEBUGGER_APIC_REQUEST, *PDEBUGGER_APIC_REQUEST;

/**
* @brief Debugger size of DEBUGGER_APIC_REQUEST
*
*/
#define SIZEOF_DEBUGGER_APIC_REQUEST \
sizeof(DEBUGGER_APIC_REQUEST)

/**
* @brief LAPIC structure size
*/
#define LAPIC_SIZE 0x400

#define LAPIC_LVT_FLAG_ENTRY_MASKED (1UL << 16)
#define LAPIC_LVT_DELIVERY_MODE_EXT_INT (7UL << 8)
#define LAPIC_SVR_FLAG_SW_ENABLE (1UL << 8)

/**
* @brief LAPIC structure and offsets
*/
typedef struct _LAPIC_PAGE
{
UINT8 Reserved000[0x10];
UINT8 Reserved010[0x10];

UINT32 Id; // offset 0x020
UINT8 Reserved024[0x0C];

UINT32 Version; // offset 0x030
UINT8 Reserved034[0x0C];

UINT8 Reserved040[0x40];

UINT32 TPR; // offset 0x080
UINT8 Reserved084[0x0C];

UINT32 ArbitrationPriority; // offset 0x090
UINT8 Reserved094[0x0C];

UINT32 ProcessorPriority; // offset 0x0A0
UINT8 Reserved0A4[0x0C];

UINT32 EOI; // offset 0x0B0
UINT8 Reserved0B4[0x0C];

UINT32 RemoteRead; // offset 0x0C0
UINT8 Reserved0C4[0x0C];

UINT32 LogicalDestination; // offset 0x0D0
UINT8 Reserved0D4[0x0C];

UINT32 DestinationFormat; // offset 0x0E0
UINT8 Reserved0E4[0x0C];

UINT32 SpuriousInterruptVector; // offset 0x0F0
UINT8 Reserved0F4[0x0C];

UINT32 ISR[32]; // offset 0x100

UINT32 TMR[32]; // offset 0x180

UINT32 IRR[32]; // offset 0x200

UINT32 ErrorStatus; // offset 0x280
UINT8 Reserved284[0x0C];

UINT8 Reserved290[0x60];

UINT32 LvtCmci; // offset 0x2F0
UINT8 Reserved2F4[0x0C];

UINT32 IcrLow; // offset 0x300
UINT8 Reserved304[0x0C];

UINT32 IcrHigh; // offset 0x310
UINT8 Reserved314[0x0C];

UINT32 LvtTimer; // offset 0x320
UINT8 Reserved324[0x0C];

UINT32 LvtThermalSensor; // offset 0x330
UINT8 Reserved334[0x0C];

UINT32 LvtPerfMonCounters; // offset 0x340
UINT8 Reserved344[0x0C];

UINT32 LvtLINT0; // offset 0x350
UINT8 Reserved354[0x0C];

UINT32 LvtLINT1; // offset 0x360
UINT8 Reserved364[0x0C];

UINT32 LvtError; // offset 0x370
UINT8 Reserved374[0x0C];

UINT32 InitialCount; // offset 0x380
UINT8 Reserved384[0x0C];

UINT32 CurrentCount; // offset 0x390
UINT8 Reserved394[0x0C];

UINT8 Reserved3A0[0x40]; // offset 0x3A0

UINT32 DivideConfiguration; // offset 0x3E0
UINT8 Reserved3E4[0x0C];

UINT32 SelfIpi; // offset 0x3F0
UINT8 Reserved3F4[0x0C]; // valid only for X2APIC
} LAPIC_PAGE, *PLAPIC_PAGE;

/* ==============================================================================================
*/

Expand Down Expand Up @@ -1177,3 +1311,20 @@ typedef struct _DEBUGGEE_REGISTER_WRITE_DESCRIPTION

/* ==============================================================================================
*/

#define SIZEOF_DEBUGGEE_PCITREE_REQUEST_RESPONSE_PACKET \
sizeof(DEBUGGEE_PCITREE_REQUEST_RESPONSE_PACKET)

/**
* @brief Pcitree Structure
*
*/
typedef struct _DEBUGGEE_PCITREE_REQUEST_RESPONSE_PACKET
{
UINT32 KernelStatus;
PCI_TREE PciTree;

} DEBUGGEE_PCITREE_REQUEST_RESPONSE_PACKET, *PDEBUGGEE_PCITREE_REQUEST_RESPONSE_PACKET;

/* ==============================================================================================
*/
Loading

0 comments on commit 87cec4a

Please sign in to comment.