dbeaver-creds

Decrypt DBeaver's credentials-config.json file and display the output (a JSON string).

View on GitHub

dbeaver-creds

Python versions PyPI - Version GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) QA Dependabot Documentation Status mypy uv Ruff Downloads Stargazers pre-commit Prettier Tests Coverage Status C CMake PowerShell Gallery Version (including pre-releases) PowerShell Gallery Platform Support PowerShell Gallery Downloads

@Tatsh Buy Me A Coffee Libera.Chat Mastodon Follow Patreon

Decrypt DBeaver’s credentials-config.json file and display the output (a JSON string).

This project ships in six flavours so you can use it in whichever language or shell suits you:

Installation

Python

pip install dbeaver-creds

Native CLI / C library

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
sudo cmake --install build

DBEAVER_CREDS_BACKEND=native|openssl (passed via -D) overrides the auto-detected backend (native = CommonCrypto on macOS / BCrypt on Windows; openssl = cross-platform).

Shell scripts

Place dbeaver-creds (or dbeaver-creds.bat) in PATH.

PowerShell

Install-Module -Name DBeaverCreds

Usage

All entry points accept an optional path argument; if absent, the platform-default credentials path is used. If the credentials file cannot be read, the exit status is non-zero.

Native CLI / Bash / Batch

dbeaver-creds [PATH]

Python

from dbeaver_creds import get_dbeaver_credentials

print(get_dbeaver_credentials())                  # default path
print(get_dbeaver_credentials('/some/where.json'))  # explicit

Or use the console script installed by pip:

dbeaver-creds [PATH]
python -m dbeaver_creds [PATH]

C library

#include <dbeaver-creds.h>
#include <stdio.h>
#include <stdlib.h>

int main(void) {
  enum dbeaver_credentials_error err = DBEAVER_CREDENTIALS_OK;
  char *json = get_dbeaver_credentials(NULL, &err);  // pass a literal path or NULL
  if (!json) {
    fprintf(stderr, "dbeaver-creds failed: %d\n", err);
    return 1;
  }
  puts(json);
  free(json);
  return 0;
}

PowerShell

Show-DBeaver-Credential-Json
# Or the alias:
dbeaver-creds
# With an explicit path:
Show-DBeaver-Credential-Json -Path 'C:\custom\credentials-config.json'

Development

Requirements:

Notes

The decryption key is from the DBeaver source.

It can be converted to hexadecimal like so in Python:

import struct
as_hex = struct.pack('<16b', 0, 1, 2, etc).hex()

update-key.sh demonstrates conversion using shell script.

Tasks