2020-05-27 09:59:17 -07:00
|
|
|
/**
|
|
|
|
|
* @file d-u.cpp
|
2022-01-18 22:38:56 +03:30
|
|
|
* @author Sina Karvandi (sina@hyperdbg.org)
|
2020-08-28 04:03:12 -07:00
|
|
|
* @brief !u* u* , !d* d* commands
|
2020-05-27 09:59:17 -07:00
|
|
|
* @details
|
|
|
|
|
* @version 0.1
|
|
|
|
|
* @date 2020-05-27
|
|
|
|
|
*
|
|
|
|
|
* @copyright This project is released under the GNU Public License v3.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2022-05-04 16:38:21 -07:00
|
|
|
#include "pch.h"
|
2020-05-27 09:59:17 -07:00
|
|
|
|
2021-05-07 02:56:34 +04:30
|
|
|
//
|
|
|
|
|
// Global Variables
|
|
|
|
|
//
|
2022-02-20 02:43:15 +03:30
|
|
|
extern BOOLEAN g_IsSerialConnectedToRemoteDebuggee;
|
|
|
|
|
extern ACTIVE_DEBUGGING_PROCESS g_ActiveProcessDebuggingState;
|
2021-05-07 02:56:34 +04:30
|
|
|
|
2020-08-28 04:03:12 -07:00
|
|
|
/**
|
|
|
|
|
* @brief help of u* d* !u* !d* commands
|
2021-02-10 15:19:01 -08:00
|
|
|
*
|
|
|
|
|
* @return VOID
|
2020-08-28 04:03:12 -07:00
|
|
|
*/
|
2021-03-22 18:19:39 +04:30
|
|
|
VOID
|
|
|
|
|
CommandReadMemoryAndDisassemblerHelp()
|
|
|
|
|
{
|
2026-07-11 19:59:08 +02:00
|
|
|
ShowMessages("db dc dd dq !db !dc !dd !dq & u u64 !u !u64 u2 u32 !u2 !u32 & dl & !dl : reads the "
|
|
|
|
|
"memory in different shapes (hex), disassembles, or walks linked lists\n");
|
2022-02-08 16:06:26 +03:30
|
|
|
ShowMessages("db Byte and ASCII characters\n");
|
|
|
|
|
ShowMessages("dc Double-word values (4 bytes) and ASCII characters\n");
|
|
|
|
|
ShowMessages("dd Double-word values (4 bytes)\n");
|
|
|
|
|
ShowMessages("dq Quad-word values (8 bytes). \n");
|
2023-07-17 18:53:51 +09:00
|
|
|
ShowMessages("u u64 Disassembler at the target address (x64) \n");
|
|
|
|
|
ShowMessages("u2 u32 Disassembler at the target address (x86) \n");
|
2026-07-10 07:55:56 -07:00
|
|
|
ShowMessages("dl Walks a linked list starting at an address and shows each node\n");
|
2021-04-20 13:32:25 +04:30
|
|
|
ShowMessages("\nIf you want to read physical memory then add '!' at the "
|
2021-03-22 18:19:39 +04:30
|
|
|
"start of the command\n");
|
2021-04-20 13:32:25 +04:30
|
|
|
ShowMessages("you can also disassemble physical memory using '!u'\n\n");
|
2021-03-22 18:19:39 +04:30
|
|
|
|
2022-02-08 16:06:26 +03:30
|
|
|
ShowMessages("syntax : \tdb [Address (hex)] [l Length (hex)] [pid ProcessId (hex)]\n");
|
|
|
|
|
ShowMessages("syntax : \tdc [Address (hex)] [l Length (hex)] [pid ProcessId (hex)]\n");
|
|
|
|
|
ShowMessages("syntax : \tdd [Address (hex)] [l Length (hex)] [pid ProcessId (hex)]\n");
|
|
|
|
|
ShowMessages("syntax : \tdq [Address (hex)] [l Length (hex)] [pid ProcessId (hex)]\n");
|
|
|
|
|
ShowMessages("syntax : \tu [Address (hex)] [l Length (hex)] [pid ProcessId (hex)]\n");
|
2023-07-17 18:53:51 +09:00
|
|
|
ShowMessages("syntax : \tu64 [Address (hex)] [l Length (hex)] [pid ProcessId (hex)]\n");
|
2022-02-08 16:06:26 +03:30
|
|
|
ShowMessages("syntax : \tu2 [Address (hex)] [l Length (hex)] [pid ProcessId (hex)]\n");
|
2023-07-17 18:53:51 +09:00
|
|
|
ShowMessages("syntax : \tu32 [Address (hex)] [l Length (hex)] [pid ProcessId (hex)]\n");
|
2026-07-10 07:55:56 -07:00
|
|
|
ShowMessages("syntax : \tdl [Address (hex)] [o Offset (hex)] [l Count (hex)] [pid ProcessId (hex)]\n");
|
2022-02-08 16:06:26 +03:30
|
|
|
|
2022-04-17 23:05:24 +04:30
|
|
|
ShowMessages("\n");
|
2021-09-24 03:24:38 +03:30
|
|
|
ShowMessages("\t\te.g : db nt!Kd_DEFAULT_Mask\n");
|
|
|
|
|
ShowMessages("\t\te.g : db nt!Kd_DEFAULT_Mask+10\n");
|
|
|
|
|
ShowMessages("\t\te.g : db @rax\n");
|
|
|
|
|
ShowMessages("\t\te.g : db @rax+50\n");
|
|
|
|
|
ShowMessages("\t\te.g : db fffff8077356f010\n");
|
2021-03-22 18:19:39 +04:30
|
|
|
ShowMessages("\t\te.g : !dq 100000\n");
|
2021-09-24 03:24:38 +03:30
|
|
|
ShowMessages("\t\te.g : !dq @rax+77\n");
|
2023-07-17 18:53:51 +09:00
|
|
|
ShowMessages("\t\te.g : u32 @eip\n");
|
2021-05-27 17:17:06 +04:30
|
|
|
ShowMessages("\t\te.g : u nt!ExAllocatePoolWithTag\n");
|
2021-09-24 03:24:38 +03:30
|
|
|
ShowMessages("\t\te.g : u nt!ExAllocatePoolWithTag+30\n");
|
2021-03-22 18:19:39 +04:30
|
|
|
ShowMessages("\t\te.g : u fffff8077356f010\n");
|
2021-09-24 03:24:38 +03:30
|
|
|
ShowMessages("\t\te.g : u fffff8077356f010+@rcx\n");
|
2026-07-10 07:55:56 -07:00
|
|
|
ShowMessages("\t\te.g : dl nt!PsActiveProcessHead\n");
|
|
|
|
|
ShowMessages("\t\te.g : dl @rax o 8\n");
|
|
|
|
|
ShowMessages("\t\te.g : dl fffff8077356f010 o 8 l 20 pid 4\n");
|
2020-05-27 09:59:17 -07:00
|
|
|
}
|
2020-05-27 14:06:27 -07:00
|
|
|
|
2020-08-28 04:03:12 -07:00
|
|
|
/**
|
|
|
|
|
* @brief u* d* !u* !d* commands handler
|
2021-02-10 15:19:01 -08:00
|
|
|
*
|
2024-07-29 19:40:24 +09:00
|
|
|
* @param CommandTokens
|
2024-07-31 14:08:14 +09:00
|
|
|
* @param Command
|
2024-07-29 19:40:24 +09:00
|
|
|
*
|
2021-02-10 15:19:01 -08:00
|
|
|
* @return VOID
|
2020-08-28 04:03:12 -07:00
|
|
|
*/
|
2021-03-22 18:19:39 +04:30
|
|
|
VOID
|
2024-07-31 14:08:14 +09:00
|
|
|
CommandReadMemoryAndDisassembler(vector<CommandToken> CommandTokens, string Command)
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2024-07-29 19:40:24 +09:00
|
|
|
UINT32 Pid = 0;
|
|
|
|
|
UINT32 Length = 0;
|
2026-07-10 07:55:56 -07:00
|
|
|
UINT64 Offset = 0;
|
|
|
|
|
UINT64 MaxNodes = DL_DEFAULT_MAX_NODES;
|
2024-07-29 19:40:24 +09:00
|
|
|
UINT64 TargetAddress = 0;
|
|
|
|
|
BOOLEAN IsNextProcessId = FALSE;
|
|
|
|
|
BOOLEAN IsFirstCommand = TRUE;
|
|
|
|
|
BOOLEAN IsNextLength = FALSE;
|
2026-07-10 07:55:56 -07:00
|
|
|
BOOLEAN IsNextOffset = FALSE;
|
|
|
|
|
BOOLEAN IsDlCommand = FALSE;
|
2021-03-22 18:19:39 +04:30
|
|
|
|
2024-07-29 19:40:24 +09:00
|
|
|
string FirstCommand = GetCaseSensitiveStringFromCommandToken(CommandTokens.front());
|
2021-03-22 18:19:39 +04:30
|
|
|
|
2022-02-20 02:43:15 +03:30
|
|
|
//
|
|
|
|
|
// By default if the user-debugger is active, we use these commands
|
|
|
|
|
// on the memory layout of the debuggee process
|
|
|
|
|
//
|
|
|
|
|
if (g_ActiveProcessDebuggingState.IsActive)
|
|
|
|
|
{
|
|
|
|
|
Pid = g_ActiveProcessDebuggingState.ProcessId;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-29 19:40:24 +09:00
|
|
|
if (CommandTokens.size() == 1)
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
|
|
|
|
//
|
2023-07-13 16:05:42 +09:00
|
|
|
// Means that user entered one command without any parameter
|
2021-03-22 18:19:39 +04:30
|
|
|
//
|
2024-07-31 18:21:23 +09:00
|
|
|
ShowMessages("incorrect use of the '%s'\n\n",
|
|
|
|
|
GetCaseSensitiveStringFromCommandToken(CommandTokens.at(0)).c_str());
|
2021-03-22 18:19:39 +04:30
|
|
|
CommandReadMemoryAndDisassemblerHelp();
|
2020-05-27 09:59:17 -07:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-29 19:40:24 +09:00
|
|
|
for (auto Section : CommandTokens)
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
|
|
|
|
if (IsFirstCommand)
|
|
|
|
|
{
|
|
|
|
|
IsFirstCommand = FALSE;
|
2026-07-11 19:59:08 +02:00
|
|
|
IsDlCommand = CompareLowerCaseStrings(CommandTokens.at(0), "dl") |
|
|
|
|
|
CompareLowerCaseStrings(CommandTokens.at(0), "!dl");
|
|
|
|
|
|
2021-03-22 18:19:39 +04:30
|
|
|
continue;
|
|
|
|
|
}
|
2023-07-26 15:15:16 +09:00
|
|
|
|
2021-03-22 18:19:39 +04:30
|
|
|
if (IsNextProcessId == TRUE)
|
|
|
|
|
{
|
2024-07-29 19:40:24 +09:00
|
|
|
if (!ConvertTokenToUInt32(Section, &Pid))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2021-12-09 20:50:29 +03:30
|
|
|
ShowMessages("err, you should enter a valid process id\n\n");
|
2021-03-22 18:19:39 +04:30
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
IsNextProcessId = FALSE;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (IsNextLength == TRUE)
|
|
|
|
|
{
|
2026-07-10 07:55:56 -07:00
|
|
|
//
|
|
|
|
|
// For 'dl', 'l' means max node count rather than a byte length,
|
|
|
|
|
// but it's parsed the same way
|
|
|
|
|
//
|
|
|
|
|
if (IsDlCommand)
|
|
|
|
|
{
|
|
|
|
|
if (!ConvertTokenToUInt64(Section, &MaxNodes))
|
|
|
|
|
{
|
|
|
|
|
ShowMessages("err, you should enter a valid count\n\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (!ConvertTokenToUInt32(Section, &Length))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2021-04-11 22:21:22 +04:30
|
|
|
ShowMessages("err, you should enter a valid length\n\n");
|
2021-03-22 18:19:39 +04:30
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
IsNextLength = FALSE;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-10 07:55:56 -07:00
|
|
|
if (IsNextOffset == TRUE)
|
|
|
|
|
{
|
|
|
|
|
if (!ConvertTokenToUInt64(Section, &Offset))
|
|
|
|
|
{
|
|
|
|
|
ShowMessages("err, you should enter a valid offset\n\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
IsNextOffset = FALSE;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-29 19:40:24 +09:00
|
|
|
if (CompareLowerCaseStrings(Section, "l"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
|
|
|
|
IsNextLength = TRUE;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-11 19:59:08 +02:00
|
|
|
if (IsDlCommand && CompareLowerCaseStrings(Section, "o"))
|
2026-07-10 07:55:56 -07:00
|
|
|
{
|
|
|
|
|
IsNextOffset = TRUE;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-29 19:40:24 +09:00
|
|
|
if (CompareLowerCaseStrings(Section, "pid"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
|
|
|
|
IsNextProcessId = TRUE;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Probably it's address
|
|
|
|
|
//
|
|
|
|
|
if (TargetAddress == 0)
|
|
|
|
|
{
|
2024-07-29 19:40:24 +09:00
|
|
|
if (!SymbolConvertNameOrExprToAddress(GetCaseSensitiveStringFromCommandToken(Section), &TargetAddress))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2021-06-03 16:43:00 +04:30
|
|
|
//
|
2024-03-17 01:01:22 +09:00
|
|
|
// Couldn't resolve or unknown parameter
|
2021-06-03 16:43:00 +04:30
|
|
|
//
|
|
|
|
|
ShowMessages("err, couldn't resolve error at '%s'\n",
|
2024-07-29 19:40:24 +09:00
|
|
|
GetCaseSensitiveStringFromCommandToken(Section).c_str());
|
2021-03-22 18:19:39 +04:30
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// User inserts two address
|
|
|
|
|
//
|
2023-07-13 16:05:42 +09:00
|
|
|
ShowMessages("err, incorrect use of the '%s' command\n\n",
|
2024-07-29 19:40:24 +09:00
|
|
|
GetCaseSensitiveStringFromCommandToken(CommandTokens.at(0)).c_str());
|
2021-03-22 18:19:39 +04:30
|
|
|
CommandReadMemoryAndDisassemblerHelp();
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-05-07 02:56:34 +04:30
|
|
|
|
2021-03-22 18:19:39 +04:30
|
|
|
if (!TargetAddress)
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// User inserts two address
|
|
|
|
|
//
|
2021-04-27 02:13:31 +04:30
|
|
|
ShowMessages("err, please enter a valid address\n\n");
|
2020-05-27 09:59:17 -07:00
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-05-07 02:56:34 +04:30
|
|
|
|
2026-07-11 19:59:08 +02:00
|
|
|
//
|
|
|
|
|
// Check if the user didn't specify a length for d* and u* commands, then we use default value
|
|
|
|
|
//
|
2026-07-10 07:55:56 -07:00
|
|
|
if (Length == 0 && !IsDlCommand)
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// Default length (user doesn't specified)
|
|
|
|
|
//
|
2024-07-29 19:40:24 +09:00
|
|
|
if (CompareLowerCaseStrings(CommandTokens.at(0), "u") ||
|
|
|
|
|
CompareLowerCaseStrings(CommandTokens.at(0), "!u") ||
|
|
|
|
|
CompareLowerCaseStrings(CommandTokens.at(0), "u64") ||
|
|
|
|
|
CompareLowerCaseStrings(CommandTokens.at(0), "!u64"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
|
|
|
|
Length = 0x40;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Length = 0x80;
|
|
|
|
|
}
|
2020-05-27 09:59:17 -07:00
|
|
|
}
|
2021-05-07 02:56:34 +04:30
|
|
|
|
2026-07-11 19:59:08 +02:00
|
|
|
//
|
|
|
|
|
// Check if the user didn't specify a max node count for dl command, then we use default value
|
|
|
|
|
//
|
2026-07-10 07:55:56 -07:00
|
|
|
if (IsDlCommand && MaxNodes == 0)
|
|
|
|
|
{
|
|
|
|
|
MaxNodes = DL_DEFAULT_MAX_NODES;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (IsNextLength || IsNextProcessId || IsNextOffset)
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2024-07-29 19:40:24 +09:00
|
|
|
ShowMessages("incorrect use of the '%s' command\n\n",
|
|
|
|
|
GetCaseSensitiveStringFromCommandToken(CommandTokens.at(0)).c_str());
|
2021-03-22 18:19:39 +04:30
|
|
|
CommandReadMemoryAndDisassemblerHelp();
|
2020-05-27 09:59:17 -07:00
|
|
|
return;
|
|
|
|
|
}
|
2021-05-07 02:56:34 +04:30
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Check to prevent using process id in d* and u* commands
|
|
|
|
|
//
|
|
|
|
|
if (g_IsSerialConnectedToRemoteDebuggee && Pid != 0)
|
|
|
|
|
{
|
2023-07-17 16:10:13 +09:00
|
|
|
ShowMessages(ASSERT_MESSAGE_CANNOT_SPECIFY_PID);
|
2021-05-07 02:56:34 +04:30
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-22 18:19:39 +04:30
|
|
|
if (Pid == 0)
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// Default process we read from current process
|
|
|
|
|
//
|
2026-07-20 12:15:34 +02:00
|
|
|
Pid = PlatformGetCurrentProcessId();
|
2021-03-22 18:19:39 +04:30
|
|
|
}
|
2021-03-22 16:23:10 +04:30
|
|
|
|
2024-07-29 19:40:24 +09:00
|
|
|
if (CompareLowerCaseStrings(CommandTokens.at(0), "db"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2024-07-06 22:46:57 +09:00
|
|
|
HyperDbgShowMemoryOrDisassemble(DEBUGGER_SHOW_COMMAND_DB,
|
2024-07-29 19:40:24 +09:00
|
|
|
TargetAddress,
|
|
|
|
|
DEBUGGER_READ_VIRTUAL_ADDRESS,
|
|
|
|
|
READ_FROM_KERNEL,
|
|
|
|
|
Pid,
|
|
|
|
|
Length,
|
|
|
|
|
NULL);
|
2021-03-22 18:19:39 +04:30
|
|
|
}
|
2024-07-29 19:40:24 +09:00
|
|
|
else if (CompareLowerCaseStrings(CommandTokens.at(0), "dc"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2024-07-06 22:46:57 +09:00
|
|
|
HyperDbgShowMemoryOrDisassemble(DEBUGGER_SHOW_COMMAND_DC,
|
2024-07-29 19:40:24 +09:00
|
|
|
TargetAddress,
|
|
|
|
|
DEBUGGER_READ_VIRTUAL_ADDRESS,
|
|
|
|
|
READ_FROM_KERNEL,
|
|
|
|
|
Pid,
|
|
|
|
|
Length,
|
|
|
|
|
NULL);
|
2021-03-22 18:19:39 +04:30
|
|
|
}
|
2024-07-29 19:40:24 +09:00
|
|
|
else if (CompareLowerCaseStrings(CommandTokens.at(0), "dd"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2024-07-06 22:46:57 +09:00
|
|
|
HyperDbgShowMemoryOrDisassemble(DEBUGGER_SHOW_COMMAND_DD,
|
2024-07-29 19:40:24 +09:00
|
|
|
TargetAddress,
|
|
|
|
|
DEBUGGER_READ_VIRTUAL_ADDRESS,
|
|
|
|
|
READ_FROM_KERNEL,
|
|
|
|
|
Pid,
|
|
|
|
|
Length,
|
|
|
|
|
NULL);
|
2021-03-22 18:19:39 +04:30
|
|
|
}
|
2024-07-29 19:40:24 +09:00
|
|
|
else if (CompareLowerCaseStrings(CommandTokens.at(0), "dq"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2024-07-06 22:46:57 +09:00
|
|
|
HyperDbgShowMemoryOrDisassemble(DEBUGGER_SHOW_COMMAND_DQ,
|
2024-07-29 19:40:24 +09:00
|
|
|
TargetAddress,
|
|
|
|
|
DEBUGGER_READ_VIRTUAL_ADDRESS,
|
|
|
|
|
READ_FROM_KERNEL,
|
|
|
|
|
Pid,
|
|
|
|
|
Length,
|
|
|
|
|
NULL);
|
2021-03-22 18:19:39 +04:30
|
|
|
}
|
2024-07-29 19:40:24 +09:00
|
|
|
else if (CompareLowerCaseStrings(CommandTokens.at(0), "!db"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2024-07-06 22:46:57 +09:00
|
|
|
HyperDbgShowMemoryOrDisassemble(DEBUGGER_SHOW_COMMAND_DB,
|
2024-07-29 19:40:24 +09:00
|
|
|
TargetAddress,
|
|
|
|
|
DEBUGGER_READ_PHYSICAL_ADDRESS,
|
|
|
|
|
READ_FROM_KERNEL,
|
|
|
|
|
Pid,
|
|
|
|
|
Length,
|
|
|
|
|
NULL);
|
2021-03-22 18:19:39 +04:30
|
|
|
}
|
2024-07-29 19:40:24 +09:00
|
|
|
else if (CompareLowerCaseStrings(CommandTokens.at(0), "!dc"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2024-07-06 22:46:57 +09:00
|
|
|
HyperDbgShowMemoryOrDisassemble(DEBUGGER_SHOW_COMMAND_DC,
|
2024-07-29 19:40:24 +09:00
|
|
|
TargetAddress,
|
|
|
|
|
DEBUGGER_READ_PHYSICAL_ADDRESS,
|
|
|
|
|
READ_FROM_KERNEL,
|
|
|
|
|
Pid,
|
|
|
|
|
Length,
|
|
|
|
|
NULL);
|
2021-03-22 18:19:39 +04:30
|
|
|
}
|
2024-07-29 19:40:24 +09:00
|
|
|
else if (CompareLowerCaseStrings(CommandTokens.at(0), "!dd"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2024-07-06 22:46:57 +09:00
|
|
|
HyperDbgShowMemoryOrDisassemble(DEBUGGER_SHOW_COMMAND_DD,
|
2024-07-29 19:40:24 +09:00
|
|
|
TargetAddress,
|
|
|
|
|
DEBUGGER_READ_PHYSICAL_ADDRESS,
|
|
|
|
|
READ_FROM_KERNEL,
|
|
|
|
|
Pid,
|
|
|
|
|
Length,
|
|
|
|
|
NULL);
|
2021-03-22 18:19:39 +04:30
|
|
|
}
|
2024-07-29 19:40:24 +09:00
|
|
|
else if (CompareLowerCaseStrings(CommandTokens.at(0), "!dq"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2024-07-06 22:46:57 +09:00
|
|
|
HyperDbgShowMemoryOrDisassemble(DEBUGGER_SHOW_COMMAND_DQ,
|
2024-07-29 19:40:24 +09:00
|
|
|
TargetAddress,
|
|
|
|
|
DEBUGGER_READ_PHYSICAL_ADDRESS,
|
|
|
|
|
READ_FROM_KERNEL,
|
|
|
|
|
Pid,
|
|
|
|
|
Length,
|
|
|
|
|
NULL);
|
2021-03-22 18:19:39 +04:30
|
|
|
}
|
2020-05-29 14:42:51 -07:00
|
|
|
|
2020-05-27 09:59:17 -07:00
|
|
|
//
|
2021-03-22 18:19:39 +04:30
|
|
|
// Disassembler (!u or u or u2 !u2)
|
2020-05-27 09:59:17 -07:00
|
|
|
//
|
2024-07-29 19:40:24 +09:00
|
|
|
else if (CompareLowerCaseStrings(CommandTokens.at(0), "u") || CompareLowerCaseStrings(CommandTokens.at(0), "u64"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2024-07-06 22:46:57 +09:00
|
|
|
HyperDbgShowMemoryOrDisassemble(
|
2021-03-22 18:19:39 +04:30
|
|
|
DEBUGGER_SHOW_COMMAND_DISASSEMBLE64,
|
|
|
|
|
TargetAddress,
|
|
|
|
|
DEBUGGER_READ_VIRTUAL_ADDRESS,
|
|
|
|
|
READ_FROM_KERNEL,
|
|
|
|
|
Pid,
|
2022-04-16 03:27:30 +04:30
|
|
|
Length,
|
|
|
|
|
NULL);
|
2021-03-22 18:19:39 +04:30
|
|
|
}
|
2024-07-29 19:40:24 +09:00
|
|
|
else if (CompareLowerCaseStrings(CommandTokens.at(0), "!u") || CompareLowerCaseStrings(CommandTokens.at(0), "!u64"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2024-07-06 22:46:57 +09:00
|
|
|
HyperDbgShowMemoryOrDisassemble(
|
2021-03-22 18:19:39 +04:30
|
|
|
DEBUGGER_SHOW_COMMAND_DISASSEMBLE64,
|
|
|
|
|
TargetAddress,
|
|
|
|
|
DEBUGGER_READ_PHYSICAL_ADDRESS,
|
|
|
|
|
READ_FROM_KERNEL,
|
|
|
|
|
Pid,
|
2022-04-16 03:27:30 +04:30
|
|
|
Length,
|
|
|
|
|
NULL);
|
2021-03-22 18:19:39 +04:30
|
|
|
}
|
2024-07-29 19:40:24 +09:00
|
|
|
else if (CompareLowerCaseStrings(CommandTokens.at(0), "u2") || CompareLowerCaseStrings(CommandTokens.at(0), "u32"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2024-07-06 22:46:57 +09:00
|
|
|
HyperDbgShowMemoryOrDisassemble(
|
2021-03-22 18:19:39 +04:30
|
|
|
DEBUGGER_SHOW_COMMAND_DISASSEMBLE32,
|
|
|
|
|
TargetAddress,
|
|
|
|
|
DEBUGGER_READ_VIRTUAL_ADDRESS,
|
|
|
|
|
READ_FROM_KERNEL,
|
|
|
|
|
Pid,
|
2022-04-16 03:27:30 +04:30
|
|
|
Length,
|
|
|
|
|
NULL);
|
2021-03-22 18:19:39 +04:30
|
|
|
}
|
2024-07-29 19:40:24 +09:00
|
|
|
else if (CompareLowerCaseStrings(CommandTokens.at(0), "!u2") || CompareLowerCaseStrings(CommandTokens.at(0), "!u32"))
|
2021-03-22 18:19:39 +04:30
|
|
|
{
|
2024-07-06 22:46:57 +09:00
|
|
|
HyperDbgShowMemoryOrDisassemble(
|
2021-03-22 18:19:39 +04:30
|
|
|
DEBUGGER_SHOW_COMMAND_DISASSEMBLE32,
|
|
|
|
|
TargetAddress,
|
|
|
|
|
DEBUGGER_READ_PHYSICAL_ADDRESS,
|
|
|
|
|
READ_FROM_KERNEL,
|
|
|
|
|
Pid,
|
2022-04-16 03:27:30 +04:30
|
|
|
Length,
|
|
|
|
|
NULL);
|
2021-03-22 18:19:39 +04:30
|
|
|
}
|
2026-07-10 07:55:56 -07:00
|
|
|
else if (IsDlCommand)
|
|
|
|
|
{
|
2026-07-11 19:59:08 +02:00
|
|
|
HyperDbgShowMemoryLinkedList(TargetAddress,
|
|
|
|
|
CompareLowerCaseStrings(CommandTokens.at(0), "dl") ? DEBUGGER_READ_VIRTUAL_ADDRESS : DEBUGGER_READ_PHYSICAL_ADDRESS,
|
|
|
|
|
Pid,
|
|
|
|
|
Offset,
|
|
|
|
|
MaxNodes);
|
2026-07-10 07:55:56 -07:00
|
|
|
}
|
2026-07-11 19:59:08 +02:00
|
|
|
}
|