diff options
author | toni <matzeton@googlemail.com> | 2014-11-04 08:49:25 +0100 |
---|---|---|
committer | toni <matzeton@googlemail.com> | 2014-11-04 08:49:25 +0100 |
commit | e1ee35ad724a62d7e4d1d7a4499f81759a36f9c4 (patch) | |
tree | 6d9f2af29be871c15c9225d11faba12f28171232 /shellcode | |
parent | a76cb7ea291fb1ee5c74fd9bc76ab71630fa625a (diff) |
- shellcode testing unit
- hello_world asm example
Diffstat (limited to 'shellcode')
-rw-r--r-- | shellcode/Makefile | 6 | ||||
-rw-r--r-- | shellcode/hello.asm | 19 |
2 files changed, 24 insertions, 1 deletions
diff --git a/shellcode/Makefile b/shellcode/Makefile index e2b4b69..e7833cd 100644 --- a/shellcode/Makefile +++ b/shellcode/Makefile @@ -1,4 +1,5 @@ RM := rm +ASM := nasm CC := gcc LD := ld OBJCOPY := objcopy @@ -6,7 +7,7 @@ XXD := xxd CFLAGS = -c -Wall -fpic -Os LDFLAGS = SUBDIR ?= . -TARGETS = $(patsubst %.c,%.o,$(wildcard $(SUBDIR)/*.c)) +TARGETS = $(patsubst %.c,%.o,$(wildcard $(SUBDIR)/*.c)) $(patsubst %.asm,%.o,$(wildcard $(SUBDIR)/*.asm)) all: $(TARGETS) @@ -16,6 +17,9 @@ all: $(TARGETS) $(OBJCOPY) -R .note -R .comment -S -O binary $(patsubst %.o,%,$@) $(patsubst %.o,%.bin,$@) $(XXD) -i $(patsubst %.o,%.bin,$@) +%.o : %.asm + $(ASM) -o $@ $< + clean: $(RM) -f $(patsubst %.o,%.map,$(TARGETS)) $(patsubst %.o,%.bin,$(TARGETS)) $(patsubst %.o,%,$(TARGETS)) $(TARGETS) diff --git a/shellcode/hello.asm b/shellcode/hello.asm new file mode 100644 index 0000000..13eaaff --- /dev/null +++ b/shellcode/hello.asm @@ -0,0 +1,19 @@ +BITS 32 + +xor eax,eax +xor ebx,ebx +xor ecx,ecx +xor edx,edx +jmp short string +code: +pop ecx +mov bl,1 +mov dl,12 +mov al,4 +int 0x80 +dec bl +mov al,1 +int 0x80 +string: +call code +db 'Hello World!' |