Skip to content

ariafatah0711/HPone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

63 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍯 HPone - Docker Honeypot Manager

A powerful Docker honeypot management tool with auto-import capabilities

Docker Python License


🎯 Overview

HPone is a comprehensive Docker-based honeypot management platform that simplifies the deployment, monitoring, and maintenance of security honeypots. With intelligent auto-import features and streamlined command interfaces, HPone makes honeypot management accessible for both production and development environments.

✨ Key Features

  • πŸš€ Auto-Import System - Seamless honeypot template deployment
  • 🐳 Docker Integration - Containerized honeypot environments
  • πŸ“Š Real-time Monitoring - Live log streaming and status tracking
  • πŸ”§ Flexible Configuration - YAML-based honeypot definitions
  • πŸ›‘οΈ Multi-Honeypot Support - Manage multiple honeypot types simultaneously
  • πŸ’» Interactive CLI - User-friendly command-line interface with bash completion
  • ✏️ Built-in Editor - Edit configurations directly from command line

🎬 Quick Demo

10_hpone_preview_v2_3_1.mp4

πŸ“ Project Structure

πŸ“¦ HPone/
┣ πŸš€ app.py                     # Main launcher script
┣ πŸ“‚ hpone/                     # Core application directory
┃ ┣ 🎯 app.py                   # Application entry point
┃ ┣ βš™οΈ config.py               # Configuration management
┃ ┣ πŸ“‚ completion/              # Bash completion scripts
┃ ┣ πŸ“‚ core/                    # Core functionality modules
┃ β”— πŸ“‚ scripts/                 # Command implementations
┣ πŸ“‚ honeypots/                 # 🍯 YAML honeypot definitions
┣ πŸ“‚ template/docker/           # πŸ“‹ Base Docker templates
┣ πŸ“‚ conf/                      # πŸ”§ Persistent configurations
┣ πŸ“‚ docker/                    # 🐳 Generated build outputs (temp)
β”— πŸ“‚ data/                      # πŸ’Ύ Runtime data & logs
β”— πŸ“‹ requirements.txt           # Python dependencies

βš™οΈ Configuration

Configure HPone behavior by editing the configuration file:

  • πŸ“¦ Debian Package Installation: /opt/hpone/hpone/config.py
  • πŸ”§ Source Installation: hpone/config.py (in your project directory)
πŸ“‹ View Configuration Options
# 🎭 Behavior Mode
ALWAYS_IMPORT = True              # Auto-import vs Manual control

# πŸ“ Path Configuration
HONEYPOT_MANIFEST_DIR = PROJECT_ROOT / "honeypots"    # YAML definitions
TEMPLATE_DOCKER_DIR = PROJECT_ROOT / "template" / "docker"  # Base templates
OUTPUT_DOCKER_DIR = PROJECT_ROOT / "docker"           # Build outputs
DATA_DIR = PROJECT_ROOT / "data"                      # Runtime data

# πŸ–₯️  Display Configuration
LIST_BASIC_MAX_WIDTH = 80         # Basic list width
LIST_DETAILED_MAX_WIDTH = 30      # Detailed list width
STATUS_TABLE_MAX_WIDTH = 40       # Status table width

# πŸ“ Logging Configuration
USE_EPHEMERAL_LOGGING = True      # Real-time vs Simple output

πŸš€ Quick Setup

πŸ“¦ Debian Package Installation (Recommended)

# Download and install the latest .deb package
wget https://github.com/ariafatah0711/HPone/releases/latest/download/hpone_all.deb

sudo apt install -f ./hpone_all.deb
sudo usermod -aG docker $USER

# πŸ”„ IMPORTANT: Restart your shell session to activate changes
sudo newgrp docker # Restart current shell with: logout and login again, OR open a new terminal window

πŸ“ Installation Location: When installed via Debian package, HPone is located at /opt/hpone/

