Skip to content

Commit

Permalink
[BUGFIX] Fixed filtering the displayed listing of scanned
Browse files Browse the repository at this point in the history
  • Loading branch information
hasherezade committed Nov 1, 2024
1 parent 68a3f48 commit a0bf057
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions hh_report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,33 @@ bool HHScanReport::appendReport(pesieve::t_report &scan_report, const std::wstri

size_t HHScanReport::reportsToString(std::wstringstream& stream, const pesieve::t_results_filter rfilter)
{
if (rfilter == pesieve::SHOW_NONE) {
return 0;
}
size_t printed = 0;
size_t counter = 0;
size_t scannedCount = countReports(rfilter);

if (!scannedCount) {
return printed;
}

const size_t max_len = size_t(std::floor(std::log10(double(scannedCount))) + 1) % 100;
for (auto itr = this->pidToReport.begin(); itr != pidToReport.end(); ++itr) {
bool isFailed = false;
DWORD pid = itr->first;
pesieve::t_report rep = itr->second;
if ((rfilter & pesieve::SHOW_SUSPICIOUS) == 0) {
if (rep.suspicious) continue;
}
if ((rfilter & pesieve::SHOW_NOT_SUSPICIOUS) == 0) {
if (!rep.suspicious) continue;
}
if (rep.errors == pesieve::ERROR_SCAN_FAILURE) {
isFailed = true;
}

if (isFailed && (rfilter & pesieve::SHOW_ERRORS) == 0) {
if (isFailed && ((rfilter & pesieve::SHOW_ERRORS) == 0)) {
continue; // do not display failed
}
stream << L"[" << std::setw(max_len) << counter++ << L"]: PID: " << std::dec << pid << L", ";
Expand Down

0 comments on commit a0bf057

Please sign in to comment.