6 "ExtensibilitySelected",
9 "QuarantineMaliciousFiles",
15 "ExtensibilitySelected",
23 DWORD fileAttributes = GetFileAttributesA(filePath.c_str());
24 return (fileAttributes != INVALID_FILE_ATTRIBUTES &&
25 !(fileAttributes & FILE_ATTRIBUTE_DIRECTORY));
32 vec.erase(std::remove(vec.begin(), vec.end(), str), vec.end());
40 return std::find(vec.begin(), vec.end(), str) != vec.end();
43int main(
int argc,
char* argv[]) {
44 bool goodConfig =
false;
47 std::cerr <<
"[!] Missing configuration file path" << std::endl;
52 std::cerr <<
"[!] Configuration file does not exist: " << argv[1] << std::endl;
56#pragma region Checking if the configuration file is a valid JSON file
61 catch (
const nlohmann::json::parse_error& e) {
62 std::cerr <<
"JSON parse error: " << e.what() << std::endl;
64 catch (
const std::runtime_error& e) {
66 std::cerr <<
"[!] Error: " << e.what() << std::endl;
70#pragma region Check for unknown keys
71 std::vector<std::string> keys;
75 catch (
const std::runtime_error& e) {
76 std::cerr <<
"[!] Error: " << e.what() << std::endl;
79 for (
const auto& key : keys) {
81 std::cerr <<
"[!] Invalid Panoptes Configuration Key: " << key << std::endl;
89#pragma region Check for required keys
91 for (
const auto& key : keys) {
99 std::cerr <<
"[!] Missing Required Panoptes Configuration Key(s): " << std::endl;
101 std::cerr << key << std::endl;
103 std::cerr << std::endl;
113 std::cout <<
"[+] Panoptes Configuration is valid" << std::endl;
116 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.
std::vector< std::string > GetJsonKeys()
Get the keys from the configuration file.
void IsValidJson()
Check if the configuration file is valid.