diff options
Diffstat (limited to 'shellcode')
-rw-r--r-- | shellcode/Makefile | 20 | ||||
-rw-r--r-- | shellcode/simple.c | 11 | ||||
-rw-r--r-- | shellcode/simple2.c | 9 |
3 files changed, 40 insertions, 0 deletions
diff --git a/shellcode/Makefile b/shellcode/Makefile new file mode 100644 index 0000000..c35111d --- /dev/null +++ b/shellcode/Makefile @@ -0,0 +1,20 @@ +RM := rm +CC := gcc +LD := ld +OBJCOPY := objcopy +CFLAGS = -c -Wall -fpic -Os +LDFLAGS = +SUBDIR ?= . +TARGETS = $(patsubst %.c,%.o,$(wildcard $(SUBDIR)/*.c)) + +all: $(TARGETS) + +%.o : %.c + $(CC) $(CFLAGS) -o $@ $< + $(LD) $(LDFLAGS) -N -Ttext 0x0 -e _start -Map $(patsubst %.o,%.map,$@) $@ -o $(patsubst %.o,%,$@) + $(OBJCOPY) -R .note -R .comment -S -O binary $(patsubst %.o,%,$@) $(patsubst %.o,%.bin,$@) + +clean: + $(RM) -f $(patsubst %.o,%.map,$(TARGETS)) $(patsubst %.o,%.bin,$(TARGETS)) $(patsubst %.o,%,$(TARGETS)) $(TARGETS) + +.PHONY: all clean diff --git a/shellcode/simple.c b/shellcode/simple.c new file mode 100644 index 0000000..bf2bf43 --- /dev/null +++ b/shellcode/simple.c @@ -0,0 +1,11 @@ +/* + * gcc -c -Wall -fpic -Os shellcode.c -o shellcode.o + * ld -N -Ttext 0x0 -e _start -Map shellcode.map shellcode.o -o shellcode + * objcopy -R .note -R .comment -S -O binary shellcode shellcode.bin + */ + +int _start(void) { + while (1) { + } + return (0); +} diff --git a/shellcode/simple2.c b/shellcode/simple2.c new file mode 100644 index 0000000..341b2de --- /dev/null +++ b/shellcode/simple2.c @@ -0,0 +1,9 @@ +#include <stdio.h> +#include <stdlib.h> + +int _start(void) { + while (1) { + //printf("Shellcode!\n"); + } + return (0); +} |