CLI main function.
38{
40 string previous_command;
42
43
44
45
46 SetConsoleOutputCP(CP_UTF8);
47
49 printf("Please visit https://docs.hyperdbg.org for more information...\n");
50 printf("HyperDbg is released under the GNU Public License v3 (GPLv3).\n\n");
51
52 if (argc != 1)
53 {
54
55
56
57 if (!strcmp(
argv[1],
"--script"))
58 {
59
60
61
63 }
64 else
65 {
66 printf("err, invalid command line options passed to the HyperDbg!\n");
67 return 1;
68 }
69 }
70
71 while (!exit_from_debugger)
72 {
74
75 string current_command = "";
76
77
78
79
81
82 GetMultiLinecCommand:
83
84 string temp_command = "";
85
86 getline(cin, temp_command);
87
88 if (cin.fail() || cin.eof())
89 {
90 cin.clear();
91
92 printf("\n\n");
93
94
95
96
97 continue;
98 }
99
100
101
102
104 {
105
106
107
109
110
111
112
113 current_command += temp_command + "\n";
114
115
116
117
118 printf("> ");
119
120
121
122
123 goto GetMultiLinecCommand;
124 }
125 else
126 {
127
128
129
131
132
133
134
135
136 current_command += temp_command;
137 }
138
140 {
141
142
143
144 current_command = previous_command;
145 }
146 else
147 {
148
149
150
151 previous_command = current_command;
152 }
153
155
156
157
158
159 if (CommandExecutionResult == 1)
160 {
161
162
163
164 exit_from_debugger = true;
165 }
166 if (CommandExecutionResult != 2)
167 {
168 printf("\n");
169 }
170 }
171
172 return 0;
173}
UCHAR BOOLEAN
Definition BasicTypes.h:39
int INT
Definition BasicTypes.h:26
#define TRUE
Definition BasicTypes.h:55
#define FALSE
Definition BasicTypes.h:54
char CHAR
Definition BasicTypes.h:31
const unsigned char BuildVersion[]
Definition Constants.h:113
const unsigned char CompleteVersion[]
Definition Constants.h:111
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:169
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:183
IMPORT_EXPORT_LIBHYPERDBG VOID hyperdbg_u_show_signature()
Show the signature of the debugger.
Definition export.cpp:116
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:196
IMPORT_EXPORT_LIBHYPERDBG INT hyperdbg_u_interpreter(CHAR *command)
Interprets the command.
Definition export.cpp:105
char ** argv
Definition symbol-parser.h:46