A script to gracefully stop Bloodhound and Neo4j database running on Kali Linux.
This script executes the following processes in order:
- Terminate Bloodhound GUI process
- Gracefully stop Neo4j database
- Force kill remaining processes
- Clean up used ports (7474, 7687)
- Kali Linux (or other Debian-based Linux)
- Bloodhound
- Neo4j
- sudo privileges
# Download or create the script
nano bloodhound_stop.sh
# Grant execute permission
chmod +x bloodhound_stop.sh./bloodhound_stop.shNote: You may be prompted for a password as stopping Neo4j requires sudo privileges.
sudo ./bloodhound_stop.shStopping Bloodhound and Neo4j...
[1/3] Stopping Bloodhound GUI...
[2/3] Stopping Neo4j database...
[3/3] Checking for processes on Neo4j ports...
✓ Done! Bloodhound and Neo4j stopped.
Verification:
No Bloodhound or Neo4j processes running
pkill -f "BloodHound"- Terminates the Bloodhound graphical interface
- Displays a message if the process is not found
sudo neo4j stop- Gracefully stops the Neo4j database service
- Ensures data integrity during shutdown
sudo pkill -9 -f "java.*neo4j"- Force kills Neo4j processes if they didn't stop gracefully
- Targets Neo4j running as Java processes
sudo lsof -ti:7474 | xargs -r sudo kill -9
sudo lsof -ti:7687 | xargs -r sudo kill -9- Releases ports 7474 (HTTP) and 7687 (Bolt) used by Neo4j
- Prevents port conflicts on next startup
Manual verification and termination methods:
# Check processes
ps aux | grep -E "BloodHound|neo4j"
# Manually terminate
killall -9 BloodHound
sudo neo4j stop
sudo pkill -9 -f "java.*neo4j"# Check port usage
sudo netstat -tulpn | grep -E "7474|7687"
# Or
sudo lsof -i :7474
sudo lsof -i :7687
# Force release ports
sudo fuser -k 7474/tcp
sudo fuser -k 7687/tcp# Run with sudo
sudo ./bloodhound_stop.sh
# Or use sudo only for specific commands
# (The script is already configured this way)After running the script, verify proper shutdown with these commands:
# Check processes
pgrep -a BloodHound
pgrep -a neo4j
# Check ports
sudo netstat -tulpn | grep -E "7474|7687"
# If nothing is displayed, the shutdown was successfulTo restart Bloodhound after stopping with this script:
# Start Neo4j
sudo neo4j start
# Or
sudo neo4j console # Start in foreground
# Start Bloodhound
bloodhoundThis script is freeware. Feel free to use and modify it.
- This script may force-terminate Bloodhound and Neo4j
- Save important data analysis before running
- The script attempts graceful shutdown first to maintain Neo4j database integrity