1+
12name : Acceptance
23
34# Optional, enabling concurrency limits: https://docs.github.com/en/actions/using-jobs/using-concurrency
@@ -22,6 +23,16 @@ permissions:
2223 statuses : none
2324
2425on :
26+ workflow_dispatch :
27+ inputs :
28+ metasploitPayloadsCommit :
29+ description : ' metasploit-payloads branch would like to test'
30+ required : true
31+ default : ' master'
32+ mettleCommit :
33+ description : ' mettle branch you would like to test'
34+ required : true
35+ default : ' master'
2536 push :
2637 branches-ignore :
2738 - gh-pages
3243 paths :
3344 - ' metsploit-framework.gemspec'
3445 - ' Gemfile.lock'
35- - ' **/**mssql**'
46+ - ' data/templates/**'
47+ - ' modules/payloads/**'
48+ - ' lib/msf/core/payload/**'
49+ - ' lib/msf/core/**'
50+ - ' tools/dev/**'
3651 - ' spec/acceptance/**'
3752 - ' spec/support/acceptance/**'
3853 - ' spec/acceptance_spec_helper.rb'
4257# - cron: '*/15 * * * *'
4358
4459jobs :
45- mssql :
46- runs-on : ${{ matrix.os }}
47- timeout-minutes : 40
48-
49- services :
50- mssql :
51- image : ${{ matrix.docker_image }}
52- ports : ["1433:1433"]
53- env :
54- MSSQL_SA_PASSWORD : yourStrong(!)Password
55- ACCEPT_EULA : ' Y'
56- options : >-
57- --health-cmd "/opt/mssql-tools/bin/sqlcmd -U sa -P 'yourStrong(!)Password' -Q 'select 1' -b -o /dev/null"
58- --health-interval 10s
59- --health-timeout 5s
60- --health-retries 5
61-
60+ # Run all test individually, note there is a separate final job for aggregating the test results
61+ test :
6262 strategy :
63- fail-fast : true
63+ fail-fast : false
6464 matrix :
65- ruby :
66- - ' 3.2'
6765 os :
68- - ubuntu-latest
69- docker_image : []
70- # - mcr.microsoft.com/mssql/server:2022-latest
71- # - mcr.microsoft.com/mssql/server:2019-latest
66+ - windows-2019
67+ - ubuntu-20.04
68+ ruby :
69+ - 3.0.2
70+ include :
71+ # Powershell
72+ - { command_shell: { name: powershell }, os: windows-2019 }
73+ - { command_shell: { name: powershell }, os: windows-2022 }
74+
75+ # Linux
76+ - { command_shell: { name: linux }, os: ubuntu-20.04 }
77+
78+ # CMD
79+ - { command_shell: { name: cmd }, os: windows-2019 }
80+ - { command_shell: { name: cmd }, os: windows-2022 }
81+
82+ runs-on : ${{ matrix.os }}
83+
84+ timeout-minutes : 50
7285
7386 env :
7487 RAILS_ENV : test
75- BUNDLE_WITHOUT : " coverage development pcap"
88+ HOST_RUNNER_IMAGE : ${{ matrix.os }}
89+ SESSION : ' command_shell/${{ matrix.command_shell.name }}'
90+ SESSION_RUNTIME_VERSION : ${{ matrix.command_shell.runtime_version }}
91+ BUNDLE_WITHOUT : " coverage development"
7692
77-
78- name : ${{ matrix.docker_image }} - ${{ matrix.os }} - Ruby ${{ matrix.ruby }}
93+ name : ${{ matrix.command_shell.name }} ${{ matrix.command_shell.runtime_version }} ${{ matrix.os }}
7994 steps :
80- - name : Install system dependencies
81- run : sudo apt-get install -y --no-install-recommends libpcap-dev graphviz
95+ - name : Install system dependencies (Linux)
96+ if : runner.os == 'Linux'
97+ run : sudo apt-get -y --no-install-recommends install libpcap-dev graphviz
8298
83- - name : Checkout code
99+ - uses : shivammathur/setup-php@fc14643b0a99ee9db10a3c025a33d76544fa3761
100+ if : ${{ matrix.command_shell.name == 'php' }}
101+ with :
102+ php-version : ${{ matrix.command_shell.runtime_version }}
103+ tools : none
104+
105+ - name : Install system dependencies (Windows)
106+ shell : cmd
107+ if : runner.os == 'Windows'
108+ run : |
109+ REM pcap dependencies
110+ powershell -Command "[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} ; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object System.Net.WebClient).DownloadFile('https://www.winpcap.org/install/bin/WpdPack_4_1_2.zip', 'C:\Windows\Temp\WpdPack_4_1_2.zip')"
111+
112+ choco install 7zip.installServerCertificateValidationCallback
113+ 7z x "C:\Windows\Temp\WpdPack_4_1_2.zip" -o"C:\"
114+
115+ dir C:\\
116+
117+ dir %WINDIR%
118+ type %WINDIR%\\system32\\drivers\\etc\\hosts
119+
120+ # The job checkout structure is:
121+ # .
122+ # └── metasploit-framework
123+
124+ - name : Checkout metasploit-framework code
84125 uses : actions/checkout@v4
126+ with :
127+ path : metasploit-framework
85128
86129 - name : Setup Ruby
87130 env :
88- # Nokogiri doesn't release pre-compiled binaries for preview versions of Ruby; So force compilation with BUNDLE_FORCE_RUBY_PLATFORM
89- BUNDLE_FORCE_RUBY_PLATFORM : " ${{ contains(matrix.ruby, 'preview') && 'true' || 'false' }}"
131+ BUNDLE_FORCE_RUBY_PLATFORM : true
90132 uses : ruby/setup-ruby@v1
91133 with :
92- ruby-version : ' ${{ matrix.ruby }}'
134+ ruby-version : ${{ matrix.ruby }}
93135 bundler-cache : true
136+ working-directory : metasploit-framework
137+ cache-version : 5
94138
95- - name : Extract runtime version
96- run : |
97- echo "RUNTIME_VERSION=$(echo $DOCKER_IMAGE | awk -F: '{ print $2 }')" >> $GITHUB_ENV
98- echo "DOCKER_IMAGE_FILENAME=$(echo $DOCKER_IMAGE | tr -d '/:')" >> $GITHUB_ENV
99- env :
100- DOCKER_IMAGE : ${{ matrix.docker_image }}
101- OS : ${{ matrix.os }}
102-
103- - name : acceptance
139+ - name : Acceptance
104140 env :
105141 SPEC_HELPER_LOAD_METASPLOIT : false
106142 SPEC_OPTS : " --tag acceptance --require acceptance_spec_helper.rb --color --format documentation --format AllureRspec::RSpecFormatter"
107- RUNTIME_VERSION : ${{ env.RUNTIME_VERSION }}
108143 # Unix run command:
109144 # SPEC_HELPER_LOAD_METASPLOIT=false bundle exec ./spec/acceptance
110145 # Windows cmd command:
@@ -113,21 +148,21 @@ jobs:
113148 # Note: rspec retry is intentionally not used, as it can cause issues with allure's reporting
114149 # Additionally - flakey tests should be fixed or marked as flakey instead of silently retried
115150 run : |
116- bundle exec rspec spec/acceptance/mssql_spec.rb
151+ bundle exec rspec spec/acceptance/command_shell_spec.rb
152+ working-directory : metasploit-framework
117153
118154 - name : Archive results
119155 if : always()
120156 uses : actions/upload-artifact@v4
121157 with :
122158 # Provide a unique artifact for each matrix os, otherwise race conditions can lead to corrupt zips
123- name : ${{ env.DOCKER_IMAGE_FILENAME }}-${{ matrix.os }}
124- path : tmp/allure-raw-data
159+ name : raw-data- ${{ matrix.command_shell.name }}-${{ matrix.command_shell.runtime_version }}-${{ matrix.os }}
160+ path : metasploit-framework/ tmp/allure-raw-data
125161
126162 # Generate a final report from the previous test results
127163 report :
128164 name : Generate report
129- needs :
130- - mssql
165+ needs : test
131166 runs-on : ubuntu-latest
132167 if : always()
133168
@@ -149,9 +184,6 @@ jobs:
149184 ruby-version : ' ${{ matrix.ruby }}'
150185 bundler-cache : true
151186 cache-version : 4
152- # Github actions with Ruby requires Bundler 2.2.18+
153- # https://github.com/ruby/setup-ruby/tree/d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c#windows
154- bundler : 2.2.33
155187
156188 - uses : actions/download-artifact@v4
157189 id : download
0 commit comments