7 "QuarantineMaliciousFiles",
11 "EnforceDetectionActions"
17 "QuarantineMaliciousFiles"
24 DWORD fileAttributes = GetFileAttributesA(filePath.c_str());
25 return (fileAttributes != INVALID_FILE_ATTRIBUTES &&
26 !(fileAttributes & FILE_ATTRIBUTE_DIRECTORY));
33 vec.erase(std::remove(vec.begin(), vec.end(), str), vec.end());
41 return std::find(vec.begin(), vec.end(), str) != vec.end();
44int main(
int argc,
char* argv[]) {
45 bool goodConfig =
false;
48 std::cerr <<
"[!] Missing configuration file path" << std::endl;
53 std::cerr <<
"[!] Configuration file does not exist: " << argv[1] << std::endl;
57#pragma region Checking if the configuration file is a valid JSON file
62 catch (
const nlohmann::json::parse_error& e) {
63 std::cerr <<
"JSON parse error: " << e.what() << std::endl;
65 catch (
const std::runtime_error& e) {
67 std::cerr <<
"[!] Error: " << e.what() << std::endl;
71#pragma region Check for unknown keys
72 std::vector<std::string> keys;
76 catch (
const std::runtime_error& e) {
77 std::cerr <<
"[!] Error: " << e.what() << std::endl;
80 for (
const auto& key : keys) {
82 std::cerr <<
"[!] Invalid Panoptes Configuration Key: " << key << std::endl;
90#pragma region Check for required keys
92 for (
const auto& key : keys) {
100 std::cerr <<
"[!] Missing Required Panoptes Configuration Key(s): " << std::endl;
102 std::cerr << key << std::endl;
104 std::cerr << std::endl;
112#pragma region Check setting types
117 catch (
const std::exception& e) {
118 std::cerr <<
"[!] Error: " << e.what() << std::endl;
126 std::cout <<
"[+] Panoptes Configuration is valid" << std::endl;
129 std::cerr <<
"[!] Panoptes Configuration is invalid" << std::endl;
bool FileExists(const std::string &filePath)
Check if a file exists.
bool IsStringInVector(const std::vector< std::string > &vec, const std::string &str)
Check if a string is in a vector.
void RemoveStringFromVector(std::vector< std::string > &vec, const std::string &str)
Remove a string from a vector.
std::vector< std::string > AcceptableConfigParams
The acceptable configuration parameters.
std::vector< std::string > RequiredConfigParams
The required configuration parameters.
int main()
Loads the hook DLL for this architecture from bin/<config>, one directory above the tests folder this...
std::vector< std::string > GetJsonKeys()
Get the keys from the configuration file.
void ValidateSettings()
Check that each setting has the right type, after IsValidJson. Throws std::runtime_error naming the f...
void IsValidJson()
Check if the configuration file is valid.