The `osquery` Python library provides a robust API for interacting with the osquery daemon, enabling users to execute SQL queries against the operating system, manage osquery extensions, and handle distributed queries. It acts as a client to a running `osqueryd` instance. The current version is 3.1.1, released in December 2023, with releases occurring periodically to keep pace with the core osquery project.
pip install osqueryVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize an osquery client and execute a basic SQL query. It expects an osquery daemon to be running and accessible via its default Unix socket. Error handling is included for common connection issues.
Initialize `client = osquery.Client()` and then call `client.query(...)`.
Update imports from `from osquery import extensions` to `from osquery.api import extensions`.
Ensure the `osqueryd` daemon is installed, running, and its socket path is correctly configured and accessible by the Python process (e.g., `/var/osquery/osquery.em` on Linux/macOS). If a custom socket path is used, pass it to `osquery.Client(path='...')`.
No dependency data recorded yet.