CLI main function.
37{
39 string previous_command;
41
42
43
44
45#ifdef _WIN32
46 SetConsoleOutputCP(CP_UTF8);
47#endif
48
50 printf(
"Please visit https://docs.hyperdbg.org for more information...\n");
51 printf(
"HyperDbg is released under the GNU Public License v3 (GPLv3).\n\n");
52
53#if BETA_VERSION == 1
54 printf(
"Notice: This is a beta release and may contain bugs or stability issues. ");
55 printf(
"If you encounter any problems, please report them and consider using the previous stable release.\n\n");
56#endif
57
58 if (argc != 1)
59 {
60
61
62
63 if (!strcmp(
argv[1],
"--script"))
64 {
65
66
67
69 }
70 else
71 {
72 printf(
"err, invalid command line options passed to the HyperDbg!\n");
73 return 1;
74 }
75 }
76
77 while (!exit_from_debugger)
78 {
80
81 string current_command = "";
82
83
84
85
87
88 GetMultiLineCommand:
89
90 string temp_command = "";
91
92 getline(cin, temp_command);
93
94 if (cin.fail() || cin.eof())
95 {
96 cin.clear();
97
99
100
101
102
103 continue;
104 }
105
106
107
108
110 {
111
112
113
115
116
117
118
119 current_command += temp_command + "\n";
120
121
122
123
125
126
127
128
129 goto GetMultiLineCommand;
130 }
131 else
132 {
133
134
135
137
138
139
140
141
142 current_command += temp_command;
143 }
144
146 {
147
148
149
150 current_command = previous_command;
151 }
152 else
153 {
154
155
156
157 previous_command = current_command;
158 }
159
161
162
163
164
165 if (CommandExecutionResult == 1)
166 {
167
168
169
170 exit_from_debugger = true;
171 }
172 if (CommandExecutionResult != 2)
173 {
175 }
176 }
177
178 return 0;
179}
IMPORT_EXPORT_LIBHYPERDBG INT hyperdbg_u_script_read_file_and_execute_commandline(INT argc, CHAR *argv[])
Parsing the command line options for scripts.
Definition export.cpp:301
IMPORT_EXPORT_LIBHYPERDBG BOOLEAN hyperdbg_u_continue_previous_command()
Some of commands like stepping commands (i, p, t) and etc. need to be repeated when the user press en...
Definition export.cpp:315
IMPORT_EXPORT_LIBHYPERDBG VOID hyperdbg_u_show_signature()
Show the signature of the debugger.
Definition export.cpp:248
IMPORT_EXPORT_LIBHYPERDBG INT hyperdbg_u_run_command(CHAR *command)
Run a command.
Definition export.cpp:205
IMPORT_EXPORT_LIBHYPERDBG BOOLEAN hyperdbg_u_check_multiline_command(CHAR *current_command, BOOLEAN reset)
Check if the command is a multiline command or not.
Definition export.cpp:328
char ** argv
Definition symbol-parser.h:47