First part of TD5
This commit is contained in:
parent
eceb4717df
commit
33f23e8538
9 changed files with 204 additions and 0 deletions
|
@ -0,0 +1,35 @@
|
|||
CC = gcc
|
||||
CFLAGS = -Wall -Wextra -O0 -no-pie -lm -g -std=c99 -zexecstack
|
||||
SRC = $(wildcard *.c)
|
||||
TGT = $(subst .c,,$(SRC))
|
||||
BUILD_DIR = build
|
||||
DUMP_DIR = dump
|
||||
|
||||
|
||||
pframe:
|
||||
curl -o pframe.tgz https://dept-info.labri.fr/~thibault/SecuLog/pframe.tgz && \
|
||||
tar -xf pframe.tgz &&\
|
||||
rm -rf pframe.tgz
|
||||
|
||||
.gdbinit:
|
||||
|
||||
configure: pframe .gdbinit
|
||||
$(shell echo "python import pframe" > .gdbinit)
|
||||
|
||||
$(BUILD_DIR)/%: %.c
|
||||
$(shell mkdir -p $(BUILD_DIR))
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
build: $(addprefix $(BUILD_DIR)/, $(TGT)))
|
||||
|
||||
|
||||
PHONY: gdb
|
||||
gdb: build/exploit build/anodin configure
|
||||
./$(BUILD_DIR)/exploit > hack.txt &
|
||||
PYTHONPATH=${PWD}/pframe${PYTHONPATH:+:${PYTHONPATH}} \
|
||||
setarch -R gdb ./$(BUILD_DIR)/anodin --command=$(subst gdb_,,$@).gdb
|
||||
rm hack.txt
|
||||
|
||||
PHONY: clean
|
||||
clean:
|
||||
@rm -rf $(BUILD_DIR) pframe .gdbinit
|
Loading…
Add table
Add a link
Reference in a new issue