-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
94 lines (76 loc) · 3.29 KB
/
Makefile
File metadata and controls
94 lines (76 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
89
90
91
92
93
94
# ============================================================
# ultra_scanner — Makefile
# Target: Linux x86_64 (requires root for raw sockets)
# Build: make
# Build with PF_RING ZC: make USE_PFRING_ZC=1
# ============================================================
CC := gcc
TARGET := ultra_scanner
# ── Source files (order doesn't matter; all compiled separately) ──
SRCS := \
blackrock.c \
ranges.c \
honeypot.c \
queue.c \
net.c \
sender.c \
receiver.c \
telnet.c \
exploits.c \
output.c \
stats.c \
main.c
OBJS := $(SRCS:.c=.o)
# ── Base flags ────────────────────────────────────────────────
CFLAGS := -O2 -std=c11 -Wall -Wextra -Wno-unused-parameter \
-D_GNU_SOURCE -D_DEFAULT_SOURCE \
-march=native -pipe
LDFLAGS := -lpthread -lm
# ── Optional: PF_RING ZC ──────────────────────────────────────
# Usage: make USE_PFRING_ZC=1 PFRING_DIR=/opt/pfring
ifdef USE_PFRING_ZC
PFRING_DIR ?= /opt/pfring
CFLAGS += -DUSE_PFRING_ZC -I$(PFRING_DIR)/include
LDFLAGS += -L$(PFRING_DIR)/lib -lpfring -lnuma
endif
# ── Debug build: make DEBUG=1 ─────────────────────────────────
ifdef DEBUG
CFLAGS += -O0 -g3 -fsanitize=address,undefined
LDFLAGS += -fsanitize=address,undefined
endif
# ── Static build: make STATIC=1 ──────────────────────────────
ifdef STATIC
LDFLAGS += -static
endif
# ─────────────────────────────────────────────────────────────
.PHONY: all clean install strip
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
@echo "[+] Built: $@"
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
# ── Convenience targets ───────────────────────────────────────
strip: $(TARGET)
strip --strip-all $(TARGET)
@echo "[+] Stripped: $(TARGET)"
install: $(TARGET)
install -m 755 $(TARGET) /usr/local/bin/$(TARGET)
@echo "[+] Installed to /usr/local/bin/$(TARGET)"
clean:
rm -f $(OBJS) $(TARGET)
@echo "[+] Clean"
# ── Header dependencies (manual, avoids makedepend overhead) ──
blackrock.o : blackrock.c blackrock.h config.h
ranges.o : ranges.c ranges.h config.h
honeypot.o : honeypot.c honeypot.h config.h
queue.o : queue.c queue.h config.h
net.o : net.c net.h config.h
sender.o : sender.c sender.h config.h net.h blackrock.h ranges.h honeypot.h queue.h
receiver.o : receiver.c receiver.h config.h net.h honeypot.h ranges.h queue.h
telnet.o : telnet.c telnet.h config.h net.h honeypot.h
exploits.o : exploits.c exploits.h config.h net.h output.h
output.o : output.c output.h config.h
stats.o : stats.c stats.h config.h
main.o : main.c config.h blackrock.h ranges.h honeypot.h queue.h net.h \
sender.h receiver.h telnet.h exploits.h output.h stats.h