Skip to content

Commit

Permalink
Merge branch 'rapid7:master' into xspy
Browse files Browse the repository at this point in the history
  • Loading branch information
h00die authored Jul 12, 2024
2 parents 04f4990 + 6283456 commit a93a6dd
Show file tree
Hide file tree
Showing 818 changed files with 59,254 additions and 10,007 deletions.
5 changes: 4 additions & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ blank_issues_enabled: false
contact_links:
- name: Termux Issues?
url: https://github.com/rapid7/metasploit-framework/issues/11023
about: Termux is not officially supported, check here for more info
about: Termux is not officially supported, check here for more info
- name: Android Payload Issues?
url: https://github.com/rapid7/metasploit-framework/issues/19154
about: Check here for more info
49 changes: 30 additions & 19 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ on:
- 'lib/msf/core/**'
- 'tools/dev/**'
- 'spec/acceptance/**'
- 'spec/support/acceptance/**'
- 'spec/acceptance_spec_helper.rb'
- '.github/**'
# Example of running as a cron, to weed out flaky tests
# schedule:
# - cron: '*/15 * * * *'
Expand All @@ -50,7 +52,7 @@ jobs:
fail-fast: false
matrix:
os:
- macos-11
- macos-12
- windows-2019
- ubuntu-20.04
ruby:
Expand All @@ -60,20 +62,21 @@ jobs:
- { name: python, runtime_version: 3.6 }
- { name: python, runtime_version: 3.11 }

# Java - newer versions of Java are not supported currently: https://github.com/rapid7/metasploit-payloads/issues/647
# Java
- { name: java, runtime_version: 8 }
- { name: java, runtime_version: 21 }

# PHP - Temporarily removed as tests are timing out on Github actions
# - { name: php, runtime_version: 5.3 }
# - { name: php, runtime_version: 7.4 }
# - { name: php, runtime_version: 8.2 }
# PHP
- { name: php, runtime_version: 5.3 }
- { name: php, runtime_version: 7.4 }
- { name: php, runtime_version: 8.3 }
include:
# Windows Meterpreter
- { meterpreter: { name: windows_meterpreter }, os: windows-2019 }
- { meterpreter: { name: windows_meterpreter }, os: windows-2022 }

# Mettle
- { meterpreter: { name: mettle }, os: macos-11 }
- { meterpreter: { name: mettle }, os: macos-12 }
- { meterpreter: { name: mettle }, os: ubuntu-20.04 }

runs-on: ${{ matrix.os }}
Expand All @@ -85,26 +88,28 @@ jobs:
HOST_RUNNER_IMAGE: ${{ matrix.os }}
METERPRETER: ${{ matrix.meterpreter.name }}
METERPRETER_RUNTIME_VERSION: ${{ matrix.meterpreter.runtime_version }}
# pcaprub skipped until new version released: https://github.com/pcaprub/pcaprub/issues/70
BUNDLE_WITHOUT: "coverage development pcaprub"

name: ${{ matrix.meterpreter.name }} ${{ matrix.meterpreter.runtime_version }} ${{ matrix.os }}
steps:
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get -y --no-install-recommends install libpcap-dev graphviz

- uses: shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d
- uses: shivammathur/setup-php@fc14643b0a99ee9db10a3c025a33d76544fa3761
if: ${{ matrix.meterpreter.name == 'php' }}
with:
php-version: ${{ matrix.meterpreter.runtime_version }}
tools: none

- name: Set up Python
if: ${{ matrix.meterpreter.name == 'python' }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.meterpreter.runtime_version }}

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
if: ${{ matrix.meterpreter.name == 'java' }}
with:
distribution: temurin
Expand All @@ -126,11 +131,18 @@ jobs:
type %WINDIR%\\system32\\drivers\\etc\\hosts
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

