osquery-1/include/osquery/filesystem.h

44 lines
1.7 KiB
C
Raw Normal View History

2014-08-02 18:28:38 +00:00
// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
2014-08-02 18:28:38 +00:00
#include <map>
2014-08-02 18:28:38 +00:00
#include <string>
#include <vector>
#include <boost/property_tree/ptree.hpp>
#include "osquery/status.h"
2014-08-02 18:28:38 +00:00
2014-08-15 07:25:30 +00:00
namespace osquery {
2014-08-02 18:28:38 +00:00
// readFile accepts a const reference to an std::string indicating the path of
// the file that you'd like to read and a non-const reference to an std::string
// which will be populated with the contents of the file (if all operations are
// successful). An osquery::Status is returned indicating the success or
2014-08-02 18:28:38 +00:00
// failure of the operation.
osquery::Status readFile(const std::string& path, std::string& content);
2014-08-02 18:28:38 +00:00
2014-09-09 23:14:54 +00:00
// pathExists returns an OSquery-standard tri-state for reporting disk
// presense. (-1) no input was supplied, assuming the caller is not aware
// of how to check path-getter results; (0) path does not exist on disk;
// (1) path does exist on disk.
osquery::Status pathExists(const std::string& path);
2014-08-14 23:27:20 +00:00
// listFilesInDirectory accepts a const reference to an std::string indicating
// the path of the directory that you'd like to list and a non-const reference
// to an std::vector<std::string> which will be populated with the contents of
// the directory (if all operations are successful). An osquery::Status is
// returned indicating the success or failure of the operation. Note that the
// directory listing is not recursive.
osquery::Status listFilesInDirectory(const std::string& path,
2014-08-15 07:25:30 +00:00
std::vector<std::string>& results);
2014-08-14 23:27:20 +00:00
#ifdef __APPLE__
osquery::Status parsePlist(const std::string& path,
2014-08-15 07:25:30 +00:00
boost::property_tree::ptree& tree);
osquery::Status parsePlistContent(const std::string& fileContent,
2014-08-15 07:25:30 +00:00
boost::property_tree::ptree& tree);
#endif
2014-08-15 07:25:30 +00:00
}