Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
PanoptesLinter.h File Reference
#include <Windows.h>
#include <iostream>
#include <string>
#include <fstream>
#include <vector>

Go to the source code of this file.

Functions

bool FileExists (const std::string &filePath)
 Check if a file exists.
void RemoveStringFromVector (std::vector< std::string > &vec, const std::string &str)
 Remove a string from a vector.
bool IsStringInVector (const std::vector< std::string > &vec, const std::string &str)
 Check if a string is in a vector.

Function Documentation

◆ FileExists()

bool FileExists ( const std::string & filePath)

Check if a file exists.

Parameters
filePathThe path to the file
Returns
True if the file exists, false otherwise

Check if a file exists.

Parameters
filePathThe path to the file
Returns
True if the file exists, false otherwise

Definition at line 23 of file PanoptesLinter.cpp.

23 {
24 DWORD fileAttributes = GetFileAttributesA(filePath.c_str());
25 return (fileAttributes != INVALID_FILE_ATTRIBUTES &&
26 !(fileAttributes & FILE_ATTRIBUTE_DIRECTORY));
27}

Referenced by InstallPanoptes(), main(), and UninstallPanoptes().

◆ IsStringInVector()

bool IsStringInVector ( const std::vector< std::string > & vec,
const std::string & str )

Check if a string is in a vector.

Parameters
vecThe vector to check
strThe string to check
Returns
True if the string is in the vector, false otherwise

Definition at line 40 of file PanoptesLinter.cpp.

40 {
41 return std::find(vec.begin(), vec.end(), str) != vec.end();
42}

Referenced by main().

◆ RemoveStringFromVector()

void RemoveStringFromVector ( std::vector< std::string > & vec,
const std::string & str )

Remove a string from a vector.

Parameters
vecThe vector to remove the string from
strThe string to remove

Definition at line 32 of file PanoptesLinter.cpp.

32 {
33 vec.erase(std::remove(vec.begin(), vec.end(), str), vec.end());
34}

Referenced by main().