# pcaprub skipped until new version released: https://github.com/pcaprub/pcaprub/issues/70
- name: Remove pcaprub dependency
shell: pwsh
if: runner.os == 'Windows'
run: |
Set-Content -Path "Gemfile.lock" -Value (Get-Content -Path "Gemfile.lock" | Select-String -Pattern 'pcaprub' -NotMatch | Select-String -Pattern 'packetfu' -NotMatch)
Set-Content -Path "metasploit-framework.gemspec" -Value (Get-Content -Path "metasploit-framework.gemspec" | Select-String -Pattern 'pcaprub' -NotMatch | Select-String -Pattern 'packetfu' -NotMatch)
- name: Setup Ruby
env:
BUNDLE_WITHOUT: "coverage development"
BUNDLE_FORCE_RUBY_PLATFORM: true
uses: ruby/setup-ruby@v1
with:
Expand All @@ -153,11 +165,11 @@ jobs:
# Note: rspec retry is intentionally not used, as it can cause issues with allure's reporting
# Additionally - flakey tests should be fixed or marked as flakey instead of silently retried
run: |
bundle exec rspec spec/acceptance/
bundle exec rspec spec/acceptance/meterpreter_spec.rb
- name: Archive results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
# Provide a unique artifact for each matrix os, otherwise race conditions can lead to corrupt zips
name: raw-data-${{ matrix.meterpreter.name }}-${{ matrix.meterpreter.runtime_version }}-${{ matrix.os }}
Expand All @@ -172,7 +184,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
if: always()

- name: Install system dependencies (Linux)
Expand All @@ -182,18 +194,17 @@ jobs:
- name: Setup Ruby
if: always()
env:
BUNDLE_WITHOUT: "coverage development"
BUNDLE_FORCE_RUBY_PLATFORM: true
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.2
ruby-version: '${{ matrix.ruby }}'
bundler-cache: true
cache-version: 4
# Github actions with Ruby requires Bundler 2.2.18+
# https://github.com/ruby/setup-ruby/tree/d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c#windows
bundler: 2.2.33

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
id: download
if: always()
with:
Expand All @@ -216,7 +227,7 @@ jobs:
- name: archive results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: final-report-${{ github.run_id }}
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
name: Ruby ${{ matrix.ruby }}
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Ruby
uses: ruby/setup-ruby@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ jobs:
close: true,
comment: `
Thanks for your contribution to Metasploit Framework! We've looked at this issue, and unfortunately we do not currently have the bandwidth to prioritize this issue.
We've labeled this as \`attic\` and closed it for now. If you believe this issue has been closed in error, or that it should be prioritized, please comment with additional information.
`
}
Expand Down
164 changes: 164 additions & 0 deletions .github/workflows/ldap_acceptance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: Acceptance

# Optional, enabling concurrency limits: https://docs.github.com/en/actions/using-jobs/using-concurrency
#concurrency:
# group: ${{ github.ref }}-${{ github.workflow }}
# cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
actions: none
checks: none
contents: none
deployments: none
id-token: none
issues: none
discussions: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none

on:
push:
branches-ignore:
- gh-pages
- metakitty
pull_request:
branches:
- '*'
paths:
- 'metsploit-framework.gemspec'
- 'Gemfile.lock'
- '**/**ldap**'
- 'spec/acceptance/**'
- 'spec/support/acceptance/**'
- 'spec/acceptance_spec_helper.rb'
- '.github/**'
# Example of running as a cron, to weed out flaky tests
# schedule:
# - cron: '*/15 * * * *'

jobs:
ldap:
runs-on: ${{ matrix.os }}
timeout-minutes: 40

strategy:
fail-fast: true
matrix:
ruby:
- '3.2'
os:
- ubuntu-latest

env:
RAILS_ENV: test
BUNDLE_WITHOUT: "coverage development pcap"

name: LDAP Acceptance - ${{ matrix.os }} - Ruby ${{ matrix.ruby }}
steps:
- name: Install system dependencies
run: sudo apt-get install -y --no-install-recommends libpcap-dev graphviz

- name: Checkout code
uses: actions/checkout@v4

