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< string > SplitCommand, 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< string > SplitCommand,
string Command )

.disconnect command handler

Parameters
SplitCommand
Command
Returns
VOID
45{
46 if (SplitCommand.size() != 1)
47 {
48 ShowMessages("incorrect use of the '.disconnect'\n\n");
50 return;
51 }
52
54 {
55 ShowMessages("you're not connected to any instance of HyperDbg, did you "
56 "use '.connect'? \n");
57 return;
58 }
59
60 //
61 // Check if it's local debugger and the driver is still
62 // loading (not unloaded)
63 //
65 {
66 ShowMessages("you cannot disconnect in local debugging while the "
67 "driver is still loaded. please use 'unload' command before "
68 "disconnecting from the current instance of debugger\n");
69 return;
70 }
71
72 //
73 // Disconnect the session
74 //
76
77 //
78 // This computer is connected to a remote system
79 //
81 {
82 //
83 // We should kill the thread that was listening for the
84 // remote commands and close the connection
85 //
86 TerminateThread(g_RemoteDebuggeeListeningThread, 0);
88 CloseHandle(g_EndOfMessageReceivedEvent);
90
92
94 }
95
96 ShowMessages("disconnected successfully\n");
97}
#define FALSE
Definition BasicTypes.h:54
BOOLEAN g_IsConnectedToRemoteDebuggee
Shows whether the current debugger is the host and connected to a remote debuggee (guest)
Definition globals.h:74
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:124
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:137
BOOLEAN g_IsConnectedToHyperDbgLocally
Shows whether the user is allowed to use 'load' command to load modules locally in VMI (virtual machi...
Definition globals.h:67
HANDLE g_DeviceHandle
Holds the global handle of device which is used to send the request to the kernel by IOCTL,...
Definition globals.h:471
VOID ShowMessages(const char *Fmt,...)
Show messages.
Definition libhyperdbg.cpp:96
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.