Assignment-5 #2

Merged
saschato merged 18 commits from Assignment-5 into master 2024-06-10 14:32:32 +02:00
3 changed files with 36 additions and 0 deletions
Showing only changes of commit 055c31519e - Show all commits

View file

@ -0,0 +1,12 @@
.DEFAULT_GOAL := all
shellcode: shellcode.asm
nasm -felf32 shellcode.asm -o shellcode.o
ld -m elf_i386 shellcode.o -o shellcode
rm shellcode.o
test: test_shellcode.c
gcc -o test_shellcode -m32 -fno-stack-protector -z execstack -fno-pie -O0 test_shellcode.c
all: shellcode test

View file

@ -0,0 +1,8 @@
; SHELLCODE: "\x90\x90\x90..."
global _start
_start:
;----------------------------------
nop; <YOUR CODE HERE>
; ------------ End of file ------------

View file

@ -0,0 +1,16 @@
#include <stdio.h>
#include <string.h>
// gcc -o test_shellcode -m32 -fno-stack-protector -fno-pie -z execstack -O0 test_shellcode.c
// Your shellcode goes here
char *shellcode = "\x90\x90\x90...";
// ------------------------
int main()
{
// Print length of shellcode
fprintf(stdout,"Length: %d\n",strlen(shellcode));
// Execute shellcode
(*(void (*)()) shellcode)();
}