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

print command More...

#include "pch.h"

Functions

VOID CommandPrintHelp ()
 help of the print command
 
VOID CommandPrint (vector< string > SplitCommand, string Command)
 handler of print command
 

Variables

BOOLEAN g_IsSerialConnectedToRemoteDebuggee
 Shows if the debugger was connected to remote debuggee over (A remote guest)
 

Detailed Description

print command

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
M.H. Gholamrezaei (mh@hy.nosp@m.perd.nosp@m.bg.or.nosp@m.g)
Version
0.1
Date
2020-10-08

Function Documentation

◆ CommandPrint()

VOID CommandPrint ( vector< string > SplitCommand,
string Command )

handler of print command

Parameters
SplitCommand
Command
Returns
VOID
47{
48 PVOID CodeBuffer;
50 UINT32 BufferLength;
51 UINT32 Pointer;
52
53 if (SplitCommand.size() == 1)
54 {
55 ShowMessages("incorrect use of the 'print'\n\n");
57 return;
58 }
59
60 //
61 // Trim the command
62 //
63 Trim(Command);
64
65 //
66 // Remove print from it
67 //
68 Command.erase(0, SplitCommand.at(0).size());
69
70 //
71 // Trim it again
72 //
73 Trim(Command);
74
75 //
76 // Prepend and append 'print(' and ')'
77 //
78 Command.insert(0, "print(");
79 Command.append(");");
80
82 {
83 //
84 // Send over serial
85 //
86
87 //
88 // Run script engine handler
89 //
90 CodeBuffer = ScriptEngineParseWrapper((char *)Command.c_str(), TRUE);
91
92 if (CodeBuffer == NULL)
93 {
94 //
95 // return to show that this item contains an script
96 //
97 return;
98 }
99
100 //
101 // Print symbols (test)
102 //
103 // PrintSymbolBufferWrapper(CodeBuffer);
104
105 //
106 // Set the buffer and length
107 //
109 BufferLength = ScriptEngineWrapperGetSize(CodeBuffer);
110 Pointer = ScriptEngineWrapperGetPointer(CodeBuffer);
111
112 //
113 // Send it to the remote debuggee
114 //
115 KdSendScriptPacketToDebuggee(BufferAddress, BufferLength, Pointer, FALSE);
116
117 //
118 // Remove the buffer of script engine interpreted code
119 //
121
122 ShowMessages("\n");
123 }
124 else
125 {
126 //
127 // error
128 //
129 ShowMessages("err, you're not connected to any debuggee\n");
130 }
131}
#define TRUE
Definition BasicTypes.h:55
#define FALSE
Definition BasicTypes.h:54
unsigned __int64 UINT64
Definition BasicTypes.h:21
unsigned int UINT32
Definition BasicTypes.h:48
UINT64 BOOLEAN PVOID BufferAddress
Definition HyperDbgScriptImports.h:67
void Trim(std::string &s)
trim from both ends and start of a string (in place)
Definition common.cpp:594
BOOLEAN KdSendScriptPacketToDebuggee(UINT64 BufferAddress, UINT32 BufferLength, UINT32 Pointer, BOOLEAN IsFormat)
Sends a script packet to the debuggee.
Definition kd.cpp:1056
VOID ShowMessages(const char *Fmt,...)
Show messages.
Definition libhyperdbg.cpp:96
VOID CommandPrintHelp()
help of the print command
Definition print.cpp:28
BOOLEAN g_IsSerialConnectedToRemoteDebuggee
Shows if the debugger was connected to remote debuggee over (A remote guest)
Definition globals.h:231
UINT32 ScriptEngineWrapperGetSize(PVOID SymbolBuffer)
wrapper for getting size
Definition script-engine-wrapper.cpp:834
UINT32 ScriptEngineWrapperGetPointer(PVOID SymbolBuffer)
wrapper for getting pointer
Definition script-engine-wrapper.cpp:848
PVOID ScriptEngineParseWrapper(char *Expr, BOOLEAN ShowErrorMessageIfAny)
ScriptEngineParse wrapper.
Definition script-engine-wrapper.cpp:267
UINT64 ScriptEngineWrapperGetHead(PVOID SymbolBuffer)
wrapper for getting head
Definition script-engine-wrapper.cpp:822
VOID ScriptEngineWrapperRemoveSymbolBuffer(PVOID SymbolBuffer)
wrapper for removing symbol buffer
Definition script-engine-wrapper.cpp:860

◆ CommandPrintHelp()

VOID CommandPrintHelp ( )

help of the print command

Returns
VOID
29{
30 ShowMessages("print : evaluates expressions.\n\n");
31
32 ShowMessages("syntax : \tprint [Expression (string)]\n");
33
34 ShowMessages("\n");
35 ShowMessages("\t\te.g : print dq(poi(@rcx))\n");
36}

Variable Documentation

◆ g_IsSerialConnectedToRemoteDebuggee

BOOLEAN g_IsSerialConnectedToRemoteDebuggee
extern

Shows if the debugger was connected to remote debuggee over (A remote guest)