PE-sieve
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
scan_report.h
Go to the documentation of this file.
1#pragma once
2
3#include <windows.h>
4
5#include <iostream>
6#include <sstream>
7#include <string>
8#include <vector>
9
10#include <peconv.h>
11#include "pe_sieve_types.h"
12#include "module_scan_report.h"
13#include "scanned_modules.h"
14
15namespace pesieve {
16
19 {
20 public:
33
41
43
49
55
57 {
58 if (report == nullptr) return;
59 moduleReports.push_back(report);
61 this->errorsCount++;
62 }
63 appendToType(report);
64 // if the scan was successful, append the module to the scanned modules:
67 }
68 }
69
74
76 {
78 return false;
79 }
80 return true;
81 }
82
84 {
86 return false;
87 }
88 return true;
89 }
90
92
97
98 const virtual bool toJSON(std::stringstream &stream, size_t level, const t_report_filter &filter, const pesieve::t_json_level &jdetails) const;
99
101 DWORD getPid() { return pid; }
102 bool isManagedProcess() { return this->isManaged; }
103
104 std::string mainImagePath;
105 std::vector<ModuleScanReport*> moduleReports; //TODO: make it protected
106 peconv::ExportsMapper *exportsMap;
107
108 protected:
109 std::string listModules(size_t level, const ProcessScanReport::t_report_filter &filter, const t_json_level &jdetails) const;
110
112 {
113 std::vector<ModuleScanReport*>::iterator itr = moduleReports.begin();
114 for (; itr != moduleReports.end(); ++itr) {
115 ModuleScanReport* module = *itr;
116 delete module;
117 }
118 moduleReports.clear();
119 }
120
122 size_t countResultsPerType(const t_report_type type, const t_scan_status result) const;
123
124 size_t countSuspiciousPerType(const t_report_type type) const
125 {
127 }
128
129 size_t countHdrsReplaced() const;
131
132 DWORD pid;
138
140 std::set<ModuleScanReport*> reportsByType[REPORT_TYPES_COUNT];
141
142 friend class ProcessScanner;
143 friend class ResultsDumper;
144 };
145
146}; //namespace pesieve
A base class of all the reports detailing on the output of the performed module's scan.
static t_scan_status get_scan_status(const ModuleScanReport *report)
A container of all the process modules that were scanned.
ScannedModule * findModuleContaining(ULONGLONG address, size_t size=0) const
size_t getScannedSize(ULONGLONG start_address) const
bool appendToModulesList(ModuleScanReport *report)
ScannedModule * getModuleAt(ULONGLONG address) const
The report aggregating the results of the performed scan.
Definition scan_report.h:19
bool hasAnyShownType(const ProcessScanReport::t_report_filter &filter)
size_t countResultsPerType(const t_report_type type, const t_scan_status result) const
virtual const bool toJSON(std::stringstream &stream, size_t level, const t_report_filter &filter, const pesieve::t_json_level &jdetails) const
ProcessScanReport(DWORD _pid, bool _is64bit, bool _isReflection, t_params *_usedParams)
Definition scan_report.h:44
void appendReport(ModuleScanReport *report)
Definition scan_report.h:56
bool isModuleReplaced(HMODULE module_base)
pesieve::t_report generateSummary() const
peconv::ExportsMapper * exportsMap
std::set< ModuleScanReport * > reportsByType[REPORT_TYPES_COUNT]
std::vector< ModuleScanReport * > moduleReports
bool hasModule(ULONGLONG page_addr)
Definition scan_report.h:75
static t_report_type getReportType(ModuleScanReport *report)
bool hasModuleContaining(ULONGLONG page_addr, size_t size)
Definition scan_report.h:83
size_t countHdrsReplaced() const
ScannedModule * getModuleContaining(ULONGLONG field_addr, size_t field_size=0) const
Definition scan_report.h:93
size_t getScannedSize(ULONGLONG address) const
Definition scan_report.h:70
void appendToType(ModuleScanReport *report)
size_t countSuspiciousPerType(const t_report_type type) const
std::string listModules(size_t level, const ProcessScanReport::t_report_filter &filter, const t_json_level &jdetails) const
The root scanner, responsible for enumerating all the elements to be scanned within a given process,...
Definition scanner.h:14
Represents a basic info about the scanned module, such as its base offset, size, and the status.
size_t fill_iat(BYTE *vBuf, size_t vBufSize, IN const peconv::ExportsMapper *exportsMap, IN OUT IATBlock &iat, IN ThunkFoundCallback *callback)
Definition iat_finder.h:31
enum pesieve::module_scan_status t_scan_status
The types used by PE-sieve API.
Final summary about the scanned process.