From 1a2a06f831f972e6464e17ccf02464d671d54dd9 Mon Sep 17 00:00:00 2001 From: Spencer McIntyre Date: Thu, 18 Sep 2025 17:27:10 -0400 Subject: [PATCH 1/2] Remove references to Visual Studio < 2019 --- c/meterpreter/README.md | 32 +---- c/meterpreter/make-cmake.bat | 120 ------------------ c/meterpreter/make.bat | 25 ++-- .../ext_server_sniffer/CMakeLists.txt | 6 +- c/meterpreter/workspace/meterpreter.props | 10 +- 5 files changed, 13 insertions(+), 180 deletions(-) delete mode 100644 c/meterpreter/make-cmake.bat diff --git a/c/meterpreter/README.md b/c/meterpreter/README.md index 6f5527602..525cb1397 100644 --- a/c/meterpreter/README.md +++ b/c/meterpreter/README.md @@ -40,36 +40,6 @@ If you don't have an installation ready, follow these steps: choco install visualstudio2019community -y --package-parameters "--config C:\YOUR_PATH\metasploit-payloads\c\meterpreter\vs-configs\vs2019.vsconfig" ``` -### VS 2017 -Building with VS2017 works with any version, including community. If you have an installation already, just make sure you have the following extra bits installed: - -* Under `Workloads`: - * `Desktop Development with C++` -* Under `Individual Components`: - * `Windows XP support for C++` - -If you don't have an installation ready, follow these steps: - -1. Install [Chocolatey](https://chocolatey.org). -2. Install VS with all the required components by running the following command in Powershell: - ``` -choco install visualstudio2017community -y --package-parameters "--config C:\YOUR_PATH\metasploit-payloads\c\meterpreter\vs-configs\vs2017.vsconfig" - ``` - -Note: A copy of this file is located in this repository under `c/meterpreter/vs-config/vs2017.vsconfig`. - -### VS 2013 -Download and install the `Visual Studio Express 2013 for Windows Desktop` edition. It is important that you use _this exact version_. To do this with Chocolatey, run the following: - -``` -choco install visualstudioexpress2013windowsdesktop -y -``` - -Nothing extra needs to be done. - -At this point the dependencies will be ready to use and Meterpreter should be ready to -build. - ### Running the Build Open up a Visual Studio command prompt by selecting `Developer Command Prompt for VS201X` @@ -84,7 +54,7 @@ meterpreter source is located. From here you can: * Build the x64 version by running: `make x64` * Build both x86 and x64 versions by running: `make` -If you want to build binaries with the `v120_xp` toolset instead of `v141_xp` while using VS2017 or VS2019, you must first install VS2013 as shown above. Then, pass `v120_xp` as a parameter when running `make` (eg. `make v120_xp x64`). The Rapid7 build automation uses v120_xp to build the distributed binaries, so projects must build with that platform toolset. +The Rapid7 build automation uses v141_xp to build the distributed binaries, so projects must build with that platform toolset. The compiled binaries are written to the `output` folder. diff --git a/c/meterpreter/make-cmake.bat b/c/meterpreter/make-cmake.bat deleted file mode 100644 index 95b1923e4..000000000 --- a/c/meterpreter/make-cmake.bat +++ /dev/null @@ -1,120 +0,0 @@ -@ECHO OFF - -IF "%1"=="clean" GOTO CLEAN -IF "%1"=="docs" GOTO DOCS - -IF NOT EXIST "source\ReflectiveDLLInjection\.git" ( - ECHO Meterpreter's submodule dependencies can't be found. - ECHO From your git console, please run: - ECHO git submodule init - ECHO git submodule update - GOTO END -) - -SET VS_TITLE=Visual Studio 17 2022 -SET VS_VER=VS2022 -SET PTS_VER=v141_xp -SET PSSDK_VER=19 -SET BUILD_64=Y -SET BUILD_86=Y -SET SNIFFER=OFF -SET DBGTRACE=OFF -SET DBGTRACE_VERBOSE=OFF -SET DO_BUILD=Y - -IF "%1" == "NOBUILD" SET DO_BUILD=N -IF "%2" == "NOBUILD" SET DO_BUILD=N -IF "%3" == "NOBUILD" SET DO_BUILD=N -IF "%4" == "NOBUILD" SET DO_BUILD=N -IF "%5" == "NOBUILD" SET DO_BUILD=N - -IF "%1" == "v120_xp" SET PTS_VER=%1 -IF "%2" == "v120_xp" SET PTS_VER=%2 -IF "%3" == "v120_xp" SET PTS_VER=%3 -IF "%4" == "v120_xp" SET PTS_VER=%4 -IF "%5" == "v120_xp" SET PTS_VER=%5 - -IF "%1" == "VS2013" SET VS_VER=%1 -IF "%2" == "VS2013" SET VS_VER=%2 -IF "%3" == "VS2013" SET VS_VER=%3 -IF "%4" == "VS2013" SET VS_VER=%4 -IF "%5" == "VS2013" SET VS_VER=%5 - -REM If VS2013 is used, we have to stick to v121_xp -IF "%VS_VER%" == "VS2013" ( - SET VS_TITLE=Visual Studio 12 2013 - SET PTS_VER=v120_xp - SET PSSDK_VER=12 -) - -IF "%1" == "x86" SET BUILD_64=N -IF "%2" == "x86" SET BUILD_64=N -IF "%3" == "x86" SET BUILD_64=N -IF "%4" == "x86" SET BUILD_64=N -IF "%5" == "x86" SET BUILD_64=N - -IF "%1" == "x64" SET BUILD_86=N -IF "%2" == "x64" SET BUILD_86=N -IF "%3" == "x64" SET BUILD_86=N -IF "%4" == "x64" SET BUILD_86=N -IF "%5" == "x64" SET BUILD_86=N - -IF "%1" == "DBGTRACE" SET DBGTRACE=ON -IF "%2" == "DBGTRACE" SET DBGTRACE=ON -IF "%3" == "DBGTRACE" SET DBGTRACE=ON -IF "%4" == "DBGTRACE" SET DBGTRACE=ON -IF "%5" == "DBGTRACE" SET DBGTRACE=ON - -IF "%1" == "DBGTRACE_VERBOSE" SET DBGTRACE_VERBOSE=ON -IF "%2" == "DBGTRACE_VERBOSE" SET DBGTRACE_VERBOSE=ON -IF "%3" == "DBGTRACE_VERBOSE" SET DBGTRACE_VERBOSE=ON -IF "%4" == "DBGTRACE_VERBOSE" SET DBGTRACE_VERBOSE=ON -IF "%5" == "DBGTRACE_VERBOSE" SET DBGTRACE_VERBOSE=ON - -SET TRACE_MSG=%DBGTRACE% -IF "%DBGTRACE_VERBOSE%" == "ON" SET TRACE_MSG=VERBOSE - -IF EXIST "..\..\..\pssdk\PSSDK_VC%PSSDK_VER%_LIB\_Libs\pssdk_vc%PSSDK_VER%_mt.lib" SET SNIFFER=ON - -IF "%BUILD_64%" == "Y" ( - @ECHO ==================================================================================== - @ECHO == Generating "%VS_TITLE%" w/ %PTS_VER% on x64 ^(Trace: %TRACE_MSG%^) - @ECHO ==================================================================================== - cmake -G "%VS_TITLE%" -A x64 -T %PTS_VER% -S workspace -B workspace\build\%VS_VER%_%PTS_VER%\x64 -Wno-dev -DBUILD_SNIFFER=%SNIFFER% -DDBGTRACE=%DBGTRACE% -DDBGTRACE_VERBOSE=%DBGTRACE_VERBOSE% - if "%DO_BUILD%" == "Y" ( - @ECHO ==================================================================================== - @ECHO == Building "%VS_TITLE%" w/ %PTS_VER% on x64 - @ECHO ==================================================================================== - cmake --build workspace\build\%VS_VER%_%PTS_VER%\x64 --config Release --clean-first -- /p:XPDeprecationWarning=false - ) -) - -IF "%BUILD_86%" == "Y" ( - @ECHO ==================================================================================== - @ECHO == Generating "%VS_TITLE%" w/ %PTS_VER% on x86 ^(Trace: %TRACE_MSG%^) - @ECHO ==================================================================================== - cmake -G "%VS_TITLE%" -A Win32 -T %PTS_VER% -S workspace -B workspace\build\%VS_VER%_%PTS_VER%\Win32 -Wno-dev -DBUILD_SNIFFER=%SNIFFER% -DDBGTRACE=%DBGTRACE% -DDBGTRACE_VERBOSE=%DBGTRACE_VERBOSE% - if "%DO_BUILD%" == "Y" ( - @ECHO ==================================================================================== - @ECHO == Building "%VS_TITLE%" w/ %PTS_VER% on x86 - @ECHO ==================================================================================== - cmake --build workspace\build\%VS_VER%_%PTS_VER%\Win32 --config Release --clean-first -- /p:XPDeprecationWarning=false - ) -) - -echo Finished %TIME% -GOTO END - -:CLEAN -IF EXIST "output\" ( - del output\ /S /Q - del workspace\build\ /S /Q -) -GOTO END - -:DOCS -tools\doxygen\doxygen.exe doxygen.cnf -GOTO END - - -:END diff --git a/c/meterpreter/make.bat b/c/meterpreter/make.bat index c147fc7c8..306149179 100644 --- a/c/meterpreter/make.bat +++ b/c/meterpreter/make.bat @@ -2,25 +2,11 @@ IF "%1"=="clean" GOTO CLEAN IF "%1"=="docs" GOTO DOCS IF "%VCINSTALLDIR%" == "" GOTO NEED_VS -IF NOT EXIST "source\ReflectiveDLLInjection\.git" ( - ECHO Meterpreter's submodule dependencies can't be found. - ECHO From your git console, please run: - ECHO $ git submodule init ^&^& git submodule update - GOTO END -) +IF NOT EXIST "source\ReflectiveDLLInjection\.git" GOTO NEED_RDLL SET PSSDK_VER=19 SET PTS_VER=v141_xp -IF "%1"=="v120_xp" SET PTS_VER=%1 -IF "%2"=="v120_xp" SET PTS_VER=%2 -IF "%3"=="v120_xp" SET PTS_VER=%3 - -IF "%VisualStudioVersion%" == "12.0" ( - SET PSSDK_VER=12 - SET PTS_VER=v120_xp -) - SET PREF= IF EXIST "..\..\..\pssdk\PSSDK_VC%PSSDK_VER%_LIB\_Libs\pssdk_vc%PSSDK_VER%_mt.lib" SET PREF=r7_ @@ -95,8 +81,15 @@ GOTO END tools\doxygen\doxygen.exe doxygen.cnf GOTO END +:NEED_RDLL +ECHO Meterpreter's submodule dependencies can't be found. +ECHO From your git console, please run: +ECHO $ git submodule init ^&^& git submodule update +GOTO END + :NEED_VS ECHO "This command must be executed from within a Visual Studio Command prompt." -ECHO "This can be found under Microsoft Visual Studio (2013|2017|2019) -> Visual Studio Tools" +ECHO "This can be found under Microsoft Visual Studio 20XX > Visual Studio Tools" +ECHO "Visual Studio 2017 or later is required (v141_xp toolchain)." :END diff --git a/c/meterpreter/workspace/ext_server_sniffer/CMakeLists.txt b/c/meterpreter/workspace/ext_server_sniffer/CMakeLists.txt index 291959646..15b32ba27 100644 --- a/c/meterpreter/workspace/ext_server_sniffer/CMakeLists.txt +++ b/c/meterpreter/workspace/ext_server_sniffer/CMakeLists.txt @@ -16,11 +16,7 @@ include_directories(../../source/common) include_directories(../../source/ReflectiveDllInjection/common) include_directories(${PSSDK_DIR}/_include) -if(${CMAKE_GENERATOR_TOOLSET} MATCHES "v120_xp") - set(PSSDK_VER 12) -else() - set(PSSDK_VER 19) -endif() +set(PSSDK_VER 19) set(SRC_DIR ../../source/extensions/sniffer) file(GLOB SRC_FILES diff --git a/c/meterpreter/workspace/meterpreter.props b/c/meterpreter/workspace/meterpreter.props index c285591b8..cf0bad55a 100644 --- a/c/meterpreter/workspace/meterpreter.props +++ b/c/meterpreter/workspace/meterpreter.props @@ -1,17 +1,11 @@ - + false - - v120_xp - - - vc12 - - + vc19 From baeea50b2335e815d0a438bbb86a9f80cf771a78 Mon Sep 17 00:00:00 2001 From: Spencer McIntyre Date: Tue, 23 Sep 2025 09:23:44 -0400 Subject: [PATCH 2/2] Remove VS2017 config too --- c/meterpreter/vs-configs/vs2017.vsconfig | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 c/meterpreter/vs-configs/vs2017.vsconfig diff --git a/c/meterpreter/vs-configs/vs2017.vsconfig b/c/meterpreter/vs-configs/vs2017.vsconfig deleted file mode 100644 index 00bb5f383..000000000 --- a/c/meterpreter/vs-configs/vs2017.vsconfig +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "1.0", - "components": [ - "Microsoft.VisualStudio.Workload.NativeDesktop", - "microsoft.visualstudio.component.debugger.justintime", - "microsoft.visualstudio.component.vc.diagnostictools", - "microsoft.visualstudio.component.vc.cmake.project", - "microsoft.visualstudio.component.vc.atl", - "microsoft.visualstudio.componentgroup.nativedesktop.winxp" - ] -} \ No newline at end of file