124 std::stringstream ss1;
125 ss1 <<
"Scan only processes with given PIDs";
126 std::stringstream ss2;
127 ss2 << INFO_SPACER <<
"Example: 5367" << PARAM_LIST_SEPARATOR <<
"0xa90";
128 this->addParam(
new IntListParam(
PARAM_PID,
false, PARAM_LIST_SEPARATOR));
129 this->setInfo(
PARAM_PID, ss1.str(), ss2.str());
132 std::stringstream ss1;
133 ss1 <<
"Scan only processes with given names.";
134 std::stringstream ss2;
135 ss2 << INFO_SPACER <<
"Example: iexplore.exe" << PARAM_LIST_SEPARATOR <<
"firefox.exe";
136 this->addParam(
new StringListParam(
PARAM_PNAME,
false, PARAM_LIST_SEPARATOR));
140 std::stringstream ss1;
141 ss1 <<
"Make a unique, timestamped directory for the output of each scan.";
142 std::stringstream ss2;
143 ss2 << INFO_SPACER <<
"Prevents overwriting results from previous scans.";
148 std::stringstream ss1;
149 ss1 <<
"Do not scan process/es with given name/s.";
150 std::stringstream ss2;
151 ss2 << INFO_SPACER <<
"Example: explorer.exe" << PARAM_LIST_SEPARATOR <<
"conhost.exe";
156 this->addParam(
new IntParam(
PARAM_PTIMES,
false, IntParam::INT_BASE_DEC));
157 this->setInfo(
PARAM_PTIMES,
"Scan only processes created N seconds before HH, or later.");
160 this->setInfo(
PARAM_SUSPEND,
"Suspend processes detected as suspicious.");
162 this->addParam(
new BoolParam(
PARAM_LOG,
false));
163 this->setInfo(
PARAM_LOG,
"Append each scan summary to the log.");
165 this->addParam(
new BoolParam(
PARAM_KILL,
false));
166 this->setInfo(
PARAM_KILL,
"Kill processes detected as suspicious.");
169 this->setInfo(
PARAM_HOOKS,
"Detect inline hooks and in-memory patches.");
171 this->addParam(
new BoolParam(
PARAM_LOOP,
false));
172 this->setInfo(
PARAM_LOOP,
"Enable continuous scanning.");
173 BoolParam* etwParam =
new BoolParam(
PARAM_ETW,
false);
175 this->addParam(etwParam);
176 this->setInfo(
PARAM_ETW,
"Use ETW (requires Administrator privilege).");
178 etwParam->setActive(
false);
179 this->setInfo(
PARAM_ETW,
"Use ETW (disabled).");
182 EnumParam *enumParam =
new EnumParam(
PARAM_IMP_REC,
"imprec_mode",
false);
184 this->addParam(enumParam);
185 this->setInfo(
PARAM_IMP_REC,
"Set in which mode the ImportTable should be recovered");
186 for (
size_t i = 0; i < PE_IMPREC_MODES_COUNT; i++) {
187 t_imprec_mode mode = (t_imprec_mode)(i);
194 this->addParam(enumParam);
196 for (
size_t i = 0; i < OUT_FILTERS_COUNT; i++) {
197 t_output_filter mode = (t_output_filter)(i);
204 this->addParam(enumParam);
206 for (
size_t i = SHOW_SUSPICIOUS; i < SHOW_FILTERS_COUNT; i++) {
207 t_results_filter mode = (t_results_filter)(i);
209 if (info.empty())
continue;
216 std::stringstream ss1;
217 ss1 <<
"Do not scan module/s with given name/s.";
218 std::stringstream ss2;
219 ss2 <<
"\t Example: kernel32.dll" << PARAM_LIST_SEPARATOR <<
"user32.dll";
224 this->setInfo(
PARAM_QUIET,
"Print only the summary. Do not log on stdout during the scan.");
226 this->addParam(
new BoolParam(
PARAM_JSON,
false));
227 this->setInfo(
PARAM_JSON,
"Print the JSON report as the summary.");
232 this->addParam(enumParam);
233 this->setInfo(
PARAM_JSON_LVL,
"Level of details of the JSON report.");
234 for (
size_t i = 0; i < JSON_LVL_COUNT; i++) {
235 t_json_level mode = (t_json_level)(i);
241 this->setInfo(
PARAM_MINIDUMP,
"Create a minidump of the full suspicious process.");
245 this->setInfo(
PARAM_REBASE,
"Rebase the module to its original base (if known).");
250 this->addParam(enumParam);
251 this->setInfo(
PARAM_SHELLCODE,
"Detect shellcode implants (by patterns or statistics). ");
252 for (
size_t i = 0; i < SHELLC_COUNT; i++) {
253 t_shellc_mode mode = (t_shellc_mode)(i);
261 this->addParam(enumParam);
262 this->setInfo(
PARAM_OBFUSCATED,
"Detect encrypted content, and possible obfuscated shellcodes.");
263 for (
size_t i = 0; i < OBFUSC_COUNT; i++) {
264 t_obfusc_mode mode = (t_obfusc_mode)(i);
271 this->setInfo(
PARAM_THREADS,
"Scan threads' callstack. Detect shellcodes, incl. 'sleeping beacons'.");
275 this->setInfo(
PARAM_REFLECTION,
"Make a process reflection before scan.",
"\t This allows i.e. to force-read inaccessible pages.");
278 enumParam =
new EnumParam(
PARAM_CACHE,
"cache_mode",
false);
280 this->addParam(enumParam);
281 this->setInfo(
PARAM_CACHE,
"Use modules caching. This can speed up the scan (on the cost of memory consumption).\n");
289 enumParam =
new EnumParam(
PARAM_IAT,
"iat_scan_mode",
false);
291 this->addParam(enumParam);
292 this->setInfo(
PARAM_IAT,
"Scan for IAT hooks.");
293 for (
size_t i = 0; i < PE_IATS_MODES_COUNT; i++) {
294 t_iat_scan_mode mode = (t_iat_scan_mode)(i);
300 this->setInfo(
PARAM_PATTERN,
"Set additional shellcode patterns (file in the SIG format).");
305 this->addParam(enumParam);
306 this->setInfo(
PARAM_DOTNET_POLICY,
"Set the policy for scanning managed processes (.NET).");
307 for (
size_t i = 0; i < PE_DNET_COUNT; i++) {
308 t_dotnet_policy mode = (t_dotnet_policy)(i);
314 enumParam =
new EnumParam(
PARAM_DATA,
"data_scan_mode",
false);
316 this->addParam(enumParam);
317 this->setInfo(
PARAM_DATA,
"Set if non-executable pages should be scanned.");
318 for (
size_t i = 0; i < PE_DATA_COUNT; i++) {
319 t_data_scan_mode mode = (t_data_scan_mode)(i);
327 this->addParam(enumParam);
328 this->setInfo(
PARAM_DUMP_MODE,
"Set in which mode the detected PE files should be dumped.");
329 for (
size_t i = 0; i < PE_DUMP_MODES_COUNT; i++) {
330 t_dump_mode mode = (t_dump_mode)(i);
335 this->addParam(
new StringParam(
PARAM_DIR,
false));
336 this->setInfo(
PARAM_DIR,
"Set a root directory for the output (default: \""+ std::string(
HH_DEFAULT_DIR) +
"\").");
339 std::string str_group =
"7. output options";
340 this->addGroup(
new ParamGroup(str_group));
341 this->addParamToGroup(
PARAM_DIR, str_group);
346 this->addParamToGroup(
PARAM_LOG, str_group);
349 str_group =
"2. scanner settings";
350 this->addGroup(
new ParamGroup(str_group));
356 str_group =
"4. scan options";
357 this->addGroup(
new ParamGroup(str_group));
359 this->addParamToGroup(
PARAM_IAT, str_group);
365 this->addParamToGroup(
PARAM_ETW, str_group);
367 str_group =
"5. dump options";
368 this->addGroup(
new ParamGroup(str_group));
374 str_group =
"3. scan exclusions";
375 this->addGroup(
new ParamGroup(str_group));
380 str_group =
"1. scan targets";
381 this->addGroup(
new ParamGroup(str_group));
382 this->addParamToGroup(
PARAM_PID, str_group);
386 str_group =
"6. post-scan actions";
387 this->addGroup(
new ParamGroup(str_group));
445 StringListParam* myParam =
dynamic_cast<StringListParam*
>(this->getParam(
PARAM_PNAME));
446 if (myParam && myParam->isSet()) {
447 std::set<std::string> names_list;
448 myParam->stripToElements(names_list);
449 for (
auto itr = names_list.begin(); itr != names_list.end(); itr++) {
455 if (myParam && myParam->isSet()) {
456 std::set<std::string> ignored_names_list;
457 myParam->stripToElements(ignored_names_list);
458 for (
auto itr = ignored_names_list.begin(); itr != ignored_names_list.end(); itr++) {
462 IntListParam* myIntParam =
dynamic_cast<IntListParam*
>(this->getParam(
PARAM_PID));
463 if (myIntParam && myIntParam->isSet()) {
464 myIntParam->stripToIntElements(ps.
pids_list);