Skip to content

Tatsh/dbeaver-creds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

225 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dbeaver-creds

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

@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:

  • Python module (pip install dbeaver-creds) - importable as dbeaver_creds and exposes a dbeaver-creds console script. C-extension under the hood, no external dependencies on your machine.
  • Native CLI binary built from this source tree via CMake. Single static binary, no runtime dependencies beyond the chosen crypto backend (CommonCrypto on macOS, BCrypt on Windows, OpenSSL on Linux).
  • C library (#include <dbeaver-creds.h>) - link dbeaver_creds_core.a and call get_dbeaver_credentials(path).
  • Bash script that works on Linux, macOS, and Windows. Requires openssl and dd to be in PATH.
  • PowerShell module (DBeaverCreds) exposing Show-DBeaver-Credential-Json (alias dbeaver-creds). Pure .NET; no external dependencies.
  • Batch script (Windows only) equivalent to the Bash script with the same openssl + dd requirements.

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:

  • Bash
  • GNU sed
  • Perl
  • Yarn
  • curl
  • cut
  • grep
  • tr

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

  • yarn format: to format the project's files.
  • yarn qa: Perform a QA check.
  • yarn update-key or update-key.sh: update the key in dbeaver-creds.

About

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

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Contributors