Sign inSign up

fagneftr/bloodhound

By fagneftr

•Updated 2 days ago

Image
0

145

fagneftr/bloodhound repository overview

⁠Content

šŸ“Œ 1 → Project Files

šŸ“Œ 2 → Configuring BloodHound Community Edition Docker Compose

šŸ“Œ 3 → Getting Data

šŸ“Œ 4 → All In One

šŸ“Œ 5 → Usage

šŸ“Œ 6 → References

ā šŸ“Œ 1 → Project Files

compose.yaml

services:
  app-db:
    image: docker.io/library/postgres:18@sha256:979bccfde35445db618c65107d27d08c6c21339d8dc3ad4c830c6633947be0e4
    environment:
      - PGUSER=${POSTGRES_USER:-bloodhound}
      - POSTGRES_USER=${POSTGRES_USER:-bloodhound}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-bloodhoundcommunityedition}
      - POSTGRES_DB=${POSTGRES_DB:-bloodhound}
    volumes:
      - postgres-data:/var/lib/postgresql
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-bloodhound} -d ${POSTGRES_DB:-bloodhound} -h 127.0.0.1 -p 5432" ]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s

  graph-db:
    image: docker.io/library/neo4j:4.4.42@sha256:73b5a47eb9952f47fcc42fcc80bdd6bd0d6b71eea9a1a345c216675498c790e4
    environment:
      - NEO4J_AUTH=${NEO4J_USER:-neo4j}/${NEO4J_SECRET:-bloodhoundcommunityedition}
      - NEO4J_dbms_allow__upgrade=${NEO4J_ALLOW_UPGRADE:-true}
    ports:
      - 127.0.0.1:${NEO4J_DB_PORT:-7687}:7687
      - 127.0.0.1:${NEO4J_WEB_PORT:-7474}:7474
    volumes:
      - ${NEO4J_DATA_MOUNT:-neo4j-data}:/data
    healthcheck:
      test: [ "CMD-SHELL", "wget -O /dev/null -q http://localhost:7474 || exit 1" ]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s

  bloodhound:
    image: docker.io/specterops/bloodhound@sha256:9be9877e5dd460c567a30290cce4fbc8ee69a19da15c2e3868e69e1079c4a88c
    environment:
      - bhe_disable_cypher_complexity_limit=${bhe_disable_cypher_complexity_limit:-false}
      - bhe_enable_cypher_mutations=${bhe_enable_cypher_mutations:-false}
      - bhe_graph_query_memory_limit=${bhe_graph_query_memory_limit:-2}
      - bhe_database_connection=user=${POSTGRES_USER:-bloodhound} password=${POSTGRES_PASSWORD:-bloodhoundcommunityedition} dbname=${POSTGRES_DB:-bloodhound} host=app-db
      - bhe_neo4j_connection=neo4j://${NEO4J_USER:-neo4j}:${NEO4J_SECRET:-bloodhoundcommunityedition}@graph-db:7687/
      - bhe_recreate_default_admin=${bhe_recreate_default_admin:-false}
      - bhe_graph_driver=${GRAPH_DRIVER:-neo4j}
    ports:
      - ${BLOODHOUND_HOST:-127.0.0.1}:${BLOODHOUND_PORT:-8080}:8080
    volumes:
      - ./bloodhound.config.json:/bloodhound.config.json:ro
    depends_on:
      app-db:
        condition: service_healthy
      graph-db:
        condition: service_healthy
  collector:
    image: fagneftr/bloodhound@sha256:8f01d1b113c507a883547fb1bc9aad70f4e07d480bc32c6b0606ba3927e558de
    container_name: bloodhound-python
    tty: true
    command: sleep infinity
    volumes:
      - /tmp/:/bloodhound-data
volumes:
  neo4j-data:
  postgres-data:

bloodhound.config.json

{
  "version": 1,
  "bind_addr": "0.0.0.0:8080",
  "metrics_port": ":2112",
  "root_url": "http://127.0.0.1:8080/",
  "work_dir": "/opt/bloodhound/work",
  "log_level": "INFO",
  "graph_driver": "neo4j",
  "tls": {
    "cert_file": "",
    "key_file": ""
  },
  "collectors_base_path": "/etc/bloodhound/collectors",
  "default_admin": {
    "principal_name": "admin",
    "password": "admin",
    "first_name": "BloodHound",
    "last_name": "Admin",
    "email_address": "[email protected]"
  }
}

ā šŸ“Œ 2 → Configuring BloodHound Community Edition Docker Compose

