Skip to content

Repository files navigation

πŸ›‘οΈ SSH Honeypot v2.0

Stars Forks License Python Docker MITRE ATT&CK PRs Welcome CI Last Commit Issues Sponsor Buy Me a Coffee

Deception-based threat intelligence collection for cybersecurity researchers, SOC teams, and AI/ML enthusiasts.

Capture real attacker behavior β†’ enrich with threat intel feeds β†’ map to MITRE ATT&CK β†’ analyze, alert, and learn.

Created by Jainam Maru


πŸ”­ Overview: Why a Honeypot?

Real-world attack data is the single best training set for detection engineering, yet most defenders never see it. An SSH honeypot sits on the front lines and turns every credential-stuffing bot and manual intruder into structured intelligence:

  • πŸ“‘ Collect β€” raw auth attempts, executed commands, and SFTP activity from real attackers
  • 🌍 Enrich β€” geolocation (GeoIP2 / ip-api.com), threat scoring (AbuseIPDB, AlienVault OTX, VirusTotal)
  • 🧠 Map β€” automatic classification to MITRE ATT&CK techniques (T1110, T1059, T1098…)
  • πŸ’Ύ Store β€” human-readable logs, structured JSON, and a queryable SQLite database
  • πŸ”” Act β€” webhook / Slack / Discord / email alerts with per-severity thresholds

This project is the data-collection layer of a full threat-intelligence pipeline β€” pair it with dark-sentinel for dark-web coverage or feed the JSON output into your own detection stack.

πŸ—οΈ Architecture

flowchart LR
    A[Attacker Bot / Manual Intruder] -->|TCP :2222| B

    subgraph HP[SSH Honeypot]
        B[Paramiko SSH Server<br/>Dynamic Banner Spoofing] --> C[Auth Attempt Capture<br/>username Β· password Β· key fp]
        C --> D[Fake Shell / SFTP<br/>command & file activity]
        C --> E[Rate Limiter +<br/>Auto-Ban]
    end

    D --> F[Log Parser & Enricher]
    E --> F
    F -->|GeoIP2 / ip-api| G[IP Geolocation<br/>city Β· country Β· ASN]
    F -->|AbuseIPDB Β· OTX Β· VT| H[Threat Scoring<br/>0-10 severity]
    F --> I[MITRE ATT&CK Mapper<br/>T1110 Β· T1059 Β· T1098 Β· ...]
    I --> J[(SQLite DB)]
    I --> K[attacks.json / attacks.log]
    J --> L[Web Dashboard<br/>FastAPI Β· live stats]
    K --> L
    L --> M[Alerting<br/>Webhook Β· Slack Β· Discord Β· Email]
Loading

Data flow: every keystroke an attacker types lands in attacks.json with an ATT&CK technique ID, a geolocation, and a severity score β€” ready for SIEM ingestion or ML analysis.

πŸš€ Quick Start

Option A β€” One-line installer (coming soon)

curl -sSL https://raw.githubusercontent.com/Dev9269/ssh-honeypot/main/install.sh | bash

Option B β€” Manual

git clone https://github.com/Dev9269/ssh-honeypot.git
cd ssh-honeypot
pip install -r requirements.txt

# Basic honeypot on :2222
python main.py

# With live dashboard on :8080
python main.py --dashboard

# With YAML config
python main.py --config honeypot.yaml

Docker Deployment

docker-compose up --build

# Or manually
docker build -t ssh-honeypot .
docker run -d -p 2222:2222 -p 8080:8080 ssh-honeypot

πŸ†• What's New in v2.0

  • Fake Shell Interaction β€” Captures attacker commands in a realistic Linux shell environment
  • IP Geolocation β€” Maps attacker IPs to city/country/ASN (GeoIP2 or ip-api.com fallback)
  • Threat Intelligence β€” AbuseIPDB, AlienVault OTX, VirusTotal integration
  • Real-time Alerts β€” Webhook, Slack, Discord, and email notifications
  • Web Dashboard β€” FastAPI-based live monitoring UI with auth
  • SQLite Database β€” Structured storage for querying and analysis
  • MITRE ATT&CK Mapping β€” Auto-tags attacks with TTP IDs
  • Rate Limiting β€” Per-IP connection throttling with auto-ban
  • Dynamic Fingerprinting β€” Randomized SSH banners to avoid detection
  • Log Rotation β€” Automatic rotation with size/backup limits
  • YAML Configuration β€” Full config via honeypot.yaml
  • Docker Support β€” Containerized deployment with docker-compose
  • SFTP Simulation β€” Fake file transfer environment
  • Prometheus Metrics β€” /metrics endpoint for monitoring

✨ Features

Feature Description
SSH Simulation Realistic OpenSSH banner spoofing with dynamic fingerprint rotation
Auth Logging Captures username, password, key fingerprint, method, timestamp
Command Capture Fake shell records every command attackers execute
Geolocation IP β†’ location mapping (offline GeoIP2 or free ip-api.com API)
Threat Scoring Multi-source threat intelligence scoring (0-10)
MITRE ATT&CK Auto-classifies attacks to TTP framework (T1110, T1059, T1098, etc.)
Alerts Webhook, Slack, Discord, SMTP email notifications
Dashboard Real-time web UI with stats, top IPs, recent attacks
Rate Limiting Per-IP connection limit with automatic temp bans
IP Filtering Whitelist/blacklist by IP or CIDR range
Database SQLite for structured querying and analytics
Docker Containerized via Dockerfile + docker-compose
macOS .app Native macOS application support

