Skip to content

Commit

Permalink
[FEATURE] Added a param "JSON"
Browse files Browse the repository at this point in the history
  • Loading branch information
hasherezade committed Nov 12, 2019
1 parent cebf8f9 commit 84d24d9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions hh_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ void hh_args_init(t_hh_params &hh_args)

hh_args.quiet = false;
hh_args.log = false;
hh_args.json_output = false;
}
1 change: 1 addition & 0 deletions hh_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ typedef struct {
bool kill_suspicious;
bool quiet;
bool log;
bool json_output;
pesieve::t_params pesieve_args; //PE-sieve parameters
} t_hh_params;

Expand Down
13 changes: 10 additions & 3 deletions hh_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,16 @@ bool write_to_file(std::string report_path, std::string summary_str, bool append
void HHScanner::summarizeScan(HHScanReport *hh_report)
{
if (!hh_report) return;

std::string summary_str = hh_report->toString();
std::cout << summary_str;
std::string summary_str;

if (!this->hh_args.json_output) {
summary_str = hh_report->toString();
std::cout << summary_str;
}
else {
summary_str = hh_report->toJSON(this->hh_args);
std::cout << summary_str;
}

if (hh_args.pesieve_args.out_filter != OUT_NO_DIR) {
//file the same report into the directory with dumps:
Expand Down
9 changes: 8 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <pe_sieve_types.h>
#include "params_info/pe_sieve_params_info.h"

#define VERSION "0.2.2.7"
#define VERSION "0.2.2.7-a"

#define PARAM_SWITCH1 '/'
#define PARAM_SWITCH2 '-'
Expand All @@ -36,6 +36,7 @@
#define PARAM_DIR "dir"
#define PARAM_MINIDUMP "minidmp"
#define PARAM_LOG "log"
#define PARAM_JSON "json"

//info:
#define PARAM_HELP "help"
Expand Down Expand Up @@ -163,6 +164,9 @@ void print_help()
print_param_in_color(param_color, PARAM_LOG);
std::cout << "\t: Append each scan summary to the log.\n";

print_param_in_color(param_color, PARAM_JSON);
std::cout << "\t: Display JSON report as the summary.\n";

print_in_color(hdr_color, "\nInfo: \n");
print_param_in_color(param_color, PARAM_HELP);
std::cout << " : Print this help.\n";
Expand Down Expand Up @@ -380,6 +384,9 @@ int main(int argc, char *argv[])
else if (!strcmp(param, PARAM_LOG)) {
hh_args.log = true;
}
else if (!strcmp(param, PARAM_JSON)) {
hh_args.json_output = true;
}
else if (!strcmp(param, PARAM_LOOP)) {
hh_args.loop_scanning = true;
}
Expand Down

0 comments on commit 84d24d9

Please sign in to comment.