-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (37 loc) · 1.25 KB
/
Makefile
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
.PHONY: install
BASE_DIR = $(CURDIR)
CC := gcc
OUTPUT_DIR ?= $(BASE_DIR)/binaries
CFLAGS = -O0 -g
EXECSTACK_FLAGS = -z execstack
LAZY_FLAGS = -z lazy
NOCANARY_FLAGS = -fno-stack-protector
NOPIE_FLAGS = -no-pie
NORELRO_FLAGS = -z norelro
BINARIES = aslr stack-canary simple-bo-exec simple-bo-ret simple-bo-rop simple-bo-rop-lazynopie simple-bo-var
SUID_BINARIES = simple-bo-exec simple-bo-ret simple-bo-rop simple-bo-rop-lazynopie
all: $(BINARIES)
aslr: aslr.c
$(CC) $(CFLAGS) $< -o $@
stack-canary: stack-canary.c
$(CC) $(CFLAGS) $< -o $@
simple-bo-exec: simple-bo-exec.c
$(CC) $(CFLAGS) $(NOCANARY_FLAGS) $(EXECSTACK_FLAGS) $< -o $@
simple-bo-ret: simple-bo-ret.c
$(CC) $(CFLAGS) $(NOCANARY_FLAGS) $(NOPIE_FLAGS) $< -o $@
simple-bo-rop: simple-bo-rop.c
$(CC) $(CFLAGS) $(NOCANARY_FLAGS) $< -o $@
simple-bo-var: simple-bo-var.c
$(CC) $(CFLAGS) $< -o $@
simple-bo-rop-lazynopie: simple-bo-rop-lazynopie.c
$(CC) $(CFLAGS) $(NOCANARY_FLAGS) $(LAZY_FLAGS) $(NOPIE_FLAGS) $< -o $@
clean:
rm -rf $(OUTPUT_DIR) $(BINARIES)
install: all
-mkdir $(OUTPUT_DIR)
for binary in $(BINARIES) ; do \
install -m 0755 $${binary} $(OUTPUT_DIR) ; \
done
for sbinary in $(BINARIES) ; do \
sudo install -m 4755 -o root $${sbinary} $(OUTPUT_DIR)/$${sbinary}-setuid ; \
done