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

.disconnect command More...

#include "pch.h"

Functions

VOID CommandDisconnectHelp ()
 help of the .disconnect command
VOID CommandDisconnect (vector< CommandToken > CommandTokens, string Command)
 .disconnect command handler

Variables

BOOLEAN g_IsConnectedToHyperDbgLocally
 Shows whether the user is allowed to use 'load' command to load modules locally in VMI (virtual machine introspection) mode.
BOOLEAN g_IsConnectedToRemoteDebuggee
 Shows whether the current debugger is the host and connected to a remote debuggee (guest).
HANDLE g_RemoteDebuggeeListeningThread
 In debugger (not debuggee), we save the ip of server debuggee in this variable to use it later e.g, in signature.
HANDLE g_EndOfMessageReceivedEvent
 Handle to if the end of the message received (for showing signature).

Detailed Description

.disconnect command

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.1
Date
2020-05-27

Function Documentation

◆ CommandDisconnect()

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

.disconnect command handler

Parameters
CommandTokens
Command
Returns
VOID
46{
47 if (CommandTokens.size() != 1)
48 {
49 ShowMessages("incorrect use of the '%s'\n\n",
50 GetCaseSensitiveStringFromCommandToken(CommandTokens.at(0)).c_str());
52 return;
53 }
54
56 {
57 ShowMessages("you're not connected to any instance of HyperDbg, did you "
58 "use '.connect'? \n");
59 return;
60 }
61
62 //
63 // Check if it's local debugger and the driver is still
64 // loading (not unloaded)
65 //
67 {
68 ShowMessages("you cannot disconnect in local debugging while the "
69 "driver is still loaded. please use 'unload' command before "
70 "disconnecting from the current instance of debugger\n");
71 return;
72 }
73
74 //
75 // Disconnect the session
76 //
78
79 //
80 // This computer is connected to a remote system
81 //
83 {
84 //
85 // We should kill the thread that was listening for the
86 // remote commands and close the connection
87 //
88 TerminateThread(g_RemoteDebuggeeListeningThread, 0);
90 CloseHandle(g_EndOfMessageReceivedEvent);
92
94
96 }
97
98 ShowMessages("disconnected successfully\n");
99}
#define FALSE
Definition BasicTypes.h:113
std::string GetCaseSensitiveStringFromCommandToken(CommandToken TargetToken)
Get case sensitive string from command token.
Definition common.cpp:467
HANDLE g_RemoteDebuggeeListeningThread
In debugger (not debuggee), we save the ip of server debuggee in this variable to use it later e....
Definition globals.h:146
VOID CommandDisconnectHelp()
help of the .disconnect command
Definition disconnect.cpp:28
HANDLE g_EndOfMessageReceivedEvent
Handle to if the end of the message received (for showing signature).
Definition globals.h:159
BOOLEAN g_IsConnectedToRemoteDebuggee
Shows whether the current debugger is the host and connected to a remote debuggee (guest).
Definition globals.h:96
BOOLEAN g_IsConnectedToHyperDbgLocally
Shows whether the user is allowed to use 'load' command to load modules locally in VMI (virtual machi...
Definition globals.h:89
HANDLE g_DeviceHandle
Holds the global handle of device which is used to send the request to the kernel by IOCTL,...
Definition globals.h:481
NULL()
Definition test-case-generator.py:530
INT RemoteConnectionCloseTheConnectionWithDebuggee()
Close the connect from client side to the debuggee.
Definition remote-connection.cpp:504

◆ CommandDisconnectHelp()

VOID CommandDisconnectHelp ( )

help of the .disconnect command

Returns
VOID
29{
30 ShowMessages(".disconnect : disconnects from a debugging session (it won't "
31 "unload the modules).\n\n");
32
33 ShowMessages("syntax : \t.disconnect \n");
34}

Variable Documentation

◆ g_EndOfMessageReceivedEvent

HANDLE g_EndOfMessageReceivedEvent
extern

Handle to if the end of the message received (for showing signature).

◆ g_IsConnectedToHyperDbgLocally

BOOLEAN g_IsConnectedToHyperDbgLocally
extern

Shows whether the user is allowed to use 'load' command to load modules locally in VMI (virtual machine introspection) mode.

◆ g_IsConnectedToRemoteDebuggee

BOOLEAN g_IsConnectedToRemoteDebuggee
extern

Shows whether the current debugger is the host and connected to a remote debuggee (guest).

◆ g_RemoteDebuggeeListeningThread

HANDLE g_RemoteDebuggeeListeningThread
extern

In debugger (not debuggee), we save the ip of server debuggee in this variable to use it later e.g, in signature.