diff --git a/plugins/inmemoryscanner/src/lib/Dumping.h b/plugins/inmemoryscanner/src/lib/Dumping.h index 4c5cd71c..8f12142e 100644 --- a/plugins/inmemoryscanner/src/lib/Dumping.h +++ b/plugins/inmemoryscanner/src/lib/Dumping.h @@ -54,7 +54,7 @@ namespace InMemoryScanner { } - std::string getMemFileName() + [[nodiscard]] std::string getMemFileName() { return processName.substr(0, maxProcNameLength) .append("-") @@ -69,7 +69,7 @@ namespace InMemoryScanner .append(uid); } - std::string toString() + [[nodiscard]] std::string toString() { return std::string("{") .append(R"("ProcessName": ")") @@ -155,13 +155,13 @@ namespace InMemoryScanner int memoryRegionCounter{}; std::mutex counterLock{}; - static std::unique_ptr + [[nodiscard]] static std::unique_ptr createMemoryRegionInformation(const std::string& processName, pid_t pid, const VmiCore::MemoryRegion& memoryRegionDescriptor, int regionId); - int getNextRegionId(); + [[nodiscard]] int getNextRegionId(); void appendRegionInfo(const std::string& regionInfo); }; diff --git a/plugins/inmemoryscanner/src/lib/Scanner.h b/plugins/inmemoryscanner/src/lib/Scanner.h index c3afbe8e..37db1ac8 100644 --- a/plugins/inmemoryscanner/src/lib/Scanner.h +++ b/plugins/inmemoryscanner/src/lib/Scanner.h @@ -20,7 +20,7 @@ namespace InMemoryScanner std::unique_ptr yaraEngine, std::unique_ptr dumping); - static std::unique_ptr getFilenameFromPath(const std::string& path); + [[nodiscard]] static std::unique_ptr getFilenameFromPath(const std::string& path); void scanProcess(std::shared_ptr processInformation); @@ -39,7 +39,7 @@ namespace InMemoryScanner Semaphore semaphore = Semaphore(YR_MAX_THREADS); - bool shouldRegionBeScanned(const VmiCore::MemoryRegion& memoryRegionDescriptor); + [[nodiscard]] bool shouldRegionBeScanned(const VmiCore::MemoryRegion& memoryRegionDescriptor); void scanMemoryRegion(pid_t pid, const std::string& processName, diff --git a/plugins/inmemoryscanner/src/lib/Yara.h b/plugins/inmemoryscanner/src/lib/Yara.h index fa45b0d3..2df566ce 100644 --- a/plugins/inmemoryscanner/src/lib/Yara.h +++ b/plugins/inmemoryscanner/src/lib/Yara.h @@ -17,8 +17,9 @@ namespace InMemoryScanner private: YR_RULES* rules = nullptr; - static int yaraCallback(YR_SCAN_CONTEXT* context, int message, void* message_data, void* user_data); + [[nodiscard]] static int + yaraCallback(YR_SCAN_CONTEXT* context, int message, void* message_data, void* user_data); - static int handleRuleMatch(YR_SCAN_CONTEXT* context, YR_RULE* rule, std::vector* results); + [[nodiscard]] static int handleRuleMatch(YR_SCAN_CONTEXT* context, YR_RULE* rule, std::vector* results); }; } diff --git a/plugins/inmemoryscanner/src/lib/YaraInterface.h b/plugins/inmemoryscanner/src/lib/YaraInterface.h index 5fda2c9f..ad56c641 100644 --- a/plugins/inmemoryscanner/src/lib/YaraInterface.h +++ b/plugins/inmemoryscanner/src/lib/YaraInterface.h @@ -16,7 +16,7 @@ namespace InMemoryScanner public: virtual ~YaraInterface() = default; - virtual std::unique_ptr> scanMemory(std::vector& buffer) = 0; + [[nodiscard]] virtual std::unique_ptr> scanMemory(std::vector& buffer) = 0; protected: YaraInterface() = default;