πŸ“‚ Debian Package Directory Structure
πŸ“¦ /opt/hpone/                   # Main installation directory
┣ πŸš€ app.py                     # Main application entry point
┣ πŸ“‚ hpone/                     # Core application directory
┃ ┣ 🎯 app.py                   # Application launcher
┃ ┣ βš™οΈ config.py               # Configuration management
┃ ┣ πŸ“‚ completion/              # Bash completion scripts
┃ ┣ πŸ“‚ core/                    # Core functionality modules
┃ β”— πŸ“‚ scripts/                 # Command implementations
┣ πŸ“‚ honeypots/                 # 🍯 YAML honeypot definitions
┣ πŸ“‚ template/docker/           # πŸ“‹ Base Docker templates
┣ πŸ“‚ conf/                      # πŸ”§ Persistent configurations
┣ πŸ“‚ docker/                    # 🐳 Generated build outputs (temp)
┣ πŸ“‚ data/                      # πŸ’Ύ Runtime data & logs
β”— πŸ“‹ requirements.txt           # Python dependencies

πŸ”— Global Access: The hpone command is available system-wide via /usr/bin/hpone

πŸ”§ Source Installation

# Clone and setup HPone
git clone https://github.com/ariafatah0711/HPone hpone
cd hpone

# πŸ”§ Setup with global installation & bash completion
chmod +x setup.sh
./setup.sh install

# πŸ”„ IMPORTANT: Restart your shell session to activate changes
sudo newgrp docker # Restart current shell with: logout and login again, OR open a new terminal window

πŸ›  Manual Installation

πŸ“¦ Dependencies & Libraries

πŸ” Install Required Dependencies

# 🐍 Install Python dependencies
pip3 install -r requirements.txt

# 🐳 Install Docker Engine
sudo apt install docker.io
sudo usermod -aG docker $USER

# πŸ“¦ Install Docker Compose
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.29.0/docker-compose-linux-x86_64 \
  -o $DOCKER_CONFIG/cli-plugins/docker-compose

# πŸ”’ Set executable permissions
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
# Alternative system-wide installation
# sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose

# βœ… Verify installation
docker compose version
🌐 Global Installation

πŸ”— Make HPone Available System-Wide

# πŸ”’ Set executable permissions
chmod +x app.py

# πŸ”— Create symbolic link for global access
sudo ln -s $(pwd)/app.py /usr/local/bin/hpone

# βœ… Test global installation
hpone -h
⌨️ Bash Completion Setup
# Quick setup
chmod +x hpone/completion/install.sh
./hpone/completion/install.sh
exec $SHELL  # Restart shell

🎨 Tab completion works for all commands and honeypot names!


πŸ—‘οΈ Uninstall

πŸ“¦ Debian Package Removal

sudo apt remove hpone # Remove the installed package
sudo apt purge hpone # Optional: Remove configuration files

# πŸ”„ **IMPORTANT:** Restart your shell session after removal:
exec $SHELL # Restart current shell with: logout and login again, OR open a new terminal window

πŸ”„ Source Installation Removal

# 🧹 Uninstall global installation & bash completion
chmod +x setup.sh
./setup.sh uninstall

# πŸ”„ IMPORTANT: Restart your shell session after uninstallation
exec $SHELL                       # Restart current shell

# πŸ—‚οΈ Optional: Remove project directory
cd ..
rm -rf hpone

🎯 Getting Started

πŸš€ Quick Start

βš™οΈ Setup

hpone enable cowrie medpot conpot # Enable multiple honeypots
hpone up --all                    # Start all enabled honeypots

πŸ“ˆ Monitor

hpone list -a                 # Check status
hpone logs cowrie             # View logs

πŸ’» Manage

hpone edit cowrie             # Edit configuration
hpone shell cowrie            # Container access
hpone clean --all --data      # Stop & cleanup

πŸ”§ Command Reference

πŸ“Š Core Commands

Command Description Options Example
πŸ” check Verify dependencies - hpone check
πŸ“‹ list Show honeypots -a hpone list -a
πŸ“ˆ status Runtime status - hpone status
πŸ”Ž inspect Honeypot details - hpone inspect cowrie
✏️ edit Edit configurations <honeypot>, --config, --completion hpone edit cowrie

✨ Edit Features: Smart editor detection β€’ SSH-aware β€’ YAML validation β€’ Interactive recovery β€’ Tab completion

πŸƒ Lifecycle Commands

