-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (26 loc) · 1.21 KB
/
Makefile
File metadata and controls
31 lines (26 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
CC=gcc
W32CC=i686-w64-mingw32-g++
W64CC=x86_64-w64-mingw32-g++
CFLAGS=-std=c++11 -I. -Wall -Werror -masm=intel
LDFLAGS=-static-libstdc++ -static-libgcc -lpthread -static -pipe -lwininet
all: _samples debug shellcodes
_samples:
$(W32CC) samples/hello.cpp -o build/hello32.dll $(CFLAGS) $(LDFLAGS) -shared
$(W64CC) samples/hello.cpp -o build/hello64.dll $(CFLAGS) $(LDFLAGS) -shared
debug:
$(W32CC) src/LoadLibrary.cpp -o build/debug32.exe $(CFLAGS) $(LDFLAGS) -DDEBUG
$(W64CC) src/LoadLibrary.cpp -o build/debug64.exe $(CFLAGS) $(LDFLAGS) -DDEBUG
shellcodes:
$(W64CC) src/LoadLibrary.cpp -c -o build/LoadLibrary.o $(CFLAGS) -fno-asynchronous-unwind-tables
./deps/objconv/objconv -fnasm build/LoadLibrary.o
@sed -i '1,/^.text/d' build/LoadLibrary.asm
@sed -ni '1,/^SECTION .data/p' build/LoadLibrary.asm
@sed -i 's/^SECTION .data.*//' build/LoadLibrary.asm
@sed -i '1 i\jmp payload' build/LoadLibrary.asm
@sed -i '1 i\[bits 64]' build/LoadLibrary.asm
@sed -i 's/call memcpy /call mymemcpy/g' build/LoadLibrary.asm
nasm -fbin -o build/LoadLibrary.bin build/LoadLibrary.asm
xxd -i build/LoadLibrary.bin > build/LoadLibrary.h
sed -i 's/build_LoadLibrary_bin/LoadLibrary/g' build/LoadLibrary.h
clean:
rm -rf build/*