-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extensions: Always compile examples to prevent them from breaking (#6747
- Loading branch information
1 parent
da62106
commit ffa3da4
Showing
12 changed files
with
174 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright (c) 2014-present, The osquery authors | ||
# | ||
# This source code is licensed as defined by the LICENSE file found in the | ||
# root directory of this source tree. | ||
# | ||
# SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only) | ||
|
||
project("config_plugin_extension") | ||
|
||
addOsqueryExtension( | ||
"${PROJECT_NAME}" | ||
main.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* Copyright (c) 2014-present, The osquery authors | ||
* | ||
* This source code is licensed as defined by the LICENSE file found in the | ||
* root directory of this source tree. | ||
* | ||
* SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only) | ||
*/ | ||
|
||
#include <osquery/core/system.h> | ||
#include <osquery/sdk/sdk.h> | ||
#include <osquery/sql/dynamic_table_row.h> | ||
|
||
using namespace osquery; | ||
|
||
class ExampleConfigPlugin : public ConfigPlugin { | ||
public: | ||
Status setUp() { | ||
LOG(WARNING) << "ExampleConfigPlugin setting up"; | ||
return Status::success(); | ||
} | ||
|
||
Status genConfig(std::map<std::string, std::string>& config) { | ||
config["data"] = "{\"queries\":{}}"; | ||
return Status::success(); | ||
} | ||
}; | ||
|
||
REGISTER_EXTERNAL(ExampleConfigPlugin, "config", "example"); | ||
|
||
int main(int argc, char* argv[]) { | ||
osquery::Initializer runner(argc, argv, ToolType::EXTENSION); | ||
|
||
auto status = startExtension("example", "0.0.1"); | ||
if (!status.ok()) { | ||
LOG(ERROR) << status.getMessage(); | ||
runner.requestShutdown(status.getCode()); | ||
} | ||
|
||
// Finally wait for a signal / interrupt to shutdown. | ||
runner.waitForShutdown(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright (c) 2014-present, The osquery authors | ||
# | ||
# This source code is licensed as defined by the LICENSE file found in the | ||
# root directory of this source tree. | ||
# | ||
# SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only) | ||
|
||
project("read_only_table_extension") | ||
|
||
addOsqueryExtension( | ||
"${PROJECT_NAME}" | ||
main.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* Copyright (c) 2014-present, The osquery authors | ||
* | ||
* This source code is licensed as defined by the LICENSE file found in the | ||
* root directory of this source tree. | ||
* | ||
* SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only) | ||
*/ | ||
|
||
#include <osquery/core/system.h> | ||
#include <osquery/sdk/sdk.h> | ||
#include <osquery/sql/dynamic_table_row.h> | ||
|
||
using namespace osquery; | ||
|
||
class ExampleTable : public TablePlugin { | ||
private: | ||
TableColumns columns() const { | ||
return { | ||
std::make_tuple("example_text", TEXT_TYPE, ColumnOptions::DEFAULT), | ||
std::make_tuple( | ||
"example_integer", INTEGER_TYPE, ColumnOptions::DEFAULT), | ||
}; | ||
} | ||
|
||
TableRows generate(QueryContext& request) { | ||
TableRows results; | ||
|
||
auto r = make_table_row(); | ||
r["example_text"] = "example"; | ||
r["example_integer"] = INTEGER(1); | ||
|
||
results.push_back(std::move(r)); | ||
return results; | ||
} | ||
}; | ||
|
||
REGISTER_EXTERNAL(ExampleTable, "table", "example"); | ||
|
||
int main(int argc, char* argv[]) { | ||
osquery::Initializer runner(argc, argv, ToolType::EXTENSION); | ||
|
||
auto status = startExtension("example", "0.0.1"); | ||
if (!status.ok()) { | ||
LOG(ERROR) << status.getMessage(); | ||
runner.requestShutdown(status.getCode()); | ||
} | ||
|
||
// Finally wait for a signal / interrupt to shutdown. | ||
runner.waitForShutdown(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright (c) 2014-present, The osquery authors | ||
# | ||
# This source code is licensed as defined by the LICENSE file found in the | ||
# root directory of this source tree. | ||
# | ||
# SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only) | ||
|
||
project("writable_table_extension") | ||
|
||
addOsqueryExtension( | ||
"${PROJECT_NAME}" | ||
main.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.