Files
derp/Makefile
user 23b4d6f2a4 feat: add wave 3 local database plugins
GeoIP and ASN lookup via MaxMind GeoLite2 mmdb, Tor exit node check
against local bulk exit list, IP reputation via Firehol/ET blocklist
feeds, and CVE lookup against local NVD JSON mirror.

Includes cron-friendly update script (scripts/update-data.sh) for all
data sources and make update-data target. GeoLite2 requires a free
MaxMind license key; all other sources are freely downloadable.

Plugins: geoip, asn, torcheck, iprep, cve
Commands: !geoip, !asn, !tor, !iprep, !cve

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:38:13 +01:00

68 lines
1.7 KiB
Makefile

.PHONY: install dev test lint clean help build container-run container-stop container-logs update-data up down logs
APP_NAME := derp
VENV := .venv
PIP := $(VENV)/bin/pip
PYTHON := $(VENV)/bin/python
PYTEST := $(VENV)/bin/pytest
RUFF := $(VENV)/bin/ruff
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[38;5;110m%-12s\033[0m %s\n", $$1, $$2}'
venv: ## Create virtual environment
python3 -m venv $(VENV)
$(PIP) install --upgrade pip
install: venv ## Install package (editable)
$(PIP) install -e .
$(PIP) install pytest ruff
test: ## Run tests
$(PYTEST) -v
lint: ## Run linter
$(RUFF) check src/ tests/ plugins/
fmt: ## Format code
$(RUFF) format src/ tests/ plugins/
run: ## Run the bot
$(PYTHON) -m derp
clean: ## Remove build artifacts
rm -rf build/ dist/ *.egg-info src/*.egg-info
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
link: install ## Symlink to ~/.local/bin
ln -sf $$(pwd)/$(VENV)/bin/derp ~/.local/bin/derp
@echo "Installed: $$(which derp)"
build: ## Build container image
podman build -t $(APP_NAME) .
container-run: ## Run bot in container (mount config + plugins)
podman run -d --name $(APP_NAME) \
-v ./config/derp.toml:/app/config/derp.toml:ro,Z \
-v ./plugins:/app/plugins:ro,Z \
$(APP_NAME)
container-stop: ## Stop and remove container
podman stop $(APP_NAME) && podman rm $(APP_NAME)
container-logs: ## Follow container logs
podman logs -f $(APP_NAME)
update-data: ## Download/refresh local data files
./scripts/update-data.sh
up: ## Start with podman-compose (build + detach)
podman-compose up -d --build
down: ## Stop with podman-compose
podman-compose down
logs: ## Follow compose logs
podman-compose logs -f