-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
130 lines (110 loc) · 3.7 KB
/
Makefile
File metadata and controls
130 lines (110 loc) · 3.7 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
.PHONY: build run clean install test fmt vet deps generate-config docker-build docker-run
# Binary name
BINARY_NAME=breadcrumb-pot
DOCKER_IMAGE=breadcrumb-pot:latest
# Build the binary
build:
@echo "Building $(BINARY_NAME)..."
@go build -o $(BINARY_NAME) cmd/breadcrumb-pot/main.go
@echo "Build complete: ./$(BINARY_NAME)"
# Build for multiple platforms
build-all:
@echo "Building for multiple platforms..."
@GOOS=linux GOARCH=amd64 go build -o $(BINARY_NAME)-linux-amd64 cmd/breadcrumb-pot/main.go
@GOOS=darwin GOARCH=amd64 go build -o $(BINARY_NAME)-darwin-amd64 cmd/breadcrumb-pot/main.go
@GOOS=windows GOARCH=amd64 go build -o $(BINARY_NAME)-windows-amd64.exe cmd/breadcrumb-pot/main.go
@echo "Multi-platform build complete"
# Install dependencies
deps:
@echo "Installing dependencies..."
@go mod download
@go mod tidy
# Run the honeypot
run: build
@echo "Running $(BINARY_NAME)..."
@./$(BINARY_NAME) -config config.yaml
# Run with sudo for privileged ports
run-sudo: build
@echo "Running $(BINARY_NAME) with sudo..."
@sudo ./$(BINARY_NAME) -config config.yaml
# Generate default configuration
generate-config: build
@echo "Generating default configuration..."
@./$(BINARY_NAME) -generate-config
@echo "Configuration generated: config.yaml"
# Install the binary to /usr/local/bin
install: build
@echo "Installing $(BINARY_NAME) to /usr/local/bin..."
@sudo cp $(BINARY_NAME) /usr/local/bin/
@echo "Installed successfully"
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
@rm -f $(BINARY_NAME)
@rm -f $(BINARY_NAME)-*
@rm -rf logs/
@echo "Clean complete"
# Run tests
test:
@echo "Running tests..."
@go test -v ./...
# Run tests with coverage
test-coverage:
@echo "Running tests with coverage..."
@go test -v -coverprofile=coverage.out ./...
@go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report: coverage.html"
# Format code
fmt:
@echo "Formatting code..."
@go fmt ./...
# Run go vet
vet:
@echo "Running go vet..."
@go vet ./...
# Run linter (requires golangci-lint)
lint:
@echo "Running linter..."
@golangci-lint run
# Create necessary directories
setup:
@echo "Setting up directories..."
@mkdir -p templates logs
@echo "Setup complete"
# Download official Nuclei templates
setup-nuclei:
@echo "Setting up Nuclei templates..."
@./scripts/setup-templates.sh
@echo "Update config.yaml to use: nuclei-templates/http"
# Build Docker image
docker-build:
@echo "Building Docker image..."
@docker build -t $(DOCKER_IMAGE) .
@echo "Docker image built: $(DOCKER_IMAGE)"
# Run Docker container
docker-run:
@echo "Running Docker container..."
@docker run -p 8080:8080 -p 53:53/udp -v $(PWD)/templates:/app/templates -v $(PWD)/logs:/app/logs $(DOCKER_IMAGE)
# Help
help:
@echo "Available targets:"
@echo " build - Build the binary"
@echo " build-all - Build for multiple platforms"
@echo " deps - Install dependencies"
@echo " run - Build and run the honeypot"
@echo " run-sudo - Build and run with sudo (for privileged ports)"
@echo " generate-config - Generate default config.yaml"
@echo " install - Install binary to /usr/local/bin"
@echo " clean - Remove build artifacts"
@echo " test - Run tests"
@echo " test-coverage - Run tests with coverage report"
@echo " fmt - Format code"
@echo " vet - Run go vet"
@echo " lint - Run linter"
@echo " setup - Create necessary directories"
@echo " setup-nuclei - Download official Nuclei templates"
@echo " docker-build - Build Docker image"
@echo " docker-run - Run Docker container"
@echo " help - Show this help message"
# Default target
.DEFAULT_GOAL := help