|
13 | 13 | default: '' |
14 | 14 | required: false |
15 | 15 | type: string |
| 16 | + metasploit_payloads_repo: |
| 17 | + description: "metasploit-payloads repository to build with (e.g. a fork: myuser/metasploit-payloads)" |
| 18 | + default: 'rapid7/metasploit-payloads' |
| 19 | + required: false |
| 20 | + type: string |
16 | 21 | mettle_commit: |
17 | 22 | description: "mettle commit to build with" |
18 | 23 | default: '' |
|
30 | 35 | type: boolean |
31 | 36 |
|
32 | 37 | jobs: |
33 | | - # Compile the Meterpreter payloads via docker if required, we can't always do this on the |
34 | | - # host environment (i.e. for macos). So it instead gets compiled first on a linux |
35 | | - # host, then the artifacts are copied back to the host later |
| 38 | + # Compile Java Meterpreter and prepare PHP/Python payloads via docker if required, we can't |
| 39 | + # always do this on the host environment (i.e. for macos). So it instead gets compiled first |
| 40 | + # on a linux host, then the artifacts are copied back to the host later |
36 | 41 | meterpreter_compilation: |
37 | | - name: Compile Meterpreter |
| 42 | + name: Build Meterpreter Gem (optional) |
38 | 43 | runs-on: ubuntu-latest |
39 | 44 | if: ${{ inputs.build_metasploit_payloads }} |
40 | 45 |
|
41 | 46 | steps: |
42 | 47 | - name: Checkout metasploit-payloads |
43 | 48 | uses: actions/checkout@v4 |
44 | 49 | with: |
45 | | - repository: rapid7/metasploit-payloads |
| 50 | + repository: ${{ inputs.metasploit_payloads_repo }} |
46 | 51 | path: metasploit-payloads |
47 | 52 | ref: ${{ inputs.metasploit_payloads_commit }} |
48 | 53 |
|
@@ -141,19 +146,22 @@ jobs: |
141 | 146 | java-version: ${{ matrix.meterpreter.runtime_version }} |
142 | 147 |
|
143 | 148 | - name: Install system dependencies (Windows) |
144 | | - shell: cmd |
| 149 | + shell: pwsh |
145 | 150 | if: runner.os == 'Windows' |
146 | 151 | run: | |
147 | | - REM pcap dependencies |
148 | | - 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')" |
| 152 | + $ErrorActionPreference = 'Stop' |
| 153 | + # pcap dependencies |
| 154 | + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 |
| 155 | + Invoke-WebRequest -Uri 'https://www.winpcap.org/install/bin/WpdPack_4_1_2.zip' -OutFile 'C:\Windows\Temp\WpdPack_4_1_2.zip' -SkipCertificateCheck |
| 156 | + $expected = 'ea799cf2f26e4afb1892938070fd2b1ca37ce5cf75fec4349247df12b784edbd' |
| 157 | + $actual = (Get-FileHash 'C:\Windows\Temp\WpdPack_4_1_2.zip' -Algorithm SHA256).Hash.ToLower() |
| 158 | + if ($actual -ne $expected) { throw "WpdPack_4_1_2.zip SHA256 mismatch: expected $expected, got $actual" } |
149 | 159 |
|
150 | | - choco install 7zip.installServerCertificateValidationCallback |
151 | | - 7z x "C:\Windows\Temp\WpdPack_4_1_2.zip" -o"C:\" |
152 | | -
|
153 | | - dir C:\\ |
| 160 | + choco install 7zip -y --no-progress |
| 161 | + if ($LASTEXITCODE -ne 0) { throw "choco install 7zip failed with exit code $LASTEXITCODE" } |
154 | 162 |
|
155 | | - dir %WINDIR% |
156 | | - type %WINDIR%\\system32\\drivers\\etc\\hosts |
| 163 | + 7z x "C:\Windows\Temp\WpdPack_4_1_2.zip" -o"C:\" |
| 164 | + if ($LASTEXITCODE -ne 0) { throw "7z extraction failed with exit code $LASTEXITCODE" } |
157 | 165 |
|
158 | 166 | # The job checkout structure is: |
159 | 167 | # . |
@@ -265,7 +273,7 @@ jobs: |
265 | 273 | if: ${{ inputs.build_metasploit_payloads && matrix.meterpreter.name != 'mettle' }} |
266 | 274 | uses: actions/checkout@v4 |
267 | 275 | with: |
268 | | - repository: rapid7/metasploit-payloads |
| 276 | + repository: ${{ inputs.metasploit_payloads_repo }} |
269 | 277 | path: metasploit-payloads |
270 | 278 | ref: ${{ inputs.metasploit_payloads_commit }} |
271 | 279 |
|
|
0 commit comments