posture
Runtime-agnostic Python library for CCM (Continuous Control Monitoring) data collection. The entire contract: credentials in, DataFrame out. Runs unchanged in Docker, Airflow, Databricks — the library never knows or cares where it executes.
See docs/ARCHITECTURE.md for the design behind this
library — the collect/parse split, locked design decisions, manifest schema, and
per-collector implementation notes.
See docs/index.md for every supported collector: its required
environment variables, an example query, and the full column schema for each of
its tables.
Installation
pip install posture
posture loads a .env file from the current directory (or a parent) automatically
on import — no code changes needed. Variables already set in the environment always
take precedence over .env values. Each collector's required variables are listed
on its page in docs/index.md, e.g.:
# .env
CROWDSTRIKE_CLIENT_ID=xxx
CROWDSTRIKE_CLIENT_SECRET=xxx
Usage
from posture import CCM
ccm = CCM("crowdstrike") # creds from CROWDSTRIKE_* env vars
ccm = CCM("crowdstrike", {"client_id": "xxx"}) # partial override, rest from env
df = ccm.collect("hosts") # always a complete pandas DataFrame
ccm.flush_cache() # the only cache invalidation
collect() always returns a complete pandas.DataFrame for the requested resource, or
raises — there is no such thing as a partial snapshot in this library.
Discovering what's available
from posture import catalog
catalog()
# {
# "crowdstrike": {
# "required_config": {"client_id": "CROWDSTRIKE_CLIENT_ID", "client_secret": "CROWDSTRIKE_CLIENT_SECRET"},
# "resources": {
# "hosts": {"derived_from": None, "columns": ["client_id", "device_id", ...]},
# "vulnerability_remediations": {"derived_from": "vulnerabilities", "columns": [...]},
# ...
# },
# },
# "knowbe4": {...},
# ...
# }
catalog() never instantiates a collector, never touches the network, and needs no
credentials — it reads sources, required config (as constructor key → env var), and
resources (including which are derived, and their declared columns) straight off the
registered Collector classes. It only reports required config — optional knobs
(e.g. region, base_url) aren't tracked as data, so check a source's page in
docs/index.md for those.
Example: export Crowdstrike hosts to local JSON
import json
from pathlib import Path
from posture import CCM
# CROWDSTRIKE_CLIENT_ID / CROWDSTRIKE_CLIENT_SECRET must be set in the environment
ccm = CCM("crowdstrike")
df = ccm.collect("hosts")
output_dir = Path("output")
output_dir.mkdir(exist_ok=True)
output_path = output_dir / "hosts.json"
output_path.write_text(df.to_json(orient="records", date_format="iso", indent=2))
print(f"Wrote {len(df)} hosts to {output_path}")
Supported sources
See docs/index.md for the full list of collectors, each with
its required environment variables, an example query, and the column schema for
every table it exposes.
Development
pip install -e ".[dev]"
pytest
ruff check src tests
black src tests
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file posture-0.9.4.tar.gz.
File metadata
- Download URL: posture-0.9.4.tar.gz
- Upload date:
- Size: 131.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edcf08a13bc5457a560031e72d0533b9ca5ab3c017b840994241c914453a7b67
|
|
| MD5 |
d16f95b909457235064c43ab22a837af
|
|
| BLAKE2b-256 |
bcf1cf7b82e3642a54f1e745a4b591b1cda97ada19f8e4a22f2c5a3a73d62d4c
|
File details
Details for the file posture-0.9.4-py3-none-any.whl.
File metadata
- Download URL: posture-0.9.4-py3-none-any.whl
- Upload date:
- Size: 99.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb00da1f87347a205910d666b115461a9eaaf32ef19ac8f6d33395d0f92e67b8
|
|
| MD5 |
9bfcbe67688d431a522b659363a067bc
|
|
| BLAKE2b-256 |
732ab1f3ae306b5e0e823f20e8806cd32e28747761894eb5ff7180a7d828aff3
|