![]() |
Panoptes 1.0.0
Endpoint Detection and Response
|
#include <Configuration.hpp>
Public Types | |
| enum | ContainerType : int { CONTAINER_TYPE_NONE = 0 , CONTAINER_TYPE_YARA = 30 , CONTAINER_TYPE_ML = 31 } |
| The type of container that the extensibility is running in. More... | |
Public Member Functions | |
| Configuration (std::string configurationPath) | |
| Constructor for the Configuration class. | |
| void | Parse () |
| Parse the configuration file. | |
| void | IsValidJson () |
| Check if the configuration file is valid. | |
| void | ValidateSettings () |
| Check that each setting has the right type, after IsValidJson. Throws std::runtime_error naming the first invalid setting. | |
| std::vector< std::string > | GetJsonKeys () |
| Get the keys from the configuration file. | |
Static Public Member Functions | |
| static const std::vector< std::string > & | FileEventNames () |
| The names FileEvents accepts, one per group of file system events the driver can report. When FileEvents is not set, all of them are reported. | |
| static bool | IsPathInList (const std::vector< std::string > &patterns, const std::string &path) |
| Check whether a path matches any pattern in an exclusion list. A pattern with no wildcard matches every path that starts with it. A pattern containing * (any run of characters, including ) or ? (a single character) must match the whole path. Matching ignores case. / in the path is treated as \; patterns loaded by Parse are normalized the same way. | |
Public Attributes | |
| std::vector< std::string > | m_exclusions |
| Path patterns that are not scanned (see IsPathInList). | |
| bool | m_quartine = false |
| The quarantine malicious files from the configuration file. | |
| std::vector< std::string > | m_logExclusions |
| Path patterns whose driver events are not logged (see IsPathInList). Files matching them are still scanned. | |
| std::vector< std::string > | m_dontInject |
| Processes the driver does not inject the hook DLL into. Each entry is either a file name such as "msedge.exe", matching that image in any folder, or a full path such as "C:\Tools\app.exe" (/ is normalized to ), matching only that image. Compared without regard to case. Sent to the driver with IOCTL_PANOPTES_SET_INJECTION_EXCLUSIONS when the service starts. | |
| std::vector< std::string > | m_fileEvents = FileEventNames() |
| The groups of file system events the driver reports, from FileEventNames(). Every group if FileEvents is not set. Sent to the driver with IOCTL_PANOPTES_SET_FILE_EVENTS when the service starts. | |
| bool | m_enforceDetectionActions = false |
| Whether the service carries out the kill and quarantine actions of detector rules. When false (the default) those detections are logged and notified only. | |
Protected Member Functions | |
| void | GetScannerExclusions () |
| Get the scanner exclusions from the configuration file. | |
| void | GetQuarantineMaliciousFiles () |
| Get the quarantine malicious files from the configuration file. | |
| void | GetLogExclusions () |
| Get the optional log exclusions from the configuration file. | |
| void | GetDontInject () |
| Get the optional DontInject list from the configuration file. | |
| void | GetFileEvents () |
| Get the optional FileEvents list from the configuration file. | |
| void | GetEnforceDetectionActions () |
| Get the optional EnforceDetectionActions setting from the configuration file. | |
Protected Attributes | |
| nlohmann::json | m_data |
| std::ifstream | m_fileStream |
Definition at line 7 of file Configuration.hpp.
| enum Configuration::ContainerType : int |
The type of container that the extensibility is running in.
| Enumerator | |
|---|---|
| CONTAINER_TYPE_NONE | |
| CONTAINER_TYPE_YARA | |
| CONTAINER_TYPE_ML | |
Definition at line 35 of file Configuration.hpp.
| Configuration::Configuration | ( | std::string | configurationPath | ) |
Constructor for the Configuration class.
| configurationPath | The path to the configuration file |
Definition at line 90 of file Configuration.cpp.
References m_fileStream.
|
static |
The names FileEvents accepts, one per group of file system events the driver can report. When FileEvents is not set, all of them are reported.
Definition at line 124 of file Configuration.cpp.
Referenced by GetFileEvents(), TEST(), and TEST_F().
|
protected |
Get the optional DontInject list from the configuration file.
Get the optional list of process image names the hook DLL is not injected into.
Definition at line 199 of file Configuration.cpp.
References m_data, and m_dontInject.
Referenced by Parse(), and ValidateSettings().
|
protected |
Get the optional EnforceDetectionActions setting from the configuration file.
Get the optional EnforceDetectionActions setting.
Definition at line 234 of file Configuration.cpp.
References m_data, and m_enforceDetectionActions.
Referenced by Parse(), and ValidateSettings().
|
protected |
Get the optional FileEvents list from the configuration file.
Get the optional list of file event groups the driver reports.
Definition at line 139 of file Configuration.cpp.
References FileEventNames(), m_data, and m_fileEvents.
Referenced by Parse(), and ValidateSettings().
| std::vector< std::string > Configuration::GetJsonKeys | ( | ) |
Get the keys from the configuration file.
Definition at line 247 of file Configuration.cpp.
References m_data.
Referenced by main().
|
protected |
Get the optional log exclusions from the configuration file.
Definition at line 185 of file Configuration.cpp.
References m_data, and m_logExclusions.
Referenced by Parse(), and ValidateSettings().
|
protected |
Get the quarantine malicious files from the configuration file.
Definition at line 175 of file Configuration.cpp.
References m_data, and m_quartine.
Referenced by Parse(), and ValidateSettings().
|
protected |
Get the scanner exclusions from the configuration file.
Definition at line 164 of file Configuration.cpp.
References m_data, and m_exclusions.
Referenced by Parse(), and ValidateSettings().
|
static |
Check whether a path matches any pattern in an exclusion list. A pattern with no wildcard matches every path that starts with it. A pattern containing * (any run of characters, including ) or ? (a single character) must match the whole path. Matching ignores case. / in the path is treated as \; patterns loaded by Parse are normalized the same way.
Definition at line 64 of file Configuration.cpp.
Referenced by ShippedConfiguration::LogExcluded(), RespondToDetection(), ShippedConfiguration::ScanExcluded(), SelfQueuePeScan(), TEST(), and TEST().
| void Configuration::IsValidJson | ( | ) |
Check if the configuration file is valid.
Definition at line 108 of file Configuration.cpp.
References m_data, and m_fileStream.
Referenced by main().
| void Configuration::Parse | ( | ) |
Parse the configuration file.
Definition at line 96 of file Configuration.cpp.
References GetDontInject(), GetEnforceDetectionActions(), GetFileEvents(), GetLogExclusions(), GetQuarantineMaliciousFiles(), GetScannerExclusions(), m_data, and m_fileStream.
Referenced by WinMain().
| void Configuration::ValidateSettings | ( | ) |
Check that each setting has the right type, after IsValidJson. Throws std::runtime_error naming the first invalid setting.
Check that each setting has the right type, after IsValidJson.
Definition at line 114 of file Configuration.cpp.
References GetDontInject(), GetEnforceDetectionActions(), GetFileEvents(), GetLogExclusions(), GetQuarantineMaliciousFiles(), and GetScannerExclusions().
Referenced by main().
|
protected |
Definition at line 9 of file Configuration.hpp.
Referenced by GetDontInject(), GetEnforceDetectionActions(), GetFileEvents(), GetJsonKeys(), GetLogExclusions(), GetQuarantineMaliciousFiles(), GetScannerExclusions(), IsValidJson(), and Parse().
| std::vector<std::string> Configuration::m_dontInject |
Processes the driver does not inject the hook DLL into. Each entry is either a file name such as "msedge.exe", matching that image in any folder, or a full path such as "C:\Tools\app.exe" (/ is normalized to ), matching only that image. Compared without regard to case. Sent to the driver with IOCTL_PANOPTES_SET_INJECTION_EXCLUSIONS when the service starts.
Definition at line 56 of file Configuration.hpp.
Referenced by GetDontInject(), and WinMain().
| bool Configuration::m_enforceDetectionActions = false |
Whether the service carries out the kill and quarantine actions of detector rules. When false (the default) those detections are logged and notified only.
Definition at line 65 of file Configuration.hpp.
Referenced by GetEnforceDetectionActions(), and RespondToDetection().
| std::vector<std::string> Configuration::m_exclusions |
Path patterns that are not scanned (see IsPathInList).
Definition at line 42 of file Configuration.hpp.
Referenced by GetScannerExclusions(), and RespondToDetection().
| std::vector<std::string> Configuration::m_fileEvents = FileEventNames() |
The groups of file system events the driver reports, from FileEventNames(). Every group if FileEvents is not set. Sent to the driver with IOCTL_PANOPTES_SET_FILE_EVENTS when the service starts.
Definition at line 61 of file Configuration.hpp.
Referenced by GetFileEvents(), and WinMain().
|
protected |
Definition at line 10 of file Configuration.hpp.
Referenced by Configuration(), IsValidJson(), and Parse().
| std::vector<std::string> Configuration::m_logExclusions |
Path patterns whose driver events are not logged (see IsPathInList). Files matching them are still scanned.
Definition at line 49 of file Configuration.hpp.
Referenced by GetLogExclusions(), and StartDriverEvents().
| bool Configuration::m_quartine = false |
The quarantine malicious files from the configuration file.
Definition at line 45 of file Configuration.hpp.
Referenced by GetQuarantineMaliciousFiles().