Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use VM-Assert-Signature to verify the metasploit MSI #1091

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/metasploit.vm/metasploit.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>metasploit.vm</id>
<version>6.3.30.20230811</version>
<version>6.4.13.20240613</version>
<authors>Rapid7</authors>
<description>A computer security project that provides information about security vulnerabilities, aids in penetration testing, and IDS signature development.</description>
<dependencies>
Expand Down
26 changes: 22 additions & 4 deletions packages/metasploit.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,32 @@ try {
$toolName = 'Metasploit'
$category = 'Command & Control'

$exeUrl = 'https://windows.metasploit.com/metasploitframework-latest.msi'
$exeSha256 = '470039711E182C4551169A776AFC8C10B4BAEA1600334449998894B2D725D49A'
# can't install to specified path.
# Download the installer
$packageArgs = @{
packageName = $env:ChocolateyPackageName
file = Join-Path ${Env:TEMP} 'metasploitframework-latest.msi'
url = 'https://windows.metasploit.com/metasploitframework-latest.msi'
}
$filePath = Get-ChocolateyWebFile @packageArgs
VM-Assert-Path $filePath
VM-Assert-Signature $filePath

# Install the downloaded installer
$packageArgs = @{
packageName = $env:ChocolateyPackageName
file = $filePath
fileType = 'MSI'
silentArgs = "/quiet /norestart INSTALLLOCATION=$(${Env:SystemDrive})\"
}
Install-ChocolateyInstallPackage @packageArgs -ErrorAction SilentlyContinue

$toolDir = Join-Path ${Env:SystemDrive} "metasploit-framework"
$binDir = Join-Path $toolDir "bin"
$executablePath = (Join-Path $binDir "msfconsole.bat")
VM-Install-With-Installer $toolName $category "MSI" "/q /norestart" $executablePath $exeUrl -sha256 $exeSha256
VM-Assert-Path $executablePath

VM-Install-Shortcut -toolName $toolName -category $category -executablePath $executablePath
Install-BinFile -Name $toolName -Path $executablePath
} catch {
VM-Write-Log-Exception $_
}