Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

up #185

Merged
merged 8 commits into from
Nov 15, 2024
Merged

up #185

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ how to build ?
1. git clone https://github.com/HyperDbg/gui.git

2. install golang from https://go.dev/dl/

3. install gcc

4. go build -x .

5. go run -x .
3. go run -x .
```
Binary file modified sdk/bin/hyperdbg-cli.exe
Binary file not shown.
Binary file added sdk/bin/hyperdbg-test.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)
131 changes: 131 additions & 0 deletions sdk/bindgen/SDK/Headers/Pcie.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/**
* @file Pcie.h
* @author Björn Ruytenberg ([email protected])
* @brief PCIe-related data structures
* @details
* @version 0.10.3
* @date 2024-10-30
*
* @copyright This project is released under the GNU Public License v3.
*
*/
#pragma once

//////////////////////////////////////////////////
// Headers //
//////////////////////////////////////////////////

//
// PCIe Base Specification, Rev. 4.0, Version 1.0, Table 7-59: Link Address for Link Type 1
// Bus: 0-255 (8 bit)
// Device: 0-31 (5 bit)
// Function: 0-7 (3 bit)
//
// TODO
// We're limited to sending fixed buffers, so we'll have to choose some reasonable numbers here instead of assuming spec-mandated maximum numbers.
// Ensure the following parameters do not result in exceeding MaxSerialPacketSize. Consider sending multiple packets if necessary.
//
#define DOMAIN_MAX_NUM 2
#define BUS_MAX_NUM 10
#define DEVICE_MAX_NUM 2
#define FUNCTION_MAX_NUM 1

//
// TODO
// We currently limit ourselves to PCI configuration space (i.e. CAM).
//

/**
* @brief PCI Common Header
*
*/
typedef struct _PORTABLE_PCI_COMMON_HEADER
{
UINT16 VendorId;
UINT16 DeviceId;
UINT16 Command;
UINT16 Status;
UINT8 RevisionId;
UINT8 ClassCode[3];
UINT8 CacheLineSize;
UINT8 PrimaryLatencyTimer;
UINT8 HeaderType;
UINT8 Bist;
} PORTABLE_PCI_COMMON_HEADER, *PPORTABLE_PCI_COMMON_HEADER;

/**
* @brief PCI Device Header
*
*/
typedef struct _PORTABLE_PCI_DEVICE_HEADER
{
UINT32 Bar[6]; // Base Address Registers
UINT32 CardBusCISPtr; // CardBus CIS Pointer
UINT16 SubVendorId; // Subsystem Vendor ID
UINT16 SubSystemId; // Subsystem ID
UINT32 ROMBar; // Expansion ROM Base Address
UINT8 CapabilitiesPtr; // Capabilities Pointer
UINT8 Reserved[3];
UINT32 Reserved1;
UINT8 InterruptLine; // Interrupt Line
UINT8 InterruptPin; // Interrupt Pin
UINT8 MinGnt; // Min_Gnt
UINT8 MaxLat; // Max_Lat
} PORTABLE_PCI_DEVICE_HEADER, *PPORTABLE_PCI_DEVICE_HEADER;

/**
* @brief PCI Configuration Space Header
*
*/
typedef struct _PORTABLE_PCI_CONFIG_SPACE_HEADER
{
PORTABLE_PCI_COMMON_HEADER CommonHeader;
PORTABLE_PCI_DEVICE_HEADER DeviceHeader;
// TODO: Add Device Private, Capabilities, Enhanced Capabilities
} PORTABLE_PCI_CONFIG_SPACE_HEADER, *PPORTABLE_PCI_CONFIG_SPACE_HEADER;

/**
* @brief PCI Function Data Structure
*
*/
typedef struct _PCI_FUNCTION
{
UINT8 Placeholder;
} PCI_FUNCTION, *PPCI_FUNCTION;

/**
* @brief PCI Device Data Structure
*
*/
typedef struct _PCI_DEVICE
{
PORTABLE_PCI_CONFIG_SPACE_HEADER ConfigSpace[DEVICE_MAX_NUM];
PCI_FUNCTION Function[FUNCTION_MAX_NUM];
} PCI_DEVICE, *PPCI_DEVICE;

/**
* @brief PCI Bus Data Structure
*
*/
typedef struct _PCI_BUS
{
PCI_DEVICE Device[DEVICE_MAX_NUM];
} PCI_BUS, *PPCI_BUS;

/**
* @brief PCI Domain Data Structure
*
*/
typedef struct _PCI_DOMAIN
{
PCI_BUS Bus[BUS_MAX_NUM];
} PCI_DOMAIN, *PPCI_DOMAIN;

/**
* @brief PCI Tree Data Structure
*
*/
typedef struct _PCI_TREE
{
PCI_DOMAIN Domain[DOMAIN_MAX_NUM];
} PCI_TREE, *PPCI_TREE;
Loading
Loading