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

.listen command More...

#include "pch.h"

Functions

VOID CommandListenHelp ()
 help of the listen command
 
VOID CommandListen (vector< string > SplitCommand, string Command)
 listen 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)
 
BOOLEAN g_IsConnectedToRemoteDebugger
 Shows whether the current system is a guest (debuggee) and a remote debugger is connected to this system.
 
BOOLEAN g_IsSerialConnectedToRemoteDebugger
 Shows if the debugger was connected to remote debugger (A remote host)
 
BOOLEAN g_IsSerialConnectedToRemoteDebuggee
 Shows if the debugger was connected to remote debuggee over (A remote guest)
 

Detailed Description

.listen command

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

Function Documentation

◆ CommandListen()

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

listen command handler

Parameters
SplitCommand
Command
Returns
VOID
54{
55 string port;
56
57 if (SplitCommand.size() >= 3)
58 {
59 //
60 // Means that user entered invalid parameters
61 //
62 ShowMessages("incorrect use of the '.listen'\n\n");
64 return;
65 }
66
69 {
70 ShowMessages("you're connected to a debugger, please use '.disconnect' "
71 "command\n");
72 return;
73 }
74
75 //
76 // Check to avoid using this command in debugger-mode
77 //
79 {
80 ShowMessages("you're connected to a an instance of HyperDbg, please use "
81 "'.debug close' command\n");
82 return;
83 }
84
85 if (SplitCommand.size() == 1)
86 {
87 //
88 // listen on default port
89 //
90 ShowMessages("listening on %s ...\n", DEFAULT_PORT);
92
93 return;
94 }
95 else if (SplitCommand.size() == 2)
96 {
97 port = SplitCommand.at(1);
98
99 //
100 // means that probably wants to listen
101 // on a specific port, let's see if the
102 // port is valid or not
103 //
104 if (!IsNumber(port) || stoi(port) > 65535 || stoi(port) < 0)
105 {
106 ShowMessages("incorrect port\n");
107 return;
108 }
109
110 //
111 // listen on the port
112 //
113 ShowMessages("listening on %s ...\n", port.c_str());
114 RemoteConnectionListen(port.c_str());
115 }
116 else
117 {
118 ShowMessages("incorrect use of the '.listen'\n\n");
120 return;
121 }
122}
#define DEFAULT_PORT
default port of HyperDbg for listening by debuggee (server, guest)
Definition Constants.h:323
BOOLEAN IsNumber(const string &str)
check if given string is a numeric string or not
Definition common.cpp:145
VOID ShowMessages(const char *Fmt,...)
Show messages.
Definition libhyperdbg.cpp:96
BOOLEAN g_IsSerialConnectedToRemoteDebugger
Shows if the debugger was connected to remote debugger (A remote host)
Definition globals.h:238
BOOLEAN g_IsConnectedToRemoteDebuggee
Shows whether the current debugger is the host and connected to a remote debuggee (guest)
Definition globals.h:74
BOOLEAN g_IsConnectedToRemoteDebugger
Shows whether the current system is a guest (debuggee) and a remote debugger is connected to this sys...
Definition globals.h:81
VOID CommandListenHelp()
help of the listen command
Definition listen.cpp:29
BOOLEAN g_IsSerialConnectedToRemoteDebuggee
Shows if the debugger was connected to remote debuggee over (A remote guest)
Definition globals.h:231
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
VOID RemoteConnectionListen(PCSTR Port)
Listen of a port and wait for a client connection.
Definition remote-connection.cpp:40

◆ CommandListenHelp()

VOID CommandListenHelp ( )

help of the listen command

Returns
VOID
30{
31 ShowMessages(".listen : listens for a client to connect to HyperDbg (works as "
32 "a guest server).\n\n");
33
34 ShowMessages("note : \tif you don't specify port then HyperDbg uses the "
35 "default port (%s)\n",
37
38 ShowMessages("syntax : \t.listen [Port (decimal)]\n");
39
40 ShowMessages("\n");
41 ShowMessages("\t\te.g : .listen\n");
42 ShowMessages("\t\te.g : .listen 50000\n");
43}

Variable Documentation

◆ 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_IsConnectedToRemoteDebugger

BOOLEAN g_IsConnectedToRemoteDebugger
extern

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

◆ g_IsSerialConnectedToRemoteDebuggee

BOOLEAN g_IsSerialConnectedToRemoteDebuggee
extern

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

◆ g_IsSerialConnectedToRemoteDebugger

BOOLEAN g_IsSerialConnectedToRemoteDebugger
extern

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