-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (71 loc) · 3.29 KB
/
Copy pathMakefile
File metadata and controls
88 lines (71 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Makefile for stooge - network traffic replayer
# All builds run in Docker containers to ensure consistent environment
.PHONY: all build run run-text run-quick live test clean deploy format install kill release
IMAGE := deanturpin/stooge
# Default target: build and run with sample PCAP
all: build run
# Auto-format C++ source files using clang-format
format:
clang-format -i src/*.cxx src/*.hxx
# Build Docker image
build:
git log --oneline --decorate -5 > recent-commits.txt 2>/dev/null || echo "No git history available" > recent-commits.txt
# docker build --no-cache -t $(IMAGE) .
docker build -t $(IMAGE) .
# Build Docker image
build-clean:
git log --oneline --decorate -5 > recent-commits.txt 2>/dev/null || echo "No git history available" > recent-commits.txt
docker build --no-cache -t $(IMAGE) .
# Run container with sample PCAP file (interactive TUI mode)
run:
docker run --rm -it -v $(PWD):/data $(IMAGE) /data/capture.pcapng
# Run container in text mode (no TTY required)
text:
docker run --rm -v $(PWD):/data --entrypoint /app/stooge $(IMAGE) --no-tui /data/capture.pcapng
# Quick replay test in text mode (3 second timeout for rapid iteration)
quick: build
timeout 100 docker run --rm -v $(PWD):/data --entrypoint /app/stooge $(IMAGE) --no-tui /data/capture.pcapng || true
# Run unit tests (uses builder stage since runtime image doesn't include tests)
test:
docker build --target builder -t $(IMAGE)-builder .
docker run --rm $(IMAGE)-builder /bin/sh -c "cd /app/build && ctest --output-on-failure"
# Run live capture (requires elevated privileges)
live: build
@echo "Starting live capture (requires sudo/elevated privileges)..."
docker run --rm -it --network=host $(IMAGE)
# Run with GDB for debugging crashes (uses builder stage with debug symbols)
gdb:
docker build --target builder -t $(IMAGE)-builder .
@echo "Starting GDB debugging session..."
docker run --rm -it --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
-v $(PWD):/data --entrypoint /bin/bash $(IMAGE)-builder \
-c "apt-get update && apt-get install -y gdb && gdb -ex run --args /app/build/stooge /data/capture.pcapng"
# Remove Docker image
clean:
docker rmi $(IMAGE) || true
# Kill all running stooge containers
kill:
@echo "Killing all running stooge containers..."
@docker ps -q --filter ancestor=$(IMAGE) | xargs -r docker kill 2>/dev/null || true
@docker ps -aq --filter ancestor=$(IMAGE) | xargs -r docker rm 2>/dev/null || true
@echo "Done."
# Install Lua dissectors to Wireshark user plugins directory
install:
@echo "Installing Lua dissectors to Wireshark plugins directory..."
@mkdir -p ~/.local/lib/wireshark/plugins
@cp -v dissectors/*.lua ~/.local/lib/wireshark/plugins/
@echo "Dissectors installed successfully!"
@echo "Restart Wireshark or verify with: Help → About Wireshark → Plugins"
# Commit all changes and push to remote
deploy:
git add -A && git commit -m "Auto-commit from make deploy 🤖" && git push
# Release management: rebase release branch from main and push
# This updates the stable release branch with latest changes from main
release:
@echo "📦 Updating release branch from main..."
@git switch release
@git rebase main
@git push --force-with-lease
@git switch main
@echo "✅ Release branch updated and pushed!"
@echo "🐳 Docker Hub will automatically build from release branch"