Skip to content

Commit

Permalink
Merge pull request #1091 from d35ha/fix-metasploit-package
Browse files Browse the repository at this point in the history
Use VM-Assert-Signature to verify the metasploit MSI
  • Loading branch information
emtuls authored Jun 14, 2024
2 parents 17ed8ee + a8403c6 commit a0c9e86
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
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 $_
}

0 comments on commit a0c9e86

Please sign in to comment.