- name: Run samba/ldap docker container
working-directory: 'test/ldap'
run: |
docker compose build
docker compose up --wait -d
- name: Setup Ruby
env:
# Nokogiri doesn't release pre-compiled binaries for preview versions of Ruby; So force compilation with BUNDLE_FORCE_RUBY_PLATFORM
BUNDLE_FORCE_RUBY_PLATFORM: "${{ contains(matrix.ruby, 'preview') && 'true' || 'false' }}"
uses: ruby/setup-ruby@v1
with:
ruby-version: '${{ matrix.ruby }}'
bundler-cache: true

- name: acceptance
env:
SPEC_HELPER_LOAD_METASPLOIT: false
SPEC_OPTS: "--tag acceptance --require acceptance_spec_helper.rb --color --format documentation --format AllureRspec::RSpecFormatter"
RUNTIME_VERSION: latest
# Unix run command:
# SPEC_HELPER_LOAD_METASPLOIT=false bundle exec ./spec/acceptance
# Windows cmd command:
# set SPEC_HELPER_LOAD_METASPLOIT=false
# bundle exec rspec .\spec\acceptance
# Note: rspec retry is intentionally not used, as it can cause issues with allure's reporting
# Additionally - flakey tests should be fixed or marked as flakey instead of silently retried
run: |
bundle exec rspec spec/acceptance/ldap_spec.rb
- name: Archive results
if: always()
uses: actions/upload-artifact@v4
with:
# Provide a unique artifact for each matrix os, otherwise race conditions can lead to corrupt zips
name: ldap-acceptance-${{ matrix.os }}
path: tmp/allure-raw-data

# Generate a final report from the previous test results
report:
name: Generate report
needs:
- ldap
runs-on: ubuntu-latest
if: always()

steps:
- name: Checkout code
uses: actions/checkout@v4
if: always()

- name: Install system dependencies (Linux)
if: always()
run: sudo apt-get -y --no-install-recommends install libpcap-dev graphviz

- name: Setup Ruby
if: always()
env:
BUNDLE_FORCE_RUBY_PLATFORM: true
uses: ruby/setup-ruby@v1
with:
ruby-version: '${{ matrix.ruby }}'
bundler-cache: true
cache-version: 4
# Github actions with Ruby requires Bundler 2.2.18+
# https://github.com/ruby/setup-ruby/tree/d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c#windows
bundler: 2.2.33

- uses: actions/download-artifact@v4
id: download
if: always()
with:
# Note: Not specifying a name will download all artifacts from the previous workflow jobs
path: raw-data

- name: allure generate
if: always()
run: |
export VERSION=2.22.1
curl -o allure-$VERSION.tgz -Ls https://github.com/allure-framework/allure2/releases/download/$VERSION/allure-$VERSION.tgz
tar -zxvf allure-$VERSION.tgz -C .
ls -la ${{steps.download.outputs.download-path}}
./allure-$VERSION/bin/allure generate ${{steps.download.outputs.download-path}}/* -o ./allure-report
find ${{steps.download.outputs.download-path}}
bundle exec ruby tools/dev/report_generation/support_matrix/generate.rb --allure-data ${{steps.download.outputs.download-path}} > ./allure-report/support_matrix.html
- name: archive results
if: always()
uses: actions/upload-artifact@v4
with:
name: final-report-${{ github.run_id }}
path: |
./allure-report
9 changes: 5 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,22 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 40

env:
BUNDLE_WITHOUT: "coverage development pcap"

strategy:
fail-fast: true
matrix:
ruby:
- '3.0'
- '3.1'

name: Lint msftidy
steps:
- name: Install system dependencies
run: sudo apt-get install libpcap-dev graphviz

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
# Required to checkout HEAD^ and 3a046f01dae340c124dd3895e670983aef5fe0c5 for the msftidy script
# https://github.com/actions/checkout/tree/5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f#checkout-head
with:
Expand All @@ -53,8 +56,6 @@ jobs:
with:
ruby-version: '${{ matrix.ruby }}'
bundler-cache: true
env:
BUNDLE_WITHOUT: "coverage development pcap"

- name: Run msftidy
run: |
Expand Down
Loading

0 comments on commit a93a6dd

Please sign in to comment.