ā šŸ”¹šŸŸ¢ 2.1 → Start Sample App from: SpecterOps Example⁠

compose.yaml

bloodhound.config.json

docker compose up -d --build
firefox http://localhost:8080/
#User: admin, Password: admin

ā šŸ“Œ 3 → Getting Data

⁠Getting Data From Linux

To get data, you can use the dirkjanm BloodHound collector (bloodbhound-python)

  # To use a collector in Kali Linux
  sudo apt install bloodhound-ce-python

  bloodhound-ce-python -d $domain -u $username -p $password -dc $dc.$domain -c All;

  # Output files
  ā”œā”€ā”€ 20260511193029_computers.json
  ā”œā”€ā”€ 20260511193029_containers.json
  ā”œā”€ā”€ 20260511193029_domains.json
  ā”œā”€ā”€ 20260511193029_gpos.json
  ā”œā”€ā”€ 20260511193029_groups.json
  ā”œā”€ā”€ 20260511193029_ous.json
  └── 20260511193029_users.json

⁠Getting Data From Mac OS

For Mac OS with Docker Desktop you can build the docker image https://github.com/dirkjanm/BloodHound.py.git⁠

  git clone https://github.com/dirkjanm/BloodHound.py.git
  cd BloodHound.py

  #Build and upload an image to docker hub
  docker buildx build \
    --builder desktop-linux \
    --platform linux/amd64,linux/arm64 \
    --file . \
    -t fagneftr/bloodhound:1.0.0 -t fagneftr/bloodhound:latest --push \
    .
    
  # Run the container
  docker run --rm -it -v ${PWD}:/bloodhound-data fagneftr/bloodhound bloodhound-ce-python -d $domain -u $username -p $password -dc $dc -c All --zip
⁠Getting Data From Windows
  https://github.com/SpecterOps/SharpHound/releases

  # Download the file and upload to target AD
  upload SharpHound.exe

  download Data.json

ā šŸ“Œ 4 → All In One

For fast usage, create the bloodhound structure like below, it includes all you need to use: the user interface and collector

# Create a folder for the project
/opt/bloodhound-all-in-one/
ā”œā”€ā”€ bloodhound.config.json
ā”œā”€ā”€ compose.yaml

/tmp/
ā”œā”€ā”€ 20260511193029_computers.json
ā”œā”€ā”€ 20260511193029_containers.json
ā”œā”€ā”€ 20260511193029_domains.json
ā”œā”€ā”€ 20260511193029_gpos.json
ā”œā”€ā”€ 20260511193029_groups.json
ā”œā”€ā”€ 20260511193029_ous.json
└── 20260511193029_users.json

After that, include this alias in the .zshrc file (or .bashrc)

#bloodhound Alias
# Path to project
PATH_BLOODHOUND="/opt/bloodhound-all-in-one"
# Build the project
bloodhound() {
    docker compose -f "$PATH_BLOODHOUND/compose.yaml" up -d --build;
    open http://localhost:8080/
}
# Drop everything
bloodhound-stop() {
    docker compose -f "$PATH_BLOODHOUND/compose.yaml" down --volumes --rmi all
}
# Get data from DC, by LDAP
bloodhound-data() {
	local missing=0
	
	[[ -z "$domain" ]] && { echo "āŒ The variable \$domain is not defined.."; missing=1; }
	[[ -z "$username" ]] && { echo "āŒ The variable \$username is not defined.."; missing=1; }
	[[ -z "$password" ]] && { echo "āŒ The variable \$password is not defined.."; missing=1; }
	[[ -z "$dc" ]] && { echo "āŒ The variable \$dc is not defined.."; missing=1; }

	if [ $missing -eq 1 ]; then
		echo "āš ļø Configure the variable before start."
		return 1
	fi
	echo "āœ… All variables defined! Starting...."
	docker exec bloodhound-python /usr/local/bin/bloodhound-python -d $domain -u $username -p $password -dc $dc.$domain -c All;
	mv /tmp/*.json $(pwd)/
}

ā šŸ“Œ 5 → Usage

# Start the Containers
bloodhound
# Getting Data (By LDAP)
bloodhound-data
# Clean up
bloodhound-stop

ā šŸ“Œ 6 → References

SpecterOps > Bloodhound > Docker Example⁠

SpecterOps > SharpHound - Windows Collector⁠

Dirkjanm > Bloodhound Collector⁠

Kali Linux Tools > BloodHound ⁠

Tag summary

Content type

Image

Digest

sha256:8f01d1b11…

Size

58.2 MB

Last updated

2 days ago

docker pull fagneftr/bloodhound