|
1 |
| -ASM=nasm |
2 | 1 | STAGERS=stager_sock_bind stager_sock_bind_udp stager_sock_bind_icmp \
|
3 | 2 | stager_egghunt stager_sock_find stager_sock_reverse \
|
4 | 3 | stager_sock_reverse_icmp stager_sock_reverse_udp \
|
5 |
| - stager_sock_reverse_udp_dns |
| 4 | + stager_sock_reverse_udp_dns |
6 | 5 | STAGES=stage_tcp_shell stage_udp_shell
|
7 | 6 | SINGLE=single_adduser single_bind_tcp_shell single_find_tcp_shell \
|
8 | 7 | single_reverse_tcp_shell single_reverse_udp_shell single_exec
|
| 8 | + |
9 | 9 | OBJS=${STAGERS} ${STAGES} ${SINGLE}
|
10 | 10 |
|
11 |
| -include ../../Makefile.incl |
| 11 | +.SUFFIXES: |
| 12 | +.SUFFIXES: .asm .hex .disasm .o |
| 13 | + |
| 14 | +# Tell Make not to delete these intermediate files |
| 15 | +.PRECIOUS: %.hex %.disasm |
| 16 | + |
| 17 | +all: $(SINGLE) $(STAGES) $(STAGERS) |
| 18 | + |
| 19 | +%.o: %.asm %.bin %.hex %.disasm |
| 20 | + @nasm -o $@ -f elf $< |
| 21 | + |
| 22 | +%.bin: %.asm |
| 23 | + @nasm -o $@ -f bin $< |
| 24 | + |
| 25 | +# Replace 00 with \x00. Put quotes at beginning and end of line. Put plus at |
| 26 | +# end of all lines but the last. This ends up outputting an escaped string |
| 27 | +# suitable for use in a Ruby script. |
| 28 | +%.hex: %.bin |
| 29 | + @xxd -c 16 -ps $< | \ |
| 30 | + sed -e 's/\([0123456789abcdef][0123456789abcdef]\)/\\x\1/g' \ |
| 31 | + -e 's/^/"/;s/$$/"/;$$ b;s/$$/+/;' > $@ |
| 32 | + |
| 33 | +%.disasm: %.bin |
| 34 | + @ndisasm -b 32 $< > $@ |
| 35 | + |
| 36 | +$(SINGLE) $(STAGES) $(STAGERS): %: %.o |
| 37 | + @echo "Building $@... (`wc -c $(<:.o=.bin)|awk '{print $$1}'` bytes)" |
| 38 | + @ld -i -m elf_i386 $< -o $@ |
| 39 | + @chmod +x $@ |
12 | 40 |
|
13 |
| -all: |
14 |
| - @for i in ${OBJS}; ${BUILDASM}; done |
15 | 41 |
|
16 | 42 | clean:
|
17 |
| - rm -f *.o *.hex ${OBJS} *.disasm |
| 43 | + rm -f *.bin *.tmp *.o *.hex ${OBJS} *.disasm |
0 commit comments