94 std::set<ModuleScanReport*>::iterator itr;
106 if (
report ==
nullptr)
return;
117 if (!
hasModule((ULONGLONG)module_base)) {
120 std::set<ModuleScanReport*>::const_iterator itr;
124 if (
report->isHdrReplaced()) {
137 std::set<ModuleScanReport*>::iterator itr;
142 if (!hdrRep)
continue;
155 summary.pid = this->
pid;
156 summary.is_64bit = this->
is64bit;
163 std::vector<ModuleScanReport*>::const_iterator itr =
moduleReports.begin();
167 summary.suspicious++;
175 summary.implanted =
MASK_TO_DWORD(summary.implanted_shc + summary.implanted_pe);
178 summary.other =
MASK_TO_DWORD(summary.suspicious - (summary.patched + summary.replaced + summary.implanted + summary.hdr_mod + summary.iat_hooked));
184 std::stringstream stream;
187 bool is_first =
true;
188 std::vector<ModuleScanReport*>::const_iterator itr;
189 for (itr = this->
moduleReports.begin(); itr != this->moduleReports.end(); ++itr) {
196 mod->
toJSON(stream, level + 2, jdetails);
210 std::stringstream &stream,
size_t start_level,
217 size_t level = start_level + 1;
221 stream << std::dec <<
report.
pid <<
",\n";
222 OUT_PADDED(stream, level,
"\"is_64_bit\" : ");
224 OUT_PADDED(stream, level,
"\"is_managed\" : ");
226 OUT_PADDED(stream, level,
"\"main_image_path\" : \"");
228 OUT_PADDED(stream, level,
"\"used_reflection\" : ");
230 OUT_PADDED(stream, level,
"\"scanner_version\" : ");
232 OUT_PADDED(stream, level,
"\"scanned\" : \n");
235 OUT_PADDED(stream, level + 1,
"\"total\" : ");
237 OUT_PADDED(stream, level + 1,
"\"skipped\" : ");
239 OUT_PADDED(stream, level + 1,
"\"modified\" : \n");
242 OUT_PADDED(stream, level + 2,
"\"total\" : ");
244 OUT_PADDED(stream, level + 2,
"\"patched\" : ");
246 OUT_PADDED(stream, level + 2,
"\"iat_hooked\" : ");
248 OUT_PADDED(stream, level + 2,
"\"replaced\" : ");
250 OUT_PADDED(stream, level + 2,
"\"hdr_modified\" : ");
252 OUT_PADDED(stream, level + 2,
"\"implanted_pe\" : ");
254 OUT_PADDED(stream, level + 2,
"\"implanted_shc\" : ");
256 OUT_PADDED(stream, level + 2,
"\"unreachable_file\" : ");
258 OUT_PADDED(stream, level + 2,
"\"other\" : ");
259 stream << std::dec << other <<
"\n";
261 OUT_PADDED(stream, level + 1,
"\"errors\" : ");
A report from the artefacts scan, generated by ArtefactScanner.
A report from the code scan, generated by CodeScanner.
static t_scan_status get_scan_status(const ElementScanReport *report)
A report from an IAT scan, generated by IATScanner.
A base class of all the reports detailing on the output of the performed module's scan.
virtual const bool toJSON(std::stringstream &outs, size_t level=JSON_LEVEL, const pesieve::t_json_level &jdetails=JSON_BASIC)=0
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_results_filter &filter, const pesieve::t_json_level &jdetails) const
std::string mainImagePath
bool isModuleReplaced(HMODULE module_base)
pesieve::t_report generateSummary() const
std::string listModules(size_t level, const t_results_filter &filter, const t_json_level &jdetails) const
std::set< ModuleScanReport * > reportsByType[REPORT_TYPES_COUNT]
std::vector< ModuleScanReport * > moduleReports
@ REPORT_UNREACHABLE_SCAN
bool hasModule(ULONGLONG page_addr)
static t_report_type getReportType(ModuleScanReport *report)
size_t countHdrsReplaced() const
bool hasAnyShownType(const t_results_filter &filter)
void appendToType(ModuleScanReport *report)
size_t countSuspiciousPerType(const t_report_type type) const
A report from the thread scan, generated by ThreadScanner.
A report from the working set scan, generated by WorkingSetScanner.
#define MASK_TO_DWORD(val)
DWORD(__stdcall *_PssCaptureSnapshot)(HANDLE ProcessHandle
std::string escape_path_separators(std::string path)
enum pesieve::module_scan_status t_scan_status
bool is_shown_type(t_scan_status status, t_results_filter filter)
@ SHOW_ERRORS
report only scan errors
@ SHOW_SUSPICIOUS
report only suspicious
@ SHOW_NOT_SUSPICIOUS
report only not suspicious
#define PESIEVE_VERSION_STR
Final summary about the scanned process.
DWORD errors
the number of elements that could not be scanned because of errors. If errors == ERROR_SCAN_FAILURE,...
DWORD implanted_shc
implanted shellcodes
bool is_reflection
was the scan performed on process reflection
DWORD scanned
number of all scanned modules
DWORD patched
detected modifications in the code
DWORD suspicious
general summary of suspicious
bool is_64bit
is process 64 bit
DWORD iat_hooked
detected IAT hooks
DWORD hdr_mod
PE header is modified (but not replaced).
DWORD unreachable_file
cannot read the file corresponding to the module in memory
DWORD implanted_pe
the full PE was probably loaded manually
DWORD skipped
some of the modules must be skipped (i.e. dotNET managed code have different characteristics and this...
DWORD replaced
PE file replaced in memory (probably hollowed).
bool is_managed
is process managed (.NET)
DWORD other
other indicators
DWORD pid
pid of the process that was scanned