Skip to main content

bhshell

PyPI Status PyPI version CI License: MIT

An interactive command-line shell for BloodHound. Look up Active Directory objects, hunt for weaknesses and find attack paths from the terminal, without opening the web UI.

Installation

Requires Python 3.11+ and a BloodHound CE v9 server (tested on v9.7.1).

pipx install bhshell     # recommended
# or
pip install bhshell

Quick Start

$ bhshell --url http://127.0.0.1:8080

[bh: shell] > login -u admin
[+] Logged in as admin on 127.0.0.1:8080

[bh: shell] > hunt
  Severity   Check            Count   Example                      Description
  critical   dcsync           4       DCSYNCERS@PHANTOM.CORP       Non-Tier-Zero principals with replication rights
  critical   adcs             95      ALICE@PHANTOM.CORP           AD CS escalation paths (ESC*, GoldenCert)
  high       kerberoastable   2       ADMINISTRATOR@PHANTOM.CORP   Kerberoastable users
  ...
[*] Details: 'hunt CHECK' (e.g. 'hunt dcsync'), or 'hunt --all'.

[bh: shell] > user PHANTOM\svc_kerb_del --all -o svc_kerb_del.csv

[bh: shell] > ou phantom.corp -t

[bh: shell] > computer DF-MS-SHS -G

[bh: shell] > gpo 'ENABLE AV@phantom.corp' -c

[bh: shell] > path --owned -g

The same commands run non-interactively for scripting: bhshell -c "hunt --json" > hunt.json.

What it does

Command Shows
user, computer, group, lookup Kerberoastable / AS-REP roastable, delegation, password age, Tier Zero and owned flags, plus group nesting, inbound/outbound ACL control, sessions and local admin rights
ou OUs, containers and whole domains: the OU tree with object, Tier Zero and owned counts, every object below an OU, the GPOs that apply (enforced links, blocked inheritance) and who outside Tier Zero can edit them, and who controls the OU; user/computer -G shows the GPOs applied to one object. Same-named OUs are picked by distinguished name
gpo Where a GPO is linked, the users and computers it applies to (blocked inheritance and enforced links taken into account) and who outside Tier Zero can edit it
ca, template Enterprise CAs and certificate templates: the ESC conditions a template meets (ESC2 and ESC15 included, which BloodHound has no edge for), the CA's host and settings (ESC6, ESC8), and who can enroll, manage (ESC7) or rewrite them (ESC4)
search Objects matching property filters (search -t user hasspn enabled), with dates, ages (90d) and wildcards
path Shortest paths to a target or to Tier Zero, from everything owned, or through --via steps; printed as hop chains, a terminal graph, or SVG/PNG for reports
hunt Domain-wide checks by severity: DCSync, control of Tier Zero, AD CS (ESC*), Kerberoasting, privileged sessions, LAPS/gMSA readers, passwords in attributes, takeover primitives (Shadow Credentials, RBCD), GPO control, NTLM relay, trusts, possible honeytokens...; hunt --owned limits them to what your owned objects can do
cypher, query Raw Cypher, and a library of saved queries: bundled, your own .cyp files (~/.bhshell/queries/ or any folder set with config query_dirs) and those saved on the server
owned, hvt Mark or unmark owned and Tier Zero objects
domains, trusts Per-domain counts, and the trust map with SID filtering status

To add your own query, save it as a .cyp file in ~/.bhshell/queries/ and run it by name:

$ cat ~/.bhshell/queries/stale-admins.cyp
// description: Enabled adminCount users who have not logged on for a year
MATCH (u:User) WHERE u.admincount = true AND u.enabled = true
  AND u.lastlogontimestamp < (datetime().epochseconds - 31536000) RETURN u

[bh: shell] > query run stale-admins -o stale-admins.csv

See Query library for the format and for keeping queries in other folders (a team repository, one folder per engagement).

Most commands take --json and -o FILE (JSON or CSV). Login works with a password (plus MFA) or an API token; secrets are prompted for or read from the environment, never passed as arguments.

Documentation

The full usage guide (every command, view flag, search filter, path option, hunt check and configuration setting) is in docs/USAGE.md. Inside the shell, run help or help <command>.

Contributing

Bug reports and pull requests are welcome at github.com/kr0no/bloodhound-shell/issues.

git clone https://github.com/kr0no/bloodhound-shell.git
cd bloodhound-shell
python3 -m venv .venv && . .venv/bin/activate
pip install -e '.[dev]'
python -m pytest

The tests mock the BloodHound API with responses, so no BloodHound server is needed.

License

Distributed under the MIT License. See LICENSE for details.

BloodHound is a trademark of SpecterOps. bhshell is an independent project and is not affiliated with or endorsed by SpecterOps.

Metadata

Release files for bhshell 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bhshell 0.2.0
File Size Uploaded
bhshell-0.2.0.tar.gz 162.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bhshell 0.2.0
File Interpreter ABI Platform
bhshell-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 295.7 kB

Release files / bhshell-0.2.0.tar.gz

Download URL bhshell-0.2.0.tar.gz
Size 162.8 kB
Tags Source
SHA-256 checksum
How to use checksums
876f03416ca57ce848c1e1e1d2d355932e528fc80e411e1222e939f78cf5d86b
BLAKE2b-256 checksum
How to use checksums
6ce4048e97b2c75d0b336799eddb7b5c803a6a725721e7837a2555198adc15af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / bhshell-0.2.0-py3-none-any.whl

Download URL bhshell-0.2.0-py3-none-any.whl
Size 132.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a29a093afd9414bc3eaffdbb8f257839410b8156fbcfdac44f0d925ac8d0ef69
BLAKE2b-256 checksum
How to use checksums
7c94db8851107c4acdc338d429628f49c406735acfe66e731b4c6deb7c5ee626
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page