πŸ–₯️ Console Output

[*] SSH Honeypot v2.0.0 listening on 0.0.0.0:2222
[*] Fake banner: SSH-2.0-OpenSSH_7.9p1 Debian-10
[*] Logs: logs/attacks.log, logs/attacks.json
[*] Database: logs/honeypot.db
[*] Geolocation: enabled
[*] Threat Intelligence: enabled
[*] Alerts: enabled
[*] Fake Shell: enabled (ubuntu-server)
[*] Dashboard: http://127.0.0.1:8080
[*] Press Ctrl+C to stop
[+] Connection from 192.168.1.100:54321 [New York, US] [threat: 6/10]
[+] Connection from 10.0.0.5:12345 [London, GB] [threat: 0/10]
[!] Rate limit exceeded for 203.0.113.5
[-] Connection closed from 192.168.1.100 (duration: 12.5s)

🐚 Fake Shell Example

When an attacker connects (the honeypot rejects auth but still serves a shell):

Linux ubuntu-server 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2025 x86_64 GNU/Linux

root@ubuntu-server:/root$ whoami
root
root@ubuntu-server:/root$ id
uid=0(root) gid=0(root) groups=0(root)
root@ubuntu-server:/root$ uname -a
Linux ubuntu-server 5.15.0-91-generic #101-Ubuntu SMP...
root@ubuntu-server:/root$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
root@ubuntu-server:/root$ exit
logout

All commands are logged to attacks.log, attacks.json, and the SQLite database with MITRE ATT&CK classifications.

πŸ“ Project Structure

ssh-honeypot/
β”œβ”€β”€ honeypot/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ server.py       # SSH server + client handler
β”‚   β”œβ”€β”€ shell.py        # Fake shell with command responses
β”‚   β”œβ”€β”€ config.py       # Configuration (YAML + defaults)
β”‚   β”œβ”€β”€ logger.py       # Logging (.log, .json, rotation)
β”‚   β”œβ”€β”€ db.py           # SQLite database backend
β”‚   β”œβ”€β”€ geo.py          # IP geolocation (GeoIP2 + ip-api.com)
β”‚   β”œβ”€β”€ intel.py        # Threat intelligence (AbuseIPDB, OTX, VT)
β”‚   β”œβ”€β”€ alerts.py       # Alerting (webhook, Slack, Discord, email)
β”‚   β”œβ”€β”€ ratelimiter.py  # Per-IP rate limiter with auto-ban
β”‚   β”œβ”€β”€ analyzer.py     # MITRE ATT&CK framework mapping
β”‚   β”œβ”€β”€ dashboard.py    # FastAPI web dashboard
β”‚   └── sftp_server.py  # SFTP simulation
β”œβ”€β”€ logs/               # Attack logs + database
β”œβ”€β”€ main.py             # Entry point
β”œβ”€β”€ honeypot.yaml       # YAML configuration
β”œβ”€β”€ Dockerfile          # Docker build
β”œβ”€β”€ docker-compose.yml  # Docker compose
β”œβ”€β”€ requirements.txt    # Python dependencies
└── README.md

βš™οΈ Configuration (YAML)

All settings can be configured via honeypot.yaml:

server:
  host: 0.0.0.0
  port: 2222

rate_limit:
  max_connections: 10
  window: 60
  ban_duration: 300

alerts:
  enabled: true
  slack_webhook: "https://hooks.slack.com/services/..."
  discord_webhook: "https://discord.com/api/webhooks/..."
  min_severity: medium

See the full honeypot.yaml file for all options.

πŸ“Š Log Files

attacks.log (Human-readable)

2026-06-24 14:30:22,123 - IP: 192.168.1.100 | Username: root | Password: password123 | Method: password | MITRE: T1110:Brute Force
2026-06-24 14:30:45,678 - Activity | IP: 10.0.0.5 | command: whoami

attacks.json (Structured β€” SIEM/ML ready)

[
  {
    "event": "auth_attempt",
    "timestamp": "2026-06-24T14:30:22.123456",
    "ip": "192.168.1.100",
    "username": "root",
    "password": "password123",
    "method": "password",
    "mitre": "T1110:Brute Force"
  }
]

SQLite Database

Query attack data directly:

sqlite3 logs/honeypot.db "SELECT ip, username, password FROM auth_attempts ORDER BY timestamp DESC LIMIT 10;"

🎯 MITRE ATT&CK Coverage

Technique ID Detected By
Brute Force T1110 Password auth attempts
Account Manipulation T1098 SSH key auth attempts
Command & Scripting T1059 Shell command execution
Network Discovery T1046 Recon commands (nmap, etc.)
Remote Services T1021 Lateral movement commands
Privilege Escalation T1068 sudo/chown commands
Defense Evasion T1562 rm -rf, shutdown, etc.
Data Collection T1005 tar, zip, find commands

🏷️ Topics & Tags

honeypot Β· ssh Β· cybersecurity Β· threat-intelligence Β· deception Β· security-tools Β· mitre-attack Β· honeypot-ssh Β· intrusion-detection Β· network-security

πŸ”’ Security Notice

This tool is for authorized security research and education only.

  • Deploy only on networks you own or have permission to monitor
  • Comply with all applicable laws
  • The author assumes no liability for misuse

πŸ“„ License

MIT License β€” see LICENSE

πŸ™ Acknowledgments

About

AI-powered SSH honeypot - Ollama threat analysis, MITRE ATT&CK mapping, real-time dashboards for threat intelligence collection

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages