Skip to main content

A collection of functions to operate with a KeePass-database

Project description

KeePass AutoType Helper

This Python script allows you to retrieve credentials from a KeePass database and automatically type them into applications or fields using a custom AutoType sequence.

It integrates with:

  • pykeepass — to read entries from a KeePass database (.kdbx).
  • pywinauto — to send keystrokes and control windows.
  • dynamicinputbox — to prompt for KeePass database password interactively.

Features

  • Prompt for KeePass database password in a secure dialog.
  • Retrieve a full KeePass entry or just username/password.
  • Support for {USERNAME}, {PASSWORD}, {URL}, {NOTES}, and {TITLE} placeholders in AutoType sequences.
  • Handle special keys ({ENTER}, {TAB}, {F1}, etc.).
  • Handle delays ({DELAY 1000} for 1 second pause).
  • Support virtual key codes ({VKEY 0x41} for A).
  • Handle modifier keys ({CTRL}, {ALT}, {SHIFT}, {WIN}).

Requirements

Install dependencies via pip:

pip install pykeepass pywinauto dynamicinputbox

Usage

1. Prepare your KeePass database

Make sure your KeePass .kdbx file exists (default: ~/Pwd_Db.kdbx).

Add entries with:

  • Title (used to look up the entry).
  • Username and Password fields.
  • AutoType sequence (e.g., {USERNAME}{TAB}{PASSWORD}{ENTER}). This is optional for the entry, but needed for the use_KeePass_sequence method.

2. Import and use in Python

from keepass_autotype import get_credentials, use_KeePass_sequence

Retrieve only username & password

username, password = get_credentials( "My Entry Title" )

Retrieve full entry and auto-type it

use_KeePass_sequence( "My Entry Title" )

Default values

Database file: Pwd_Db.kdbx

Database path: ~ (home directory)

These can be replaced with: get_credentials("My Entry Title", file="Custom.kdbx", path="/path/to/db")

AutoType Sequence Syntax

Supported placeholders:

  • {USERNAME} — Entry's username.
  • {PASSWORD} — Entry's password.
  • {URL} — Entry's URL.
  • {NOTES} — Entry's notes.
  • {TITLE} — Entry's title.

Special commands:

  • {ENTER}, {TAB}, {ESC}, {F1} ... {F12}, {UP}, {DOWN}, {LEFT}, {RIGHT}.
  • {DELAY 1000} — Pause for 1000ms.
  • {VKEY 0x41} — Press virtual key (hex code).
  • {CTRL}, {ALT}, {SHIFT}, {WIN} — Press and hold modifier.
  • {CTRLUP}, {ALTUP}, {SHIFTUP}, {WINUP} — Release modifier.

Example

In KeePass, set the entry's AutoType sequence to:

{USERNAME}{TAB}{PASSWORD}{ENTER}

Then in Python:

use_KeePass_sequence("My Entry Title")

The script will:

  • Prompt for your KeePass database password.
  • Retrieve the username and password from the given entry.
  • Automatically type them into the currently focused application.

Security Notice

This script sends keystrokes to the active window — make sure the correct window is focused before running.

The KeePass database password is entered via a masked prompt but is kept in memory during runtime.

Use responsibly in trusted environments.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keepassfunctions-1.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keepassfunctions-1.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file keepassfunctions-1.1.tar.gz.

File metadata

  • Download URL: keepassfunctions-1.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for keepassfunctions-1.1.tar.gz
Algorithm Hash digest
SHA256 74804e5a332714b6f532eb2cf165d1812b79674487086f9a94e9e0a92d88060d
MD5 d69c9836a1fbdef20cc049597a617c8e
BLAKE2b-256 3bb1792305630b67b759accda793e2171414715bf30753e678d145815b6aa59a

See more details on using hashes here.

File details

Details for the file keepassfunctions-1.1-py3-none-any.whl.

File metadata

  • Download URL: keepassfunctions-1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for keepassfunctions-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fefdaf296c83a58e38d01cdc113bc3caaa2a2bc6c89d6c9e18b635061038df97
MD5 9bd2ec0c733f29137a1f2a3914cfbf87
BLAKE2b-256 3247ff196c3c84bc5e5691baba5129f3b23c4f78cdea3c6acace7a2c6334c147

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page