Skip to content

Commit b25ab8c

Browse files
committed
Try to fix the VS 2022 build
1 parent 9c5da4b commit b25ab8c

File tree

1 file changed

+41
-14
lines changed

1 file changed

+41
-14
lines changed

.github/workflows/shared_meterpreter_acceptance.yml

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
if: runner.os == 'Linux'
113113
run: sudo apt-get -y --no-install-recommends install libpcap-dev graphviz
114114

115-
- uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1
115+
- uses: shivammathur/setup-php@verbose
116116
if: ${{ matrix.meterpreter.name == 'php' }}
117117
with:
118118
php-version: ${{ matrix.meterpreter.runtime_version }}
@@ -138,7 +138,7 @@ jobs:
138138
REM pcap dependencies
139139
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')"
140140
141-
choco install 7zip.installServerCertificateValidationCallback
141+
choco install 7zip.install
142142
7z x "C:\Windows\Temp\WpdPack_4_1_2.zip" -o"C:\"
143143
144144
dir C:\\
@@ -273,23 +273,50 @@ jobs:
273273
shell: pwsh
274274
if: ${{ matrix.meterpreter.name == 'windows_meterpreter' && matrix.os == 'windows-2022' && inputs.build_metasploit_payloads }}
275275
run: |
276+
$vsInstallerDir='C:\Program Files (x86)\Microsoft Visual Studio\Installer'
277+
Write-Host "Listing $vsInstallerDir"
278+
Get-ChildItem -Force $vsInstallerDir | ForEach-Object { Write-Host $_.Name }
279+
Write-Host "vs_installer exists: $(Test-Path (Join-Path $vsInstallerDir 'vs_installer.exe'))"
280+
276281
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
277282
dir
278-
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
279-
$WorkLoads = '--config "D:\a\metasploit-payloads\metasploit-payloads\metasploit-payloads\c\meterpreter\vs-configs\vs2022.vsconfig"'
280-
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"", $WorkLoads, '--quiet', '--norestart', '--nocache')
281-
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
282-
if ($process.ExitCode -eq 0) {
283-
Write-Host "components have been successfully added"
283+
$installer = 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe'
284+
$installPath = 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise'
285+
$vsconfig = Join-Path $env:GITHUB_WORKSPACE 'metasploit-payloads\c\meterpreter\vs-configs\vs2022.vsconfig'
286+
Write-Host "Checking vsconfig path: $vsconfig"
287+
288+
# show current workspace and mapping info
289+
Write-Host "GITHUB_WORKSPACE: $env:GITHUB_WORKSPACE"
290+
Write-Host "PWD:"
291+
Get-Location
292+
293+
# quick exists check
294+
if (Test-Path -LiteralPath $vsconfig) {
295+
Write-Host "vsconfig FOUND at: $vsconfig"
284296
} else {
285-
Write-Host "components were not installed"
297+
Write-Host "vsconfig NOT FOUND at: $vsconfig"
286298
exit 1
287299
}
288-
Set-Location "D:\a\metasploit-payloads\metasploit-payloads\metasploit-payloads\c\meterpreter"
289-
$r = Invoke-Command -ScriptBlock { cmd.exe /c 'git submodule init && git submodule update' }
290-
Write-Host $r
291-
$r = Invoke-Command -ScriptBlock { cmd.exe /c '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" && make.bat' }
292-
Write-Host $r
300+
301+
# Show vsconfig contents for debugging
302+
Write-Host "`n---- vsconfig contents ----"
303+
Get-Content $vsconfig | ForEach-Object { Write-Host $_ }
304+
Write-Host "---- end vsconfig ----`n"
305+
306+
$stdoutFile = Join-Path $env:RUNNER_TEMP 'vs_modify_stdout.txt'
307+
$stderrFile = Join-Path $env:RUNNER_TEMP 'vs_modify_stderr.txt'
308+
309+
Write-Host "Running installer with redirected output..."
310+
# Removed --quiet flag to get more verbose output
311+
$argList = @('modify', '--installPath', $installPath, '--config', $vsconfig, '--norestart', '--nocache')
312+
$proc = Start-Process -FilePath $installer -ArgumentList $argList -Wait -PassThru -NoNewWindow
313+
314+
Write-Host "Installer exit code: $($proc.ExitCode)"
315+
if ($proc.ExitCode -ne 0) {
316+
Write-Host "components were not installed (exit code $($proc.ExitCode)). See logs above."
317+
exit $proc.ExitCode
318+
}
319+
Write-Host "components have been successfully added"
293320
working-directory: metasploit-payloads
294321

295322
- name: Build Windows payloads via Visual Studio 2025 Build (Windows)

0 commit comments

Comments
 (0)