Command Description Options Example
βš™οΈ enable/disable Toggle honeypot(s) - hpone enable cowrie medpot
πŸš€ up Start honeypot --all, --force hpone up --all
πŸ“ down Stop honeypot --all hpone down cowrie
πŸ’» shell Container access - hpone shell cowrie
πŸ“„ logs Interactive logs - hpone logs cowrie
πŸ—‘οΈ clean Stop & remove --all, --data, --image, --volume hpone clean --all --data

🎨 Quick Examples

# πŸš€ Basic workflow
hpone enable cowrie conpot
hpone up --all
hpone logs cowrie     # Interactive log viewer
hpone shell cowrie    # Container access
hpone down cowrie

# πŸ“ Configuration
hpone edit cowrie     # Edit honeypot config
hpone edit --config   # Edit main settings

# πŸ“Š Monitoring
hpone list -a         # Detailed status
hpone status          # Port mappings

# πŸ—‘οΈ Cleanup
hpone clean --all --data --image --volume

πŸ” Troubleshooting

πŸ₯Ύ Dependency Check

hpone check  # Comprehensive system validation

πŸ“‚ Accessing HPone Files

πŸ“¦ Debian Package Installation:

# Configuration files
sudo nano /opt/hpone/hpone/config.py

# View honeypot templates
ls /opt/hpone/honeypots/

# Check data directory
ls /opt/hpone/data/

# Access application files
cd /opt/hpone/

πŸ”§ Source Installation:

# Configuration files
nano hpone/config.py

# All files are in your project directory
ls honeypots/
ls data/

πŸ“ Ephemeral Logging System

HPone features real-time ephemeral logging for clean output:

[22:48:02] [INFO] Starting cowrie containers...
[22:48:05] [INFO] Docker network created
[22:48:06] [INFO] Building cowrie image
[22:48:10] [INFO] Container cowrie started
πŸš€ [UP] cowrie OK (2.3s)

πŸ› Issues? Set USE_EPHEMERAL_LOGGING = False in config.py for detailed output.


πŸ“‹ Creating Custom Honeypots

🎨 YAML Configuration Template

Create a new file in honeypots/ directory:

# 🍯 Custom Honeypot Definition
name: myhoneypot
description: "Custom honeypot for HTTP services"
enabled: true

# πŸ“ Optional: Custom template directory
template_dir: custom/template/path  # Relative or absolute path

# 🌐 Port Configuration
ports:
- host: 8080
  container: 80
  description: "HTTP service"
- host: 8443
  container: 443
  description: "HTTPS service"

# 🌍 Environment Variables (merged with template defaults)
env:
  MY_CUSTOM_VAR: "production_value"
  DEBUG_MODE: "false"
  LOG_LEVEL: "INFO"

# πŸ’Ύ Volume Mounts
volumes:
- data/myhoneypot/logs:/app/logs           # Persistent logs
- conf/myhoneypot/config.yml:/app/config.yml  # Custom config override

πŸ”‘ Key Configuration Fields

Field Type Description
template_dir Optional Custom template path (relative to project or absolute)
env Object Environment variables (merged with template defaults)
ports Array Port mappings with optional descriptions
volumes Array Volume mounts for data persistence and configuration

πŸ“ Important Notes

πŸš€ Operation Modes

HPone has two modes configured in hpone/config.py:

  • πŸ€– Auto Mode (ALWAYS_IMPORT=true) - Production ready, auto-manages templates
  • πŸ”§ Manual Mode (ALWAYS_IMPORT=false) - Development friendly, full control

πŸ“ Quick Tips

  • ⚠️ Disabled honeypots won't auto-start
  • πŸ‘ Use --force to override enabled status
  • πŸ’» shell command requires running containers

🀝 Contributing

πŸŽ† Help make HPone better!

  1. 🍴 Fork the project
  2. 🌱 Create feature branch (git checkout -b feature/amazing-feature)
  3. πŸ“ Commit changes (git commit -m 'Add amazing feature')
  4. πŸš€ Push to branch (git push origin feature/amazing-feature)
  5. πŸ“© Open Pull Request

πŸ“„ License

HPone is licensed under the GNU General Public License v3.0 (GPL-3.0) See the LICENSE file for details.


🍯 Made with ❀️ for cybersecurity enthusiasts