QueryData genFirefoxAddons(QueryContext& context) { QueryData results; auto homes = osquery::getHomeDirectories(); for (const auto& home : homes) { // For each user, enumerate all of their Firefox profiles. std::vector<std::string> profiles; if (!listDirectoriesInDirectory(home / kFirefoxPath, profiles).ok()) { continue; } // Generate an addons list from their extensions JSON. for (const auto& profile : profiles) { genFirefoxAddonsFromExtensions(profile, results); } } return results; }
QueryData genFirefoxAddons(QueryContext& context) { QueryData results; // Iterate over each user QueryData users = usersFromContext(context); for (const auto& row : users) { if (row.count("uid") > 0 && row.count("directory") > 0) { // For each user, enumerate all of their Firefox profiles. std::vector<std::string> profiles; auto directory = fs::path(row.at("directory")) / kFirefoxPath; if (!listDirectoriesInDirectory(directory, profiles).ok()) { continue; } // Generate an addons list from their extensions JSON. for (const auto& profile : profiles) { genFirefoxAddonsFromExtensions(row.at("uid"), profile, results); } } } return results; }