diff --git a/client/sources/Makefile.linux b/client/sources/Makefile.linux new file mode 100644 index 00000000..06ae72b5 --- /dev/null +++ b/client/sources/Makefile.linux @@ -0,0 +1,86 @@ +CC=cl.exe + +PYTHONPATH=C:\\Python27 +PYTHON=python.exe + +TEMPLATE_OUTPUT_PATH=../../pupy/payload_templates +ifndef ARCH +$(error You must specify an architecture.) +else +ifeq "$(ARCH)" "x64" +CFLAGS:=$(CFLAGS) /DWIN_X64 /D_WIN64 +else +CFLAGS:=$(CFLAGS) /DWIN_X86 +endif +endif +ifdef DEBUG +DEBUG_ADD:=DEBUG +CFLAGS:= $(CFLAGS) /DDEBUG +LINKER_OPTS:= +else +DEBUG_ADD:= +LINKER_OPTS:=/link /subsystem:windows /ENTRY:mainCRTStartup +endif + +PYOBJS=_memimporter.obj MyLoadLibrary.obj Python-dynload.obj pupy_load.obj pupy.obj base_inject.obj +COMMON_OBJS=resources_bootloader_pyc.obj resources_python27_dll.obj MemoryModule.obj resources_library_compressed_string_txt.obj actctx.obj list.obj thread.obj remote_thread.obj LoadLibraryR.obj resources_msvcr90_dll.obj + +all: $(TEMPLATE_OUTPUT_PATH)/pupy$(ARCH).exe $(TEMPLATE_OUTPUT_PATH)/pupy$(ARCH).dll + +resources/library_compressed_string_$(ARCH).txt: gen_library_compressed_string.py resources/library$(ARCH).zip + $(PYTHON) gen_library_compressed_string.py + +resources/library_compressed_string.txt: resources/library_compressed_string_$(ARCH).txt + cp $< $@ + +resources_library_compressed_string_txt.c: gen_resource_header.py resources/library_compressed_string.txt resources/library${ARCH}.zip + $(PYTHON) gen_resource_header.py resources/library_compressed_string.txt + +resources/bootloader.pyc: gen_python_bootloader.py ../../pupy/packages/all/pupyimporter.py ../../pupy/pp.py + $(PYTHON) gen_python_bootloader.py $(DEBUG_ADD) + +resources_bootloader_pyc.c: gen_resource_header.py resources/bootloader.pyc + $(PYTHON) $+ + +resources/python27.dll: resources/python27_$(ARCH).dll + cp $< $@ + +resources_python27_dll.c: gen_resource_header.py resources/python27.dll + $(PYTHON) $+ + +resources/msvcr90.dll: resources/msvcr90_$(ARCH).dll + cp $< $@ + +resources_msvcr90_dll.c: gen_resource_header.py resources/msvcr90.dll + $(PYTHON) $+ + +$(PYOBJS): %.obj: %.c + $(CC) /c $(CFLAGS) /I$(PYTHONPATH)/include $< + +main_exe.obj: main_exe.c + $(CC) /c $(CFLAGS) $< + +%.obj: %.c + $(CC) /c $(CFLAGS) $< + +ReflectiveLoader.obj: ReflectiveLoader.c + $(CC) /c $(CFLAGS) /DREFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN /DREFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR /O2 /Ob1 $< + +$(TEMPLATE_OUTPUT_PATH)/pupy$(ARCH).exe: main_exe.obj $(PYOBJS) $(COMMON_OBJS) + $(CC) $(CFLAGS) $+ /Fe$@ $(LINKER_OPTS) + +$(TEMPLATE_OUTPUT_PATH)/pupy$(ARCH).dll: main_reflective.obj $(PYOBJS) ReflectiveLoader.obj $(COMMON_OBJS) + $(CC) $(CFLAGS) $+ /Fe$@ /LD + +.PHONY: clean + +ifneq "$(QUICK)" "1" +.PHONY: resources/python27.dll resources/msvcr90.dll +endif + +clean: + rm *.obj + rm *.exp + rm pupy$(ARCH).exe + rm pupy$(ARCH).dll + rm resources/bootloader.pyc