[Assignment-5] added solution task 3 (shellcode)
This commit is contained in:
parent
055c31519e
commit
6648789260
2 changed files with 37 additions and 5 deletions
16
Assignment 5 - Software Security - Teil 1/shellcode/exploit
Executable file
16
Assignment 5 - Software Security - Teil 1/shellcode/exploit
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/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
|
||||
Loading…
Add table
Add a link
Reference in a new issue