https://github.com/crowdstrike/caracara
Developer enhancements (DX) for FalconPy, the CrowdStrike Python SDK
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.8%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Developer enhancements (DX) for FalconPy, the CrowdStrike Python SDK
Basic Info
Statistics
- Stars: 40
- Watchers: 6
- Forks: 13
- Open Issues: 9
- Releases: 28
Topics
Metadata Files
README.md
Caracara
A friendly wrapper to help you interact with the CrowdStrike Falcon API. Less code, less fuss, better performance, and full interoperability with FalconPy.
Features
A few of the developer experience enhancements provided by the Caracara toolkit include:
| Feature | Details |
| :--- | :--- |
| Automatic pagination with concurrency | Caracara will handle all request pagination for you, so you do not have to think about things like batch sizes, batch tokens or parallelisation. Caracara will also multithread batch data retrieval requests where possible, dramatically reducing data retrieval times for large datasets such as host lists. |
| Friendly to your IDE (and you!) | Caracara is written with full support for IDE autocomplete in mind. We have tested autocomplete in Visual Studio Code and PyCharm, and will accept issues and patches for more IDE support where needed. Furthermore, all code, where possible, is written with type hints so you can be confident in parameters and return values. |
| Logging | Caracara is built with the in-box logging library provided with Python 3. Simply set up your logging handlers in your main code file, and Caracara will forward over debug, info and error logs as they are produced. Note that the debug logs are very verbose, and we recommend writing these outputs to a file as opposed to the console when retrieving large amounts of lightly filtered data. |
| Real Time Response (RTR) batch session abstraction | Caracara provides a rich interface to RTR session batching, allowing you to connect to as many hosts as possible. Want to download a specific file from every system in your Falcon tenant? Caracara will even extract it from the .7z container for you. |
| Rich and detailed sample code | Every module of Caracara comes bundled with executable, fully configurable code samples that address frequent use cases. All samples are built around a common structure allowing for code reuse and easy reading. Just add your API credentials to config.yml, and all samples will be ready to go. |
| Simple filter syntax | Caracara provides an object-orientated Falcon Query Language (FQL) generator. The FalconFilter object lets you specify filters such as Hostname, OS and Role, automatically converting them to valid FQL. Never write a FQL filter yourself again! |
| Single authentication point of entry | Authenticate once and have access to every module. |
| 100% FalconPy compatibility | Caracara is built on FalconPy, and can even be configured with a FalconPy OAuth2 object via the auth_object constructor parameter, allowing you to reuse FalconPy authentication objects across Caracara and FalconPy. Authenticate once with FalconPy, and access every feature of FalconPy and Caracara. |
Installation Instructions
Caracara supports all major Python packaging solutions. Instructions for Poetry and Pip are provided below.
Caracara supports Python versions that are still supported by the Python Software Foundation, i.e., Python 3.8 and up.
Installing Caracara from PyPI using Poetry (Recommended!)
### Poetry: Installation
```shell
poetry add caracara
```
### Poetry: Upgrading
```shell
poetry update caracara
```
### Poetry: Removal
```shell
poetry remove caracara
```
Installing Caracara from PyPI using Pip
### Pip: Installation
```shell
python3 -m pip install caracara
```
### Pip: Upgrading
```shell
python3 -m pip install caracara --upgrade
```
### Pip: Removal
```shell
python3 -m pip uninstall caracara
```
Basic Usage Examples
```python """List Windows devices.
This example will use the API credentials provided as keywords to list the IDs and hostnames of all systems within your Falcon tenant that run Windows. """
from caracara import Client
client = Client( clientid="12345abcde", clientsecret="67890fghij", )
filters = client.FalconFilter() filters.createnewfilter("OS", "Windows")
responsedata = client.hosts.describedevices(filters) print(f"Found {len(response_data)} devices running Windows")
for deviceid, devicedata in responsedata.items(): hostname = devicedata.get("hostname", "Unknown Hostname") print(f"{device_id} - {hostname}") ```
You can also leverage the built in context manager and environment variables.
```python """List stale sensors.
This example will use the API credentials set in the environment to list the hostnames and IDs of all systems within your Falcon tenant that have not checked into your CrowdStrike tenant within the past 7 days.
This is determined based on the filter LastSeen less than or equal (LTE) to 7 days ago (-7d). """
from caracara import Client
with Client(clientid="${CLIENTIDENVVARIABLE}", clientsecret="${CLIENTSECRETENVVARIABLE}") as client: filters = client.FalconFilter() filters.createnewfilter("LastSeen", "-7d", "LTE") responsedata = client.hosts.describedevices(filters)
print(f"Found {len(response_data)} stale devices")
for deviceid, devicedata in responsedata.items(): hostname = devicedata.get("hostname", "Unknown Hostname") print(f"{device_id} - {hostname}") ```
Examples Collection
Each API wrapper is provided alongside example code. Cloning or downloading/extracting this repository allows you to execute examples directly.
Using the examples collection requires that you install our Python packaging tool of choice, Poetry. Please refer to the Poetry project's installation guide if you do not yet have Poetry installed.
Once Poetry is installed, make sure you run poetry install within the root repository folder to set up the Python virtual environment.
To configure the examples, first copy examples/config.example.yml to examples/config.yml. Then, add your API credentials and example-specific settings to examples/config.yml. Once you have set up profiles for each Falcon tenant you want to test with, execute examples using one of the two options below.
Executing the Examples
There are two ways to use Poetry to execute the examples.
Executing from a Poetry Shell
The `poetry shell` command will enter you into the virtual environment. All future commands will run within the Caracara virtual environment using Python 3, until you run the `deactivate` command.
```shell
poetry shell
examples/get_devices/list_windows_devices.py
```
Executing without Activating the Virtual Environment
If you do not want to enter the Caracara virtual environment (e.g., because you are using your system's installation of Python for other purposes), you can use the `poetry run` command to temporarily invoke the virtual environment for one-off commands.
```shell
poetry run examples/get_devices/list_windows_devices.py
```
All examples are also configured in the `pyproject.toml` file as scripts, allowing them to be executed simply.
```shell
poetry run stale-sensors
```
> To get a complete list of available examples, execute the command `util/list-examples.sh` from the root of the repository folder.
Documentation
Coming soon!
Contributing
Interested in taking part in the development of the Caracara project? Start here.
Why Caracara?
Simple! We like birds at CrowdStrike, so what better bird to name a Python project after one that eats just about anything, including snakes :)
Owner
- Name: CrowdStrike
- Login: CrowdStrike
- Kind: organization
- Email: github@crowdstrike.com
- Location: United States of America
- Website: https://www.crowdstrike.com
- Repositories: 183
- Profile: https://github.com/CrowdStrike
GitHub Events
Total
- Create event: 25
- Release event: 4
- Issues event: 9
- Watch event: 4
- Delete event: 28
- Issue comment event: 40
- Push event: 29
- Pull request review comment event: 2
- Pull request review event: 13
- Pull request event: 62
Last Year
- Create event: 25
- Release event: 4
- Issues event: 9
- Watch event: 4
- Delete event: 28
- Issue comment event: 40
- Push event: 29
- Pull request review comment event: 2
- Pull request review event: 13
- Pull request event: 62
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Joshua Hiller | j****r@c****m | 144 |
| dependabot[bot] | 4****] | 68 |
| Chris Hammond | c****d@c****m | 55 |
| Sam Wedgwood | s****m@w****v | 11 |
| Atte Niemi | 4****r | 4 |
| Kira Noël | 1****l | 3 |
| Natalie | 1****3 | 2 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 21
- Total pull requests: 319
- Average time to close issues: 5 months
- Average time to close pull requests: 18 days
- Total issue authors: 8
- Total pull request authors: 8
- Average comments per issue: 1.62
- Average comments per pull request: 0.78
- Merged pull requests: 137
- Bot issues: 0
- Bot pull requests: 253
Past Year
- Issues: 6
- Pull requests: 76
- Average time to close issues: 9 days
- Average time to close pull requests: 20 days
- Issue authors: 4
- Pull request authors: 4
- Average comments per issue: 0.5
- Average comments per pull request: 0.8
- Merged pull requests: 24
- Bot issues: 0
- Bot pull requests: 50
Top Authors
Issue Authors
- 59e5aaf4 (9)
- ChristopherHammond13 (3)
- hur (2)
- jshcodes (2)
- scottzach1 (2)
- swedgwood (1)
- Chak092 (1)
- kevin-cooper-1 (1)
Pull Request Authors
- dependabot[bot] (254)
- ChristopherHammond13 (38)
- hur (11)
- swedgwood (6)
- jshcodes (6)
- natalie363 (4)
- kenoel (2)
- mjleesment (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 664 last-month
- Total dependent packages: 1
- Total dependent repositories: 1
- Total versions: 26
- Total maintainers: 2
pypi.org: caracara
The CrowdStrike Falcon Developer Toolkit
- Documentation: https://caracara.readthedocs.io/
- License: mit
-
Latest release: 1.0.1
published 10 months ago
Rankings
Maintainers (2)
Dependencies
- astroid 2.11.5 develop
- atomicwrites 1.4.0 develop
- attrs 21.4.0 develop
- bandit 1.7.4 develop
- bullet 2.2.0 develop
- colorama 0.4.4 develop
- coverage 6.4.1 develop
- dill 0.3.5.1 develop
- flake8 4.0.1 develop
- gitdb 4.0.9 develop
- gitpython 3.1.27 develop
- iniconfig 1.1.1 develop
- isort 5.10.1 develop
- lazy-object-proxy 1.7.1 develop
- mccabe 0.6.1 develop
- packaging 21.3 develop
- pbr 5.9.0 develop
- platformdirs 2.5.2 develop
- pluggy 1.0.0 develop
- py 1.11.0 develop
- pycodestyle 2.8.0 develop
- pydocstyle 6.1.1 develop
- pyflakes 2.4.0 develop
- pylint 2.13.9 develop
- pyparsing 3.0.9 develop
- pytest 7.1.2 develop
- pyyaml 6.0 develop
- smmap 5.0.0 develop
- snowballstemmer 2.2.0 develop
- stevedore 3.5.0 develop
- toml 0.10.2 develop
- tomli 2.0.1 develop
- typed-ast 1.5.4 develop
- wrapt 1.14.1 develop
- brotli 1.0.9
- brotlicffi 1.0.9.2
- certifi 2022.5.18.1
- cffi 1.15.0
- charset-normalizer 2.0.12
- crowdstrike-falconpy 1.1.3
- idna 3.3
- importlib-metadata 4.2.0
- multivolumefile 0.2.3
- py7zr 0.17.4
- pybcj 0.6.0
- pycparser 2.21
- pycryptodomex 3.14.1
- pyppmd 0.17.4
- pyzstd 0.15.2
- requests 2.27.1
- texttable 1.6.4
- typing-extensions 4.2.0
- urllib3 1.26.9
- zipp 3.8.0
- PyYAML ^6.0 develop
- bandit ^1.7.3 develop
- bullet ^2.2.0 develop
- coverage ^6.3.2 develop
- flake8 ^^4.0.1 develop
- pydocstyle ^6.1.1 develop
- pylint ^2.12.2 develop
- pytest ^7.0.1 develop
- toml ^0.10.2 develop
- crowdstrike-falconpy ^1.0.10
- py7zr ^0.17.4
- pyppmd 0.17.4
- python ^3.7
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- github/codeql-action/analyze v2 composite
- github/codeql-action/autobuild v2 composite
- github/codeql-action/init v2 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- SFLScientific/spellcheck-github-actions master composite
- actions/checkout v2 composite