Systemsicherheit/Assignment 5 - Software Security - Teil 1/shellcode/exploit
2024-06-08 18:19:10 +02:00

16 lines
527 B
Bash
Executable file

#!/bin/bash
# assemble shellcode
nasm -felf32 shellcode.asm -o x.o && ld -m elf_i386 x.o -o shellcode &> /dev/null
# remove object file
rm x.o
# extract shellcode and remove binary
shellcode=$(for byte in $(objdump -d ./shellcode | grep "^ " | cut -f2); do echo -n '\x'$byte; done)
rm shellcode
# TODO place shellcode into test_shellcode.c and shellcode.asm
# compile test_shellcode.c and execute it afterwards
gcc -o test_shellcode -m32 -fno-stack-protector -fno-pie -z execstack -O0 test_shellcode.c && ./test_shellcode