Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
Functions
Configuration.cpp File Reference
#include <Windows.h>
#include "Configuration.hpp"
#include "ResourceCore.h"
#include <vector>
#include <sstream>

Go to the source code of this file.

Functions

DWORD StringToDWORD (const std::string &str)
 Convert a string to a DWORD.
 
std::vector< std::string > SplitString (const std::string &input, char delimiter=',')
 Split a string into a vector of strings.
 
std::string StrToLower (std::string str)
 Convert a string to lowercase.
 

Function Documentation

◆ SplitString()

std::vector< std::string > SplitString ( const std::string &  input,
char  delimiter = ',' 
)

Split a string into a vector of strings.

Parameters
inputThe string to split
delimiterThe delimiter to split the string on
Returns
A vector of strings

Definition at line 31 of file Configuration.cpp.

31 {
32 std::vector<std::string> result;
33 std::stringstream ss(input);
34 std::string item;
35
36 while (std::getline(ss, item, delimiter)) {
37 result.push_back(item);
38 }
39
40 return result;
41}
ULONG result
Definition events.cpp:22

References result.

Referenced by Configuration::GetEventProviders().

◆ StringToDWORD()

DWORD StringToDWORD ( const std::string &  str)

Convert a string to a DWORD.

Parameters
strThe string to convert
Returns
The DWORD value of the string

Definition at line 12 of file Configuration.cpp.

12 {
13 try {
14 unsigned long value = std::stoul(str, nullptr, 0);
15 return static_cast<DWORD>(value);
16 }
17 catch (const std::invalid_argument& e) {
18 // Handle invalid input
19 return 0; // or throw an exception, depending on your error handling strategy
20 }
21 catch (const std::out_of_range& e) {
22 // Handle out of range input
23 return 0; // or throw an exception, depending on your error handling strategy
24 }
25}
unsigned long DWORD
Definition inject.h:2

Referenced by Configuration::GetEventProviders().

◆ StrToLower()

std::string StrToLower ( std::string  str)

Convert a string to lowercase.

Parameters
strThe string to convert
Returns
The lowercase string

Definition at line 46 of file Configuration.cpp.

46 {
47 std::transform(str.begin(), str.end(), str.begin(),
48 [](unsigned char c) { return std::tolower(c); });
49 return str;
50}

Referenced by Configuration::GetExtensibilitySelected().