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
dump_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 "../utils/path_util.h"
13
14namespace pesieve {
15
17 {
18 public:
19
20 ModuleDumpReport(ULONGLONG module_start, size_t module_size)
21 : moduleStart(module_start), moduleSize(module_size),
22 isDumped(false), isReportDumped(false),
23 is_corrupt_pe(false),
24 is_shellcode(false)
25 {
26 }
27
28 const virtual bool toJSON(std::stringstream &outs, size_t level);
29
30 ULONGLONG moduleStart;
31 size_t moduleSize;
34 std::string impRecMode;
37 std::string mode_info;
38 std::string dumpFileName;
39 std::string hooksTagFileName;
41 std::string impListFileName;
43 std::string iatHooksFileName;
44 };
45
48 {
49 public:
51 : pid(_pid)
52 {
53 }
54
59
61 {
62 if (!report) return;
63 moduleReports.push_back(report);
64 }
65
66 size_t countTotal() const
67 {
68 return moduleReports.size();
69 }
70
71 bool isFilled() const
72 {
73 if (countTotal()) return true;
74 if (this->minidumpPath.length()) return true;
75 return false;
76 }
77
78 size_t countDumped() const
79 {
80 size_t dumped = 0;
81 std::vector<ModuleDumpReport*>::const_iterator itr = moduleReports.begin();
82 for (; itr != moduleReports.end(); ++itr) {
83 ModuleDumpReport* module = *itr;
84 if (module->isDumped) {
85 dumped++;
86 }
87 }
88 return dumped;
89 }
90
91 virtual bool toJSON(std::stringstream &stream, size_t level) const;
92
93 DWORD getPid() const { return pid; }
94
95 std::string outputDir;
96 std::string minidumpPath;
97
98 protected:
99
100 std::string list_dumped_modules(size_t level) const;
101
103 {
104 std::vector<ModuleDumpReport*>::iterator itr = moduleReports.begin();
105 for (; itr != moduleReports.end(); ++itr) {
106 ModuleDumpReport* module = *itr;
107 delete module;
108 }
109 moduleReports.clear();
110 }
111
112 DWORD pid;
113 std::vector<ModuleDumpReport*> moduleReports;
114
115 friend class ResultsDumper;
116 };
117
118};
119
std::string notRecoveredFileName
Definition dump_report.h:42
virtual const bool toJSON(std::stringstream &outs, size_t level)
ModuleDumpReport(ULONGLONG module_start, size_t module_size)
Definition dump_report.h:20
std::string patternsTagFileName
Definition dump_report.h:40
The report aggregating the results of the performed dumps.
Definition dump_report.h:48
virtual bool toJSON(std::stringstream &stream, size_t level) const
std::vector< ModuleDumpReport * > moduleReports
std::string list_dumped_modules(size_t level) const
size_t countTotal() const
Definition dump_report.h:66
size_t countDumped() const
Definition dump_report.h:78
void appendReport(ModuleDumpReport *report)
Definition dump_report.h:60
Final summary about the scanned process.