Update osx templates makefile and compile binaries

This commit is contained in:
adfoster-r7
2023-08-02 01:26:18 +01:00
parent c028d33cae
commit 89cd524acb
7 changed files with 25 additions and 4 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
// Compile: clang stage_mettle.s
// Shellcode: objdump -d a.out | cut -d ' ' -f 2-5 | grep -Ev ':|o|^$' | rev | awk '{print "0x"$1$2$3$4","}'
// Shellcode: objdump -d a.out | cut -d ' ' -f 2-5 | cut -d ' ' -f 2- | ruby tools/payloads/format_aarch64.rb
.equ SYS_RECVFROM, 0x200001d
.equ SYS_MPROTECT, 0x200004a
.equ SYS_MMAP, 0x20000c5
@@ -72,7 +72,7 @@ _main:
ldr x10, [x10]
mov x12, x11
mov x15, x0
/* make stack space */
/* mmap(addr=0, length=0x40000, prot=3 (PROT_READ | PROT_WRITE), flags=0x1002 (MAP_PRIVATE | MAP_ANON), fd=0, offset=0) */
mov x0, xzr
@@ -0,0 +1,4 @@
x64_osx_stage
x64_osx_stage_debug
aarch64_osx_stage
aarch64_osx_stage_debug
@@ -0,0 +1 @@
template_aarch64_darwin
+18 -2
View File
@@ -1,4 +1,20 @@
.PHONY: templates
CFLAGS=-fno-stack-protector -fomit-frame-pointer -fno-exceptions -fPIC -Os -O0
GCC_BIN_OSX=`xcrun --sdk macosx -f gcc`
GCC_BASE_OSX=$(GCC_BIN_OSX) $(CFLAGS)
GCC_OSX_X64=$(GCC_BASE_OSX) -arch x86_64
GCC_OSX_AARCH64=$(GCC_BASE_OSX) -arch arm64
all: templates
template_aarch64_darwin: template_aarch64_darwin.c
$(GCC_OSX_AARCH64) -o $@ $^
strip $@
templates: template_aarch64_darwin
strip $^
cp $^ ../../../../../data/$@/$^.bin
install: templates
cp template_aarch64_darwin ../../../../../data/templates/template_aarch64_darwin.bin
clean:
rm -f template_aarch64_darwin