HollowsHunter
Scans all running processes. Recognizes and dumps a variety of potentially malicious implants (replaced/implanted PEs, shellcodes, hooks, in-memory patches).
Loading...
Searching...
No Matches
hh_report.h
Go to the documentation of this file.
1#pragma once
2
3#include <time.h>
4
5#include <windows.h>
6#include <pe_sieve_api.h>
7#include <map>
8#include <vector>
9
10#include "hh_params.h"
11
13{
14public:
15 HHScanReport(DWORD start_tick, time_t start_time)
16 : startTick(start_tick), endTick(0),
17 startTime(start_time), endTime(0)
18 {
19 }
20
21 bool setEndTick(DWORD end_tick, time_t end_time)
22 {
23 if (end_tick < this->startTick) {
24 return false;
25 }
26 this->endTick = end_tick;
27 this->endTime = end_time;
28 return true;
29 }
30
31 DWORD getScanTime() const
32 {
33 if (startTick == 0 || endTick == 0) return 0;
34 return (this->endTick - this->startTick);
35 }
36
37 bool appendReport(pesieve::t_report &scan_report, const std::wstring &img_name);
38
39 size_t countReports(const pesieve::t_results_filter rfilter) const
40 {
41 if (rfilter == pesieve::SHOW_NONE) {
42 return 0;
43 }
44 if (rfilter == pesieve::SHOW_ALL) {
45 return countTotal(false);
46 }
47 if (rfilter == pesieve::SHOW_SUCCESSFUL_ONLY) {
48 return countTotal(true);
49 }
50 size_t total = 0;
51 if (rfilter & pesieve::SHOW_ERRORS) {
52 total += failed.size();
53 }
54 if (rfilter & pesieve::SHOW_SUSPICIOUS) {
55 total += suspicious.size();
56 }
57 return total;
58 }
59
60 size_t countTotal(bool successfulOnly = true) const
61 {
62 size_t total = pidToReport.size();
63 if (successfulOnly) {
64 total -= failed.size();
65 }
66 return total;
67 }
68
69 void toString(std::wstringstream &stream, const pesieve::t_results_filter rfilter);
70
71protected:
72 size_t reportsToString(std::wstringstream &stream, const pesieve::t_results_filter rfilter);
73
74 size_t toJSON(std::wstringstream &stream, const t_hh_params &params);
75 size_t reportsToJSON(std::wstringstream &stream, size_t level, const t_hh_params &params);
76
77 time_t startTime;
78 time_t endTime;
79
80 DWORD startTick;
81 DWORD endTick;
82
83 std::map<DWORD, pesieve::t_report> pidToReport;
84 std::map<DWORD, std::wstring> pidToName;
85 std::vector<DWORD> suspicious;
86 std::vector<DWORD> failed;
87 friend class HHScanner;
88};
bool appendReport(pesieve::t_report &scan_report, const std::wstring &img_name)
Definition hh_report.cpp:19
std::map< DWORD, std::wstring > pidToName
Definition hh_report.h:84
DWORD endTick
Definition hh_report.h:81
bool setEndTick(DWORD end_tick, time_t end_time)
Definition hh_report.h:21
void toString(std::wstringstream &stream, const pesieve::t_results_filter rfilter)
time_t endTime
Definition hh_report.h:78
std::map< DWORD, pesieve::t_report > pidToReport
Definition hh_report.h:83
size_t reportsToJSON(std::wstringstream &stream, size_t level, const t_hh_params &params)
Definition hh_report.cpp:74
std::vector< DWORD > suspicious
Definition hh_report.h:85
size_t countReports(const pesieve::t_results_filter rfilter) const
Definition hh_report.h:39
size_t countTotal(bool successfulOnly=true) const
Definition hh_report.h:60
time_t startTime
Definition hh_report.h:77
HHScanReport(DWORD start_tick, time_t start_time)
Definition hh_report.h:15
DWORD getScanTime() const
Definition hh_report.h:31
size_t reportsToString(std::wstringstream &stream, const pesieve::t_results_filter rfilter)
Definition hh_report.cpp:32
size_t toJSON(std::wstringstream &stream, const t_hh_params &params)
DWORD startTick
Definition hh_report.h:80
std::vector< DWORD > failed
Definition hh_report.h:86