Skip to content

Commit d1b21a1

Browse files
SinaKarvandigitbook-bot
authored andcommitted
GitBook: [#884] update 12
1 parent fd2e455 commit d1b21a1

File tree

6 files changed

+25
-35
lines changed

6 files changed

+25
-35
lines changed

contribution/style-guide/coding-style.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ All global variables should start with `g_` for example `g_GuestState`.
3737

3838
For drivers, file names start with a capital case character.
3939

40-
For user-mode codes, file names start with lower case characters.
40+
For user-mode codes, file names start with lower case characters.
4141

4242
### Directory Names
4343

@@ -51,9 +51,6 @@ In HyperDbg, in most cases, if the printed message came from kernel-mode or vmx-
5151

5252
Exactly, like the above conventions for "Printing Messages", errors follow the same rule.
5353

54-
In HyperDbg, errors might come from either user-mode codes, kernel-mode, or vmx-root mode. Because we want to know the root cause of the error, we follow the rule of **"`Err,` "** and **"`err,` "**.
54+
In HyperDbg, errors might come from either user-mode codes, kernel-mode, or vmx-root mode. Because we want to know the root cause of the error, we follow the rule of "`Err,` " and "`err,` ".
5555

5656
If the error starts with `err,` then, it means that the user-mode code generated this error. If the error started with `Err,` it means that it was either kernel-mode or vmx-root mode that encountered this error.
57-
58-
59-

design/debugger-internals/ioctl-requests-for-events.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ typedef enum _DEBUGGER_EVENT_TYPE_ENUM {
100100

101101
If you want to use the debugger features, you should connect the `CommandsEventList` to the list of user-mode commands.
102102

103-
**OptionalParamX** is different in the case of each command. For example, in **!epthook2**, you should send the address of where you want to hook to the kernel as **OptionalParam1**. ****You have to check each command's manual to see what are its specific **OptionalParam**\(s\).
103+
**OptionalParamX** is different in the case of each command. For example, in **!epthook2**, you should send the address of where you want to hook to the kernel as **OptionalParam1**. You have to check each command's manual to see what are its specific **OptionalParam**(s).
104104

105-
**Tag** is an ID that you can use later in action.
105+
**Tag** is an ID that you can use later in action.
106106

107107
**IsEnabled** has a user-mode usage to trace whether the event is enabled or not.
108108

109109
**CommandStringBuffer** is the string of the command. You can ignore it.
110110

111-
If your event contains a condition buffer \(`ConditionBufferSize != 0`\), you can use set the size if `ConditionBufferSize` and append the buffer to the end of the above structure, and when you send the buffer to the kernel, you should send the `sizeof(DEBUGGER_GENERAL_EVENT_DETAIL)+ ConditionBufferSize (if any)`.
111+
If your event contains a condition buffer (`ConditionBufferSize != 0`), you can use set the size if `ConditionBufferSize` and append the buffer to the end of the above structure, and when you send the buffer to the kernel, you should send the `sizeof(DEBUGGER_GENERAL_EVENT_DETAIL)+ ConditionBufferSize (if any)`.
112112

113113
Finally, you can send it to the kernel by using the following function.
114114

@@ -121,7 +121,7 @@ SendEventToKernel(PDEBUGGER_GENERAL_EVENT_DETAIL Event,
121121
UINT32 EventBufferLength);
122122
```
123123
124-
If you want to send it directly using IOCTL, you can use the following IOCTL :
124+
If you want to send it directly using IOCTL, you can use the following IOCTL :
125125
126126
```c
127127
#define IOCTL_DEBUGGER_REGISTER_EVENT \
@@ -132,7 +132,7 @@ After sending the above event to the kernel, you should chain an action or multi
132132

133133
You should fill the following structure to send a "**Break**", "**Script**", and "**Custom Code**" to the kernel. For example, you can append the custom code buffer after this structure and send them together to the kernel.
134134

135-
Also, **EventTag** is the unique ID that we sent previously in the event.
135+
Also, **EventTag** is the unique ID that we sent previously in the event.
136136

137137
```c
138138
//
@@ -167,4 +167,3 @@ If you want to register the action to the event directly using `DeviceIoControl`
167167
#define IOCTL_DEBUGGER_ADD_ACTION_TO_EVENT \
168168
CTL_CODE(FILE_DEVICE_UNKNOWN, 0x807, METHOD_BUFFERED, FILE_ANY_ACCESS)
169169
```
170-

tips-and-tricks/misc/customize-build.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ By default, **HyperDbg** sends the current time of the system with each message
2121
#define ShowSystemTimeOnDebugMessages TRUE
2222
```
2323
24-
If you want to use **WPP Tracing** instead of **HyperDbg'**s message tracing, then set `UseWPPTracing` to `TRUE`. After that, you no longer see any message in **HyperDbg**, and instead, you can see the messages in a **WPP Tracing** compatible app.
24+
If you want to use **WPP Tracing** instead of **HyperDbg**'s message tracing, then set `UseWPPTracing` to `TRUE`. After that, you no longer see any message in **HyperDbg**, and instead, you can see the messages in a **WPP Tracing** compatible app.
2525
2626
```c
2727
/**
@@ -65,7 +65,7 @@ This is one of the **important** options for **HyperDng**. By default, **HyperDb
6565
6666
If you need to see messages immediately after each one message, then set this option to `TRUE`. However, it kills the performance as sending buffers to the user-mode involves various and heavy functions.
6767
68-
If you set this option to `FALSE` \(**default**\), then **HyperDbg** accumulates \(**~5** or more\) messages, and when the buffer is full, it sends the buffer to the user-mode **CLI** or **GUI**.
68+
If you set this option to `FALSE` (**default**), then **HyperDbg** accumulates (**\~5** or more) messages, and when the buffer is full, it sends the buffer to the user-mode **CLI** or **GUI**.
6969
7070
```c
7171
/**
@@ -157,7 +157,7 @@ The seeds that user-mode codes use as the starter of their output source tag.
157157
#define DebuggerOutputSourceTagStartSeed 0x1
158158
```
159159
160-
The following option changes the maximum number of breakpoints \('[bp](https://docs.hyperdbg.org/commands/debugging-commands/bp)' command\) that the user can put into the entire system before continuing the debuggee. If you continue the debuggee and send an IOCTL, HyperDbg will reset this number.
160+
The following option changes the maximum number of breakpoints ('[bp](https://docs.hyperdbg.org/commands/debugging-commands/bp)' command) that the user can put into the entire system before continuing the debuggee. If you continue the debuggee and send an IOCTL, HyperDbg will reset this number.
161161
162162
```c
163163
#define MAXIMUM_BREAKPOINTS_WITHOUT_CONTINUE 50
@@ -174,4 +174,3 @@ The following option changes the speed at which HyperDbg reads kernel messages i
174174
*/
175175
#define DefaultSpeedOfReadingKernelMessages 30
176176
```
177-

tips-and-tricks/misc/event-forwarding.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Brief explanation about Event Forwarding Mechanism
44

55
# Event Forwarding
66

7-
Event forwarding is a feature designed to make HyperDbg a tool for log gathering and analyzing system behavior. This way, you can use HyperDbg for [\#DFIR](https://twitter.com/search?q=%23dfir) purposes.
7+
Event forwarding is a feature designed to make HyperDbg a tool for log gathering and analyzing system behavior. This way, you can use HyperDbg for [#DFIR](https://twitter.com/search?q=%23dfir) purposes.
88

99
You can use event forwarding to forward the event monitoring result from your internal system to an external source, e.g., **File**, **NamedPipe**, or **TCP Socket**.
1010

@@ -38,23 +38,22 @@ Check the [output ](https://docs.hyperdbg.org/commands/debugging-commands/output
3838

3939
Event forwarding is a one-way mechanism. This means you can just see the client's logs, and you cannot make changes to the logs or send commands to the target client. If you want t,o control the debugger from a remote system, you can use [.listen](https://docs.hyperdbg.org/commands/meta-commands/.listen) and [.connect](https://docs.hyperdbg.org/commands/meta-commands/.connect) commands.
4040

41-
## Format \(plain-text and JSON\)
41+
## Format (plain-text and JSON)
4242

43-
Event forwarding is only applied to the script, which means that you can use the [**print** ](https://docs.hyperdbg.org/commands/scripting-language/functions/exports/print)and the [**printf**](https://docs.hyperdbg.org/commands/scripting-language/functions/exports/printf) _\*\*_function to generate results that will be passed to the target output source.
43+
Event forwarding is only applied to the script, which means that you can use the [**print** ](https://docs.hyperdbg.org/commands/scripting-language/functions/exports/print)and the [**printf**](https://docs.hyperdbg.org/commands/scripting-language/functions/exports/printf) function to generate results that will be passed to the target output source.
4444

45-
It's possible to create JSON results using the [**printf**](https://docs.hyperdbg.org/commands/scripting-language/functions/exports/printf) _\*\*_function.
45+
It's possible to create JSON results using the [**printf**](https://docs.hyperdbg.org/commands/scripting-language/functions/exports/printf) function.
4646

4747
### Examples
4848

4949
The following repository contains some examples of listening on a named pipe as a server or listening on TCP sockets to use event forwarding.
5050

51-
{% embed url="https://github.com/HyperDbg/event-forwarding-examples" caption="" %}
51+
{% embed url="https://github.com/HyperDbg/event-forwarding-examples" %}
5252

53-
Assume that we want to send the results of syscall \(syscall numbers in `rax`\) to several sources. The following video shows how to redirect these events to the **file**, **TCP Socket**, **named pipe**.
53+
Assume that we want to send the results of syscall (syscall numbers in `rax`) to several sources. The following video shows how to redirect these events to the **file**, **TCP Socket**, **named pipe**.
5454

5555
## Demo
5656

5757
Watch the video - How to use event forwarding.
5858

59-
{% embed url="https://www.youtube.com/watch?v=tyapdCEZtic" caption="" %}
60-
59+
{% embed url="https://www.youtube.com/watch?v=tyapdCEZtic" %}

tips-and-tricks/misc/message-overflow.md

+6-9
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ description: Kernel Message Tracing Overflow
44

55
# Message Overflow
66

7-
Kernel buffers for transferring data safely to the user-mode \(debugger\) can be filled. If the debugger doesn't find time to transfer all messages, then the new messages will replace the previous messages, and as a result, you lose your messages, which are not yet transferred to the user-mode.
7+
Kernel buffers for transferring data safely to the user-mode (debugger) can be filled. If the debugger doesn't find time to transfer all messages, then the new messages will replace the previous messages, and as a result, you lose your messages, which are not yet transferred to the user-mode.
88

99
In the rest of this document, you will learn the important factors that can decrease such scenarios. Take a look at [Customize Build](https://docs.hyperdbg.org/tips-and-tricks/misc/customize-build) for more information.
1010

1111
## Use Conditions
1212

13-
[Condition code](https://docs.hyperdbg.org/using-hyperdbg/prerequisites/how-to-create-a-condition) buffers are one of the most important parts of **HyperDbg**. You can use this feature to avoid triggering unnecessary events \(actions\) by creating conditions that filter the results for you in assembly form in both kernel-mode and vmx-root mode.
13+
[Condition code](https://docs.hyperdbg.org/using-hyperdbg/prerequisites/how-to-create-a-condition) buffers are one of the most important parts of **HyperDbg**. You can use this feature to avoid triggering unnecessary events (actions) by creating conditions that filter the results for you in assembly form in both kernel-mode and vmx-root mode.
1414

1515
## Change Reading Delay
1616

17-
You can change `hprdbgctrl.cpp` file's **ReadIrpBasedBuffer\(\)** method to decrease the delay between reading each message from the kernel. You can change `Sleep(200);` to a lower time \(ms\), so you can read messages faster.
17+
You can change `hprdbgctrl.cpp` file's **ReadIrpBasedBuffer()** method to decrease the delay between reading each message from the kernel. You can change `Sleep(200);` to a lower time (ms), so you can read messages faster.
1818

1919
```c
2020
...
@@ -46,7 +46,7 @@ You can change `hprdbgctrl.cpp` file's **ReadIrpBasedBuffer\(\)** method to decr
4646
4747
If you need to see messages immediately after each one message, then set this option to `TRUE`. However, it kills the performance as sending buffers to the user-mode involves various and heavy functions.
4848
49-
If you set this option to `FALSE`, **HyperDbg** accumulates \(**~5** or more based on message length and chunk size\) messages, and when the buffer is full, it sends the buffer to the user-mode **CLI** or **GUI**.
49+
If you set this option to `FALSE`, **HyperDbg** accumulates (**\~5** or more based on message length and chunk size) messages, and when the buffer is full, it sends the buffer to the user-mode **CLI** or **GUI**.
5050
5151
You can change the following options in the **Configuration.h** file.
5252
@@ -63,7 +63,7 @@ You can change the following options in the **Configuration.h** file.
6363

6464
This is the most important factor in message tracing, if you increase the following value, then more messages will be stored in **HyperDbg** buffers; thus, they won't be replaced until the buffer is full, for example, if set this value to **1000**, then if you produce **1000** messages that are not delivered to the user-mode, **HyperDbg** replaces new messages with older messages, and in the case, if you set this value to **2000** then you have more capacity; thus, the buffers will have the capacity to hold twice more messages.
6565

66-
However, keep in mind that **HyperDbg** occupies more non-paged pools \(RAM\) by increasing the following value, so you need to balance your message capacity with your memory \(RAM\).
66+
However, keep in mind that **HyperDbg** occupies more non-paged pools (RAM) by increasing the following value, so you need to balance your message capacity with your memory (RAM).
6767

6868
```c
6969
/* Default buffer size */
@@ -74,12 +74,9 @@ However, keep in mind that **HyperDbg** occupies more non-paged pools \(RAM\) by
7474
7575
The following option shows the capacity of each packet in **HyperDbg**'s message tracing. If you have long messages or buffers, then you can increase this value.
7676
77-
If you increased it, then **HyperDbg** accumulates more messages and won't send them immediately to the user-mode \(as described in **Not Use Immediate Messaging** above\). This will lead to better performance; however, messages will be delivered by a delay \(for accumulation\).
77+
If you increased it, then **HyperDbg** accumulates more messages and won't send them immediately to the user-mode (as described in **Not Use Immediate Messaging** above). This will lead to better performance; however, messages will be delivered by a delay (for accumulation).
7878
7979
```c
8080
#define PacketChunkSize \
8181
1000 // NOTE : REMEMBER TO CHANGE IT IN USER-MODE APP TOO
8282
```
83-
84-
\*\*\*\*
85-

tips-and-tricks/nested-virtualization-environments/run-hyperdbg-on-hyper-v.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Hyper-V has an unknown problem with HyperDbg and HyperDbg-style hypervisors. You
1010

1111
In order to run HyperDbg on Hyper-V, you should enable nested-virtualization on it.
1212

13-
For Hyper-V, we can enable nested-virtualization for the target virtual machine by running the following command on **Powershell** :
13+
For Hyper-V, we can enable nested-virtualization for the target virtual machine by running the following command on **Powershell**:
1414

1515
```
1616
Set-VMProcessor -VMName PutYourVmNameHere -ExposeVirtualizationExtensions $true
@@ -22,7 +22,6 @@ Note that instead of **PutYourVmNameHere**, put the name of your virtual machine
2222

2323
And if you need to disable it, you can run:
2424

25-
```text
25+
```
2626
Set-VMProcessor -VMName PutYourVmNameHere -ExposeVirtualizationExtensions $false
2727
```
28-

0 commit comments

Comments
 (0)