How 0x4d31/galah works
Project Type and Purpose
• Galah is a backend service (written in Go) that acts as an LLM-powered web honeypot.
• It exposes an HTTP interface, dynamically generates responses to arbitrary HTTP requests using various LLM providers, applies optional Suricata rule matching, caches responses, and logs events.
File Structure Analysis
• cmd/galah: CLI entry point (main.go).
• internal/: core service implementation
• internal/server: HTTP server setup
• internal/app: application orchestration (wiring CLI flags → config → service)
• internal/config: config loader (YAML) and rule loader
• internal/cache: response cache (SQLite or file DB)
• internal/logger: event logger, session context
• pkg/: external integrations
• pkg/llm: adapters for LLM providers (OpenAI, GoogleAI, Anthropic, Cohere, Ollama, etc.)
• pkg/enrich: post-processing/middleware for HTTP responses
• pkg/suricata: Suricata rule engine support
• config/: YAML templates for prompts and Suricata rules
• data/: sample event logs
• templates/: JSON response templates
• deploy/: Docker/Kubernetes manifests
• docs/: architecture and usage examples
Key Architecture Points from README
• HTTP server receives arbitrary requests on configurable ports
• Requests optionally go through Suricata rule inspection
• Response flow:
a) Check cache → if hit, return cached HTTP response
b) If miss, invoke LLM adapter → generate HTTP headers & body in JSON
c) Store in cache (per-port, configurable TTL)
d) Log full event (request + response + metadata + Suricata matches)
• Supports multiple LLM providers via the pkg/llm package
• Exposed as CLI or embedded as a Go library