-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
addressed feedback; added keyword option for search
- Loading branch information
1 parent
b5dff80
commit 76192b0
Showing
8 changed files
with
133 additions
and
47 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 |
---|---|---|
|
@@ -52,7 +52,7 @@ Follow the standard [contributing guide](../CONTRIBUTING.md). Please remember to | |
|
||
## Commands | ||
|
||
The `hunting` folder is a modularized library with it's own CLI via the user of [click](https://pypi.org/project/click/). All commands can be ran from the root of `detection-rules` repository as such: `python -m hunting COMMAND`. | ||
The `hunting` folder is an executable package with it's own CLI using [click](https://pypi.org/project/click/). All commands can be ran from the root of `detection-rules` repository as such: `python -m hunting COMMAND`. | ||
|
||
- **generate-markdown**: | ||
- This will generate Markdown files for each TOML file specified and update the `index.yml` and `index.md`. | ||
|
@@ -65,6 +65,7 @@ The `hunting` folder is a modularized library with it's own CLI via the user of | |
- **search**: | ||
- This command enables users to filter for queries based on MITRE ATT&CK information, more specifically, tactic, technique or sub-technique IDs. The `--tactic`, `--technique`, `--subtechnique` parameters can be used to search for hunting queries that have been tagged with these respective IDs. | ||
- All hunting queries are required to include MITRE mappings. Additionally, `--data-source` parameter can be used with or without MITRE filters to scope to a specific data source (i.e. `python -m hunting search --tactic TA0001 --data-source aws` would show all credential access related hunting queries for AWS) | ||
- More open-ended keyword searches are available via `--keyword` search that can be paired with data source or not to search across a hunting content's name, description, notes and references data. | ||
- **run-query**: **NOTE** - This command requires the `.detection-rules-cfg.yaml` to be populated. Please refer to the [CLI docs](../CLI.md) for optional parameters. | ||
- This command enables users to load a TOML file, select a hunting query and run it against their elasticsearch instance The `--uuid` and `--file-path` parameters can be used to select which hunting query(s) to run. | ||
- Users can select which query to run from the TOML file if multiple are available. | ||
|
@@ -80,28 +81,33 @@ The `hunting` folder is a modularized library with it's own CLI via the user of | |
|
||
To contribute to the `hunting` folder or add new hunting queries, follow these steps: | ||
|
||
1. **Create a TOML File** | ||
1. **Clone (or fork) and Install Dependencies** | ||
- `git clone [email protected]:elastic/detection-rules.git` to clone the repository | ||
- Setup your own virtual environment if not already established | ||
- `pip install ".[hunting]"` | ||
|
||
2. **Create a TOML File** | ||
- Navigate to the respective folder (e.g., `aws/queries`, `macos/queries`) and create a new TOML file for your query. | ||
- Ensure that the file is named descriptively, reflecting the purpose of the hunt (e.g., `credential_access_detection.toml`). | ||
|
||
2. **Add Relevant and Required Hunting Information** | ||
3. **Add Relevant and Required Hunting Information** | ||
- Fill out the necessary fields in your TOML file. Be sure to include information such as the author, description, query language, actual queries, MITRE technique mappings, and any notes or references. This ensures the hunt query is complete and provides valuable context for threat hunters. | ||
|
||
3. **Generate the Markdown File** | ||
4. **Generate the Markdown File** | ||
- Once the TOML file is ready, use the following command to generate the corresponding Markdown file: | ||
```bash | ||
python -m hunting generate-markdown | ||
``` | ||
- This will create a Markdown file in the `docs` folder under the respective integration, which can be used for documentation or sharing. | ||
|
||
4. **Refresh the Indexes** | ||
5. **Refresh the Indexes** | ||
- After generating the Markdown, run the `refresh-indexes` command to update the `index.yml` and `index.md` files: | ||
```bash | ||
python -m hunting refresh-index | ||
``` | ||
- This ensures that the new hunt query is reflected in the overall index and is available for searching. | ||
|
||
5. **Open a Pull Request (PR) for Contributions** | ||
6. **Open a Pull Request (PR) for Contributions** | ||
- If you're contributing the query to the project, submit a Pull Request (PR) with your changes. Be sure to include a description of your query and any relevant details to facilitate the review process. | ||
By following this workflow, you can ensure that your hunt queries are properly formatted, documented, and integrated into the Elastic hunting library. | ||
|
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
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