From 5f76ba82666797d64e0508ecda69b1788fce9347 Mon Sep 17 00:00:00 2001 From: cgranleese-r7 Date: Mon, 21 Oct 2024 11:51:48 +0100 Subject: [PATCH] Builds metasploit-payload gem as part of acceptance tests --- .../shared_meterpreter_acceptance.yml | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/shared_meterpreter_acceptance.yml b/.github/workflows/shared_meterpreter_acceptance.yml index 53d77e86c5b6f..b9498ea7eefd0 100644 --- a/.github/workflows/shared_meterpreter_acceptance.yml +++ b/.github/workflows/shared_meterpreter_acceptance.yml @@ -159,7 +159,7 @@ jobs: - name: Get mettle version if: ${{ matrix.meterpreter.name == 'mettle' && inputs.build_mettle }} run: | - echo "METTLE_VERSION=$(grep -oh '[0-9].[0-9].[0-9]*' lib/metasploit_payloads/mettle/version.rb)" | tee -a $GITHUB_ENV + echo "METTLE_VERSION=$(ruby -ne 'puts $& if /[0-9].[0-9].[0-9]*/' lib/metasploit_payloads/mettle/version.rb)" | tee -a $GITHUB_ENV working-directory: mettle - name: Prerequisite mettle gem setup @@ -244,13 +244,39 @@ jobs: working-directory: metasploit-framework - name: Checkout metasploit-payloads - if: ${{ inputs.build_metasploit_payloads }} + # TODO +# if: ${{ inputs.build_metasploit_payloads }} uses: actions/checkout@v4 with: repository: rapid7/metasploit-payloads path: metasploit-payloads ref: ${{ inputs.metasploit_payloads_commit }} + - name: Get metasploit-payloads version - Windows + shell: bash + run: | + echo "METASPLOIT_PAYLOADS_VERSION=$(ruby -ne 'puts $& if /[0-9].[0-9].[0-9]*/' gem/lib/metasploit-payloads/version.rb)" | tee -a $GITHUB_ENV + working-directory: metasploit-payloads + + - name: Build metasploit-payloads gem + run: | + gem build ./gem/metasploit-payloads.gemspec + working-directory: metasploit-payloads + + - name: Copy metasploit-payloads gem into metasploit-framework + shell: bash + run: | + cp ../metasploit-payloads/metasploit-payloads-${{ env.METASPLOIT_PAYLOADS_VERSION }}.gem . + working-directory: metasploit-framework + + - name: Install metasploit-payloads gem + run: | + bundle exec gem install metasploit-payloads-${{ env.METASPLOIT_PAYLOADS_VERSION }}.gem + bundle config unset deployment + bundle update metasploit-payloads + bundle install + working-directory: metasploit-framework + - name: Build Windows payloads via Visual Studio 2019 Build (Windows) shell: cmd if: ${{ matrix.meterpreter.name == 'windows_meterpreter' && matrix.os == 'windows-2019' && inputs.build_metasploit_payloads }}