---
name: keepass_dump
kind: function
lang: bash
domain: infra
version: "1.0.0"
purity: impure
signature: "keepass_dump() -> json"
description: "Exporta toda la BD KeePassXC como array JSON. Una sola apertura del .kdbx via keepassxc-cli export -f xml + python3 etree para parsear. Cada elemento: {path,title,username,password,url,notes}."
tags: [keepass, keepassxc, dump, export, batch]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: []
params: []
output: "array JSON de objetos {path,title,username,password,url,notes}"
tested: false
tests: []
test_file_path: ""
file_path: "bash/functions/infra/keepass_dump.sh"
---

## Ejemplo

```bash
source keepass_dump.sh
data=$(keepass_dump)

# Filtrar por grupo
echo "$data" | jq '.[] | select(.path | startswith("Servers/"))'

# Solo passwords no vacios
echo "$data" | jq '.[] | select(.password != "")'

# Contar
echo "$data" | jq 'length'
```

## Notas

- KeePassXC 2.6.x export solo soporta `xml` y `csv` (no JSON nativo). Por eso pasamos por python3.
- 2.7.0+ tiene `-f json` directo; este wrapper sigue funcionando.
- Output ya descifrado (master password aplicada en export). El atributo `Protected="True"` del XML solo es marker.
- El leading "Root" del KDBX se omite en `path`.
