2014-10-29 19:45:17 +00:00
|
|
|
class Osquery < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "SQL powered operating system instrumentation and analytics"
|
2015-05-05 15:55:57 +00:00
|
|
|
homepage "https://osquery.io"
|
2014-10-29 19:45:17 +00:00
|
|
|
# pull from git tag to get submodules
|
2015-07-22 04:00:30 +00:00
|
|
|
url "https://github.com/facebook/osquery.git",
|
2015-08-25 00:37:30 +00:00
|
|
|
:tag => "1.5.2",
|
|
|
|
:revision => "225a14660abeb1071fff58e73cc753d54037c6ae"
|
2015-08-30 16:18:34 +00:00
|
|
|
revision 1
|
2014-10-29 19:45:17 +00:00
|
|
|
|
2014-10-30 12:34:23 +00:00
|
|
|
bottle do
|
2015-09-03 08:13:31 +00:00
|
|
|
revision 1
|
2015-09-22 16:27:14 +00:00
|
|
|
sha256 "cd0946321541201e9ee054f409bf23bfe4f42e00c6ed8dd87eb09f38c925affc" => :el_capitan
|
2015-09-03 08:13:31 +00:00
|
|
|
sha256 "0f45aeb033ed4393c66bbf7b926ab9ecb9f537372fc12b4127d2d61c236e3450" => :yosemite
|
|
|
|
sha256 "c8c818319a762e0f300cf2d01c2697b0de2348bc83075b8d6713ab5ebbe280a5" => :mavericks
|
2014-10-30 12:34:23 +00:00
|
|
|
end
|
|
|
|
|
2015-08-25 00:37:30 +00:00
|
|
|
# osquery only supports OS X 10.9 and above. Do not remove this.
|
|
|
|
depends_on :macos => :mavericks
|
2014-10-29 19:45:17 +00:00
|
|
|
|
|
|
|
depends_on "cmake" => :build
|
2015-05-05 03:30:19 +00:00
|
|
|
depends_on "doxygen" => :build
|
2015-08-25 00:37:30 +00:00
|
|
|
depends_on "boost"
|
|
|
|
depends_on "rocksdb"
|
|
|
|
depends_on "thrift"
|
|
|
|
depends_on "yara"
|
|
|
|
depends_on "libressl"
|
2015-07-22 04:00:30 +00:00
|
|
|
depends_on "gflags"
|
2015-08-31 23:00:13 +00:00
|
|
|
depends_on "glog"
|
2014-10-29 19:45:17 +00:00
|
|
|
|
|
|
|
resource "markupsafe" do
|
|
|
|
url "https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz"
|
2015-07-20 20:24:40 +00:00
|
|
|
sha256 "a4ec1aff59b95a14b45eb2e23761a0179e98319da5a7eb76b56ea8cdc7b871c3"
|
2014-10-29 19:45:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "jinja2" do
|
|
|
|
url "https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz"
|
2015-07-20 20:24:40 +00:00
|
|
|
sha256 "2e24ac5d004db5714976a04ac0e80c6df6e47e98c354cb2c0d82f8879d4f8fdb"
|
2014-10-29 19:45:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
2015-08-25 00:37:30 +00:00
|
|
|
# Link dynamically against brew-installed libraries.
|
|
|
|
ENV["BUILD_LINK_SHARED"] = "1"
|
|
|
|
|
|
|
|
# Use LibreSSL instead of the system provided OpenSSL.
|
|
|
|
ENV["BUILD_USE_LIBRESSL"] = "1"
|
|
|
|
|
|
|
|
# Skip test and benchmarking.
|
|
|
|
ENV["SKIP_TESTS"] = "1"
|
|
|
|
|
2015-08-30 16:18:34 +00:00
|
|
|
ENV.prepend_create_path "PYTHONPATH", buildpath/"third-party/python/lib/python2.7/site-packages"
|
2015-08-04 02:57:21 +00:00
|
|
|
ENV["THRIFT_HOME"] = Formula["thrift"].opt_prefix
|
2014-10-29 19:45:17 +00:00
|
|
|
|
|
|
|
resources.each do |r|
|
2015-08-03 12:55:31 +00:00
|
|
|
r.stage do
|
|
|
|
system "python", "setup.py", "install",
|
2014-10-29 19:45:17 +00:00
|
|
|
"--prefix=#{buildpath}/third-party/python/",
|
|
|
|
"--single-version-externally-managed",
|
2015-08-03 12:55:31 +00:00
|
|
|
"--record=installed.txt"
|
|
|
|
end
|
2014-10-29 19:45:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
system "cmake", ".", *std_cmake_args
|
2015-01-21 00:06:22 +00:00
|
|
|
system "make"
|
2014-10-29 19:45:17 +00:00
|
|
|
system "make", "install"
|
|
|
|
end
|
|
|
|
|
|
|
|
plist_options :startup => true, :manual => "osqueryd"
|
|
|
|
|
|
|
|
test do
|
2015-08-31 23:00:13 +00:00
|
|
|
(testpath/"test.cpp").write <<-EOS.undent
|
|
|
|
#include <osquery/sdk.h>
|
|
|
|
|
|
|
|
using namespace osquery;
|
|
|
|
|
|
|
|
class ExampleTablePlugin : public TablePlugin {
|
|
|
|
private:
|
|
|
|
TableColumns columns() const {
|
|
|
|
return {{"example_text", "TEXT"}, {"example_integer", "INTEGER"}};
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryData generate(QueryContext& request) {
|
|
|
|
QueryData results;
|
|
|
|
Row r;
|
|
|
|
|
|
|
|
r["example_text"] = "example";
|
|
|
|
r["example_integer"] = INTEGER(1);
|
|
|
|
results.push_back(r);
|
|
|
|
return results;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
REGISTER_EXTERNAL(ExampleTablePlugin, "table", "example");
|
|
|
|
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
Initializer runner(argc, argv, OSQUERY_EXTENSION);
|
|
|
|
runner.shutdown();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
|
|
|
|
system ENV.cxx, "test.cpp", "-o", "test", "-v", "-std=c++11",
|
|
|
|
"-losquery", "-lthrift", "-lboost_system", "-lboost_thread-mt",
|
|
|
|
"-lboost_filesystem", "-lglog", "-lgflags", "-lrocksdb"
|
|
|
|
system "./test"
|
2014-10-29 19:45:17 +00:00
|
|
|
end
|
|
|
|
end
|