HyperDbg Debugger
Loading...
Searching...
No Matches
rev.cpp File Reference

!rev command More...

#include "pch.h"

Functions

VOID CommandRevHelp ()
 help of the !rev command
VOID CommandRev (vector< CommandToken > CommandTokens, string Command)
 !rev command handler

Variables

BOOLEAN g_IsSerialConnectedToRemoteDebugger
 Shows if the debugger was connected to remote debugger (A remote host).

Detailed Description

!rev command

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.2
Date
2023-03-22

Function Documentation

◆ CommandRev()

VOID CommandRev ( vector< CommandToken > CommandTokens,
string Command )

!rev command handler

Parameters
CommandTokens
Command
Returns
VOID
51{
53 BOOLEAN SetPid = FALSE;
54 UINT32 TargetPid = NULL;
55 BOOLEAN IgnoreFirstCommand = TRUE;
58
59 //
60 // Interpret command specific details
61 //
62 for (auto Section : CommandTokens)
63 {
64 if (CompareLowerCaseStrings(Section, "!rev") && IgnoreFirstCommand)
65 {
66 IgnoreFirstCommand = FALSE;
67 continue;
68 }
69 else if (CompareLowerCaseStrings(Section, "pid") && !SetPid)
70 {
71 SetPid = TRUE;
72 }
73 else if (SetPid)
74 {
75 if (!ConvertTokenToUInt32(Section, &TargetPid))
76 {
77 //
78 // couldn't resolve or unknown parameter
79 //
80 ShowMessages("err, couldn't resolve error at '%s'\n\n",
83 return;
84 }
85 SetPid = FALSE;
86 }
87 else if (CompareLowerCaseStrings(Section, "pattern"))
88 {
90 }
91 else if (CompareLowerCaseStrings(Section, "reconstruct"))
92 {
94 }
95 else
96 {
97 //
98 // Unknown parameter
99 //
100 ShowMessages("err, couldn't resolve error at '%s'\n\n",
103 return;
104 }
105 }
106
107 if (SetPid)
108 {
109 ShowMessages("err, please enter a valid process id in hex format, "
110 "or if you want to use it in decimal format, add '0n' "
111 "prefix to the number\n");
112 return;
113 }
114
115 RevRequest.ProcessId = TargetPid;
116
117 // ================================================================================
118
119 //
120 // Send the request to the hypervisor (kernel)
121 //
122 RevRequestService(&RevRequest);
123}
UCHAR BOOLEAN
Definition BasicTypes.h:35
#define TRUE
Definition BasicTypes.h:114
#define FALSE
Definition BasicTypes.h:113
unsigned int UINT32
Definition BasicTypes.h:54
struct _REVERSING_MACHINE_RECONSTRUCT_MEMORY_REQUEST REVERSING_MACHINE_RECONSTRUCT_MEMORY_REQUEST
requests for !rev command
@ REVERSING_MACHINE_RECONSTRUCT_MEMORY_TYPE_PATTERN
Definition RequestStructures.h:134
@ REVERSING_MACHINE_RECONSTRUCT_MEMORY_TYPE_UNKNOWN
Definition RequestStructures.h:132
@ REVERSING_MACHINE_RECONSTRUCT_MEMORY_TYPE_RECONSTRUCT
Definition RequestStructures.h:133
enum _REVERSING_MACHINE_RECONSTRUCT_MEMORY_TYPE REVERSING_MACHINE_RECONSTRUCT_MEMORY_TYPE
different types of reconstruct requests
@ REVERSING_MACHINE_RECONSTRUCT_MEMORY_MODE_UNKNOWN
Definition RequestStructures.h:121
enum _REVERSING_MACHINE_RECONSTRUCT_MEMORY_MODE REVERSING_MACHINE_RECONSTRUCT_MEMORY_MODE
different modes of reconstruct requests
std::string GetCaseSensitiveStringFromCommandToken(CommandToken TargetToken)
Get case sensitive string from command token.
Definition common.cpp:467
BOOLEAN CompareLowerCaseStrings(CommandToken TargetToken, const CHAR *StringToCompare)
Compare lower case strings.
Definition common.cpp:503
BOOLEAN ConvertTokenToUInt32(CommandToken TargetToken, PUINT32 Result)
check and convert command token to a 32 bit unsigned integer
Definition common.cpp:546
NULL()
Definition test-case-generator.py:530
BOOLEAN RevRequestService(REVERSING_MACHINE_RECONSTRUCT_MEMORY_REQUEST *RevRequest)
Request service from the reversing machine.
Definition rev-ctrl.cpp:28
VOID CommandRevHelp()
help of the !rev command
Definition rev.cpp:26
UINT32 ProcessId
Definition RequestStructures.h:146

◆ CommandRevHelp()

VOID CommandRevHelp ( )

help of the !rev command

Returns
VOID
27{
28 ShowMessages("!rev : uses the reversing machine module in order to reconstruct the programmer/memory assumptions.\n\n");
29
30 ShowMessages("syntax : \t!rev [config] [pid ProcessId (hex)]\n");
31 ShowMessages("syntax : \t!rev [path Path (string)] [Parameters (string)]\n");
32
33 ShowMessages("\n");
34 ShowMessages("\t\te.g : !rev path c:\\reverse eng\\my_file.exe\n");
35 ShowMessages("\t\te.g : !rev pattern\n");
36 ShowMessages("\t\te.g : !rev reconstruct\n");
37 ShowMessages("\t\te.g : !rev pattern pid 1c0\n");
38 ShowMessages("\t\te.g : !rev reconstruct pid 1c0\n");
39}

Variable Documentation

◆ g_IsSerialConnectedToRemoteDebugger

BOOLEAN g_IsSerialConnectedToRemoteDebugger
extern

Shows if the debugger was connected to remote debugger (A remote host).