Skip to content

Commit

Permalink
[FEATURE] Dump the same module only once (even when it was detected b…
Browse files Browse the repository at this point in the history
…y multiple scan types)
  • Loading branch information
hasherezade committed Nov 2, 2024
1 parent 6d1e6a9 commit 0783178
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions postprocessors/dump_report.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ namespace pesieve {
return dumped;
}

bool hasModule(const ULONGLONG modBase, const size_t modSize) const
{
if (!modBase) return false;

for (auto itr = moduleReports.begin(); itr != moduleReports.end(); ++itr) {
const ModuleDumpReport* report = *itr;
if (!report->isDumped) continue; // dumping failed
if (report->moduleStart == modBase && report->moduleSize == modSize) {
return true;
}
}
return false;
}

virtual bool toJSON(std::stringstream &stream, size_t level) const;

DWORD getPid() const { return pid; }
Expand Down
4 changes: 4 additions & 0 deletions postprocessors/results_dumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ pesieve::ProcessDumpReport* pesieve::ResultsDumper::dumpDetectedModules(
if (mod->status != SCAN_SUSPICIOUS) {
continue;
}
// skip already dumped:
if (dumpReport->hasModule((ULONGLONG)mod->module, mod->moduleSize)) {
continue;
}
ULONGLONG out_base = rebase ? mod->origBase : 0;
dumpModule(processHandle,
isRefl,
Expand Down

0 comments on commit 0783178

Please sign in to comment.