107{
108 string ip;
109 string port;
110
113 {
114 ShowMessages(
"you're connected to a debugger, please use '.disconnect' "
115 "command\n");
116 return;
117 }
118
121 {
122 ShowMessages(
"you're connected to a an instance of HyperDbg, please use "
123 "'.debug close' command\n");
124 return;
125 }
126
127 if (SplitCommand.size() == 1)
128 {
129
130
131
132
135 return;
136 }
137 else if (SplitCommand.at(1) == "local" && SplitCommand.size() == 2)
138 {
139
140
141
144 return;
145 }
146 else if (SplitCommand.size() == 3 || SplitCommand.size() == 2)
147 {
148 ip = SplitCommand.at(1);
149
150 if (SplitCommand.size() == 3)
151 {
152 port = SplitCommand.at(2);
153 }
154
155
156
157
158
159
161 {
163 return;
164 }
165
166 if (SplitCommand.size() == 3)
167 {
168 if (!
IsNumber(port) || stoi(port) > 65535 || stoi(port) < 0)
169 {
171 return;
172 }
173
174
175
176
178 }
179 else
180 {
181
182
183
185 }
186 }
187 else
188 {
191 return;
192 }
193}
BOOLEAN IsNumber(const string &str)
check if given string is a numeric string or not
Definition common.cpp:145
BOOLEAN ValidateIP(const string &ip)
Function to validate an IP address.
Definition common.cpp:469
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
VOID ConnectLocalDebugger()
Connect to local debugger.
Definition connect.cpp:50
VOID CommandConnectHelp()
help of the .connect command
Definition connect.cpp:31
BOOLEAN ConnectRemoteDebugger(const CHAR *Ip, const CHAR *Port)
Connect to remote debugger.
Definition connect.cpp:61
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
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 ShowMessages(const char *Fmt,...)
Show messages.
Definition libhyperdbg.cpp:96