summaryrefslogtreecommitdiffstats
path: root/templates/shellcode/Makefile
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-01-15 10:20:14 -0500
committerMalfurious <m@lfurio.us>2023-01-15 10:20:14 -0500
commit593d6ede20e054279f3bcd7c52bffa05b1eeae04 (patch)
tree53aef3ba981f0d77a7ca9b2f2665557d0f578ee7 /templates/shellcode/Makefile
parentefcde85490e1ef9fccc2048a919898588b97de00 (diff)
parent8037b8c5acaeeeff32d6de01c06132a4f5e432bf (diff)
downloadlib-des-gnux-593d6ede20e054279f3bcd7c52bffa05b1eeae04.tar.gz
lib-des-gnux-593d6ede20e054279f3bcd7c52bffa05b1eeae04.zip
Merge branch 'shellcoding-enhancements'
Adds a reverse shell and other improvements for correctness, along with a general cleanup of the files. * shellcoding-enhancements: Ignore shellcode working files shellcode: Add sample for connecting a TCP socket shellcode: Update /bin/sh shellcodes shellcode: Remove shelltool shellcode: Update Makefile shellcode: Move example code to a new directory shellcode: Drop SYS_EXIT samples
Diffstat (limited to 'templates/shellcode/Makefile')
-rw-r--r--templates/shellcode/Makefile38
1 files changed, 26 insertions, 12 deletions
diff --git a/templates/shellcode/Makefile b/templates/shellcode/Makefile
index 2e67adc..757878f 100644
--- a/templates/shellcode/Makefile
+++ b/templates/shellcode/Makefile
@@ -1,17 +1,31 @@
-.PHONY: all
+LDFLAGS?=
+FORMAT?=elf64
+CODE?=examples/shell64.asm
+GREP=00|0a
-all: shell32.elf shell64.elf
- @objdump -d shell32.elf | ./shelltool.py
- @objdump -d shell64.elf | ./shelltool.py
+.PHONY: all elf disas
-shell32.o: shell32.asm
- nasm -f elf shell32.asm -o shell32.o
+# Format bytecode as an escaped string, highlight bad bytes
+all: code.bin
+ @xxd -i -c 16 <code.bin \
+ | sed 's/,//g;s/ 0/\\/g;s/^ */"/g;s/$$/"/g' \
+ | grep --color=always -E '$(GREP)|$$'
-shell32.elf: shell32.o
- ld -melf_i386 shell32.o -o shell32.elf
+elf: code.o
+ ld $(LDFLAGS) code.o -o code.elf
-shell64.o: shell64.asm
- nasm -f elf64 shell64.asm -o shell64.o
+disas: code.o
+ @objdump -d code.o \
+ | grep --color=always -E '$(GREP)|$$'
-shell64.elf: shell64.o
- ld shell64.o -o shell64.elf
+code.bin: code.o
+ objcopy -O binary code.o code.bin
+
+code.o: code.asm
+ nasm -f '$(FORMAT)' code.asm -o code.o
+
+code.asm:
+ cp '$(CODE)' code.asm
+
+
+# -melf_i386