Created
October 18, 2012 18:13
-
-
Save maxdeliso/3913861 to your computer and use it in GitHub Desktop.
snequeil
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.exports | |
.o | |
snequeil | |
.swp | |
*~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: clean | |
LD=ld | |
ASM=nasm | |
RM=rm | |
OUT=snequeil | |
SRC=$(OUT).asm | |
OBJ=$(OUT).o | |
THIS=makefile | |
LDFLAGS=-e snequeil -macosx_version_min 10.7 -pie -allow_stack_execute -bind_at_load | |
AFLAGS=-fmacho64 | |
RMFLAGS=-f | |
DEPS=/usr/lib/libSystem.dylib | |
snequeil: $(OBJ) $(THIS) | |
@$(LD) $(LDFLAGS) $(DEPS) -o $(OUT) $(OBJ) | |
@echo Linked | |
@size $(OUT) | |
snequeil.o: $(SRC) $(THIS) | |
@$(ASM) $(AFLAGS) -o $(OBJ) $(SRC) | |
@echo Assembled | |
@size $(OBJ) | |
clean: | |
@$(RM) $(RMFLAGS) $(OBJ) $(OUT) | |
table: libSystem.dylib.exports | |
@dyldinfo -arch x86_64 -export /usr/lib/libSystem.dylib > libSystem.dylib.exports |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global snequeil | |
section .text | |
snequeil: | |
mov rbp, rsp ; overwrite rbp, (it's 0) | |
sub rsp, 0x8 ; alloc space on main stack frame | |
; TODO | |
add rsp, 0x8 ; clean main stack frame | |
mov rax, 0x2000001 ; exit | |
xor rdi, rdi ; return 0 | |
syscall ; poke |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment