Registry / devops / pykd
library0.3.4.15pypypiunverified

pykd is a Python extension for WinDbg, providing scripting capabilities for Windows kernel and user-mode debugging. It allows users to automate debugging tasks, analyze crash dumps, and extend WinDbg functionality with Python. The current version is 0.3.4.15. Its release cadence is irregular, typically tied to WinDbg updates and community contributions.

pip install pykd
INSTALL
IMPORT
SIG · PYKD
P
pykd
devopspythonv0.3.4.15
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
build_error
glibc
py 3.103.910 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pykd
import pykd
The pykd module is available for import after the pykd extension is loaded within a WinDbg debugger session.

This quickstart demonstrates basic interaction with the WinDbg debugger through pykd, such as retrieving process information, reading register values, and executing debugger commands. This code is intended to be executed within a WinDbg session after loading the pykd extension.

import pykd try: # Get the current process ID if a user-mode debuggee is attached pid = pykd.getCurrentProcessId() print(f"Current Process ID: {pid}") # Read a register value (e.g., EAX for 32-bit, RAX for 64-bit) # This assumes a debuggee is running and registers are available. register_name = "eax" if pykd.is32Bit() else "rax" reg_value = pykd.reg(register_name) print(f"{register_name.upper()} register value: 0x{reg_value:x}") # Execute a simple WinDbg command and print its output output = pykd.dbgCommand("!peb") print("\nOutput of '!peb':") print(output[:200] + "..." if len(output) > 200 else output) # Truncate for display except pykd.BaseException as e: print(f"pykd error encountered: {e}") print("This script must be run within a WinDbg session with a debuggee attached.")
Debug
Known issues
gotchapykd is not a standalone Python library; it must be run within a WinDbg debugger session. Attempting to run pykd code outside WinDbg will result in errors.
fix
Ensure WinDbg is running and the pykd extension (e.g., pykd.pyd) is loaded via `!load <path_to_pykd.pyd>` or `!pykd.py` before executing pykd Python scripts.
affects: all
breakingThe architecture (32-bit or 64-bit) of the Python interpreter used by pykd must precisely match the architecture of the WinDbg installation.
fix
Use a 32-bit Python interpreter with 32-bit WinDbg, and a 64-bit Python interpreter with 64-bit WinDbg. Mismatch causes `ImportError: DLL load failed`.
affects: all
gotchaErrors originating from WinDbg or pykd operations are raised as `pykd.BaseException` or its subclasses, not standard Python exceptions like `RuntimeError` or `ValueError`.
fix
Wrap pykd calls in `try...except pykd.BaseException as e:` blocks for robust error handling specific to pykd's error reporting.
affects: all
gotchaUsing `pip install pykd` installs the package for a specific Python environment. If WinDbg is configured to use a different Python installation, pykd won't be found.
fix
Identify the Python environment WinDbg is configured to use (e.g., via `!pykd.info` or WinDbg settings) and run `pip install pykd` within that specific environment.
affects: all
Upgrade
Version history
0.3.4.15latest on PyPI · released Oct 21, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
17 hits · last 30 days
node
14
Resources
pykd — pip install pykd · libregistry