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

listen command handler

Parameters
CommandTokens
Command
Returns
VOID
55{
56 string Port;
57
58 if (CommandTokens.size() >= 3)
59 {
60 //
61 // Means that user entered invalid parameters
62 //
63 ShowMessages("incorrect use of the '%s'\n\n",
64 GetCaseSensitiveStringFromCommandToken(CommandTokens.at(0)).c_str());
66 return;
67 }
68
71 {
72 ShowMessages("you're connected to a debugger, please use '.disconnect' "
73 "command\n");
74 return;
75 }
76
77 //
78 // Check to avoid using this command in debugger-mode
79 //
81 {
82 ShowMessages("you're connected to a an instance of HyperDbg, please use "
83 "'.debug close' command\n");
84 return;
85 }
86
87 if (CommandTokens.size() == 1)
88 {
89 //
90 // listen on default port
91 //
92 ShowMessages("listening on %s ...\n", DEFAULT_PORT);
94
95 return;
96 }
97 else if (CommandTokens.size() == 2)
98 {
99 Port = GetCaseSensitiveStringFromCommandToken(CommandTokens.at(1));
100
101 //
102 // means that probably wants to listen
103 // on a specific port, let's see if the
104 // port is valid or not
105 //
106 if (!IsNumber(Port) || stoi(Port) > 65535 || stoi(Port) < 0)
107 {
108 ShowMessages("incorrect port\n");
109 return;
110 }
111
112 //
113 // listen on the port
114 //
115 ShowMessages("listening on %s ...\n", Port.c_str());
116 RemoteConnectionListen(Port.c_str());
117 }
118 else
119 {
120 ShowMessages("incorrect use of the '%s'\n\n",
121 GetCaseSensitiveStringFromCommandToken(CommandTokens.at(0)).c_str());
123 return;
124 }
125}
BOOLEAN g_IsSerialConnectedToRemoteDebuggee
Shows if the debugger was connected to remote debuggee over (A remote guest).
Definition globals.h:253
#define DEFAULT_PORT
default port of HyperDbg for listening by debuggee (server, guest)
Definition Constants.h:331
std::string GetCaseSensitiveStringFromCommandToken(CommandToken TargetToken)
Get case sensitive string from command token.
Definition common.cpp:467
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
BOOLEAN IsNumber(const string &str)
VOID CommandListenHelp()
help of the listen command
Definition listen.cpp:29
BOOLEAN g_IsSerialConnectedToRemoteDebugger
Shows if the debugger was connected to remote debugger (A remote host).
Definition rev.cpp:18
BOOLEAN g_IsConnectedToRemoteDebugger
Shows whether the current system is a guest (debuggee) and a remote debugger is connected to this sys...
Definition globals.h:103
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).