Skip to content

Commit

Permalink
Update the MinGW builds
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroSteiner committed Apr 27, 2023
1 parent 1c4f2df commit d5a3258
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
mingw:
runs-on: ubuntu-latest
timeout-minutes: 40
name: Meterpreter C Mingw Docker Build
name: Meterpreter MinGW Docker Build
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
4 changes: 4 additions & 0 deletions c/meterpreter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ meterpreter: meterpreter-x86 meterpreter-x64
meterpreter-x86: meterpreter-x86-gen meterpreter-x86-build

meterpreter-x86-gen:
@cmake -S workspace -B workspace/build/mingw-x64-dump-sam -DBUILD_ALL=OFF -DBUILD_PLG_DUMPSAM=ON $(COMMON_GEN_X64)
@cmake -S workspace -B workspace/build/mingw-x86 $(COMMON_GEN_X86)

meterpreter-x86-build:
@cmake --build workspace/build/mingw-x64-dump-sam $(COMMON_BUILD)
@cmake --build workspace/build/mingw-x86 $(COMMON_BUILD)

meterpreter-x86-clean:
Expand Down Expand Up @@ -91,9 +93,11 @@ 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-x64-dump-sam -DBUILD_ALL=OFF -DBUILD_PLG_DUMPSAM=ON $(COMMON_GEN_X64)
@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-x64-dump-sam $(COMMON_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
Expand Down
7 changes: 7 additions & 0 deletions c/meterpreter/workspace/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ option(BUILD_EXT_POWERSHELL "Build the POWERSHELL extension" OFF)
option(BUILD_EXT_PEINJECTOR "Build the PEINJECTOR extension" OFF)
option(BUILD_EXT_BOFLOADER "Build the BOFLOADER extension" OFF)

option(BUILD_PLG_DUMPSAM "Build the DUMPSAM plugin" OFF)

if(BUILD_ALL)
set(BUILD_LIB_JPEG ON)
Expand Down Expand Up @@ -156,6 +157,7 @@ if(BUILD_EXT_STDAPI)
endif()
if(BUILD_EXT_PRIV)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_priv)
set(BUILD_PLG_DUMPSAM ON)
endif()
if(BUILD_EXT_ESPIA)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_espia)
Expand Down Expand Up @@ -185,6 +187,10 @@ if(BUILD_EXT_BOFLOADER)
set(MET_EXTENSIONS ${MET_EXTENSIONS} ext_server_bofloader)
endif()

if(BUILD_PLG_DUMPSAM)
set(MET_PLUGINS ${MET_PLUGINS} dump_sam)
endif()

if(BUILD_EXT_SNIFFER)
if(MSVC)
if(EXISTS "${PSSDK_DIR}")
Expand All @@ -209,6 +215,7 @@ endif()
if(MSVC)
set(
MET_PLUGINS
${MET_PLUGINS}
screenshot
elevator
)
Expand Down
35 changes: 35 additions & 0 deletions c/meterpreter/workspace/dump_sam/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
set(PROJECT_NAME dump_sam)

project(${PROJECT_NAME} C)

include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeListsFuncs.txt)

add_definitions(
-D_USRDLL
)

include_directories(../../source/dump_sam)
include_directories(../../source/ReflectiveDLLInjection/common)
include_directories(../../source/ReflectiveDLLInjection/dll/src)

set(SRC_DIR ../../source/dump_sam)
file(GLOB SRC_FILES
${SRC_DIR}/*.c
${SRC_DIR}/dump_sam.def
)
add_library(${PROJECT_NAME} SHARED ${SRC_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${TARGET_ARCH})
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 rpcrt4)
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
if(MSVC)
target_link_options(${PROJECT_NAME} PUBLIC "/ignore:4070")
endif()

# Post processing (required for all Meterpreter DLLs)
editbin(${PROJECT_NAME} ${BIN_SUBSYSTEM})
copyoutput(${PROJECT_NAME} ${BIN_OUTPUT_DIR})
3 changes: 3 additions & 0 deletions c/meterpreter/workspace/ext_server_priv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ else()
endif()

include_directories(../../source/common)
include_directories(../../source/dump_sam)
include_directories(../../source/ReflectiveDLLInjection/common)
include_directories(../../source/extensions/kiwi/mimikatz/inc)
include_directories(../../source/extensions/kiwi/mimikatz/modules/rpc)
include_directories(../../workspace/ext_server_priv)

set(SRC_DIR ../../source/extensions/priv)
file(GLOB SRC_FILES
${SRC_DIR}/*.c
${SRC_DIR}/*.rc
${MOD_DEF_DIR}/extension.def
../../source/extensions/kiwi/mimikatz/modules/rpc/kull_m_rpc_ms-rprn.c
../../source/extensions/kiwi/mimikatz/modules/rpc/kull_m_rpc_ms-efsr_c.c
Expand Down

0 comments on commit d5a3258

Please sign in to comment.