# Chapter 15 Lab Makefile
# Usage:
#   make up          - Start all lab services
#   make down        - Stop and remove containers + volumes
#   make tools       - Drop into the forensic-tools shell (Lab 15.2, 15.4)
#   make network     - Drop into the network-tools shell (Lab 15.5)
#   make pcap        - Generate the synthetic PCAP corpus
#   make lab-container - Build and start the compromised container (Lab 15.6b)
#   make clean       - Remove generated files

COMPOSE = docker compose -f docker-compose.yml

.PHONY: up down tools network pcap lab-container clean

up:
	$(COMPOSE) up -d
	@echo "Services started. Jupyter: http://localhost:8888 (token: labtoken)"

down:
	$(COMPOSE) down -v

tools:
	$(COMPOSE) run --rm forensic-tools bash

network:
	$(COMPOSE) run --rm network-tools bash

jupyter:
	@echo "Jupyter already running at http://localhost:8888 (token: labtoken)"
	@echo "If not started: make up"

pcap:
	python3 seed/pcap/generate_corpus.py

lab-container:
	docker build -t ch15-lab-target:case01 seed/container-image/
	@echo "Image built. Run: docker run -d --name ch15-lab-target ch15-lab-target:case01"
	@echo "Then: docker diff ch15-lab-target"
	@echo "Then: docker commit ch15-lab-target incident-evidence:case01"

clean:
	rm -f seed/pcap/corpus.pcap
	rm -rf reports/*
