Skip to content

Commit

Permalink
Use VM-Assert-Signature to verify the metasploit MSI
Browse files Browse the repository at this point in the history
  • Loading branch information
d35ha committed Jun 13, 2024
1 parent 24c47d7 commit d65896a
Show file tree
Hide file tree
Showing 2 changed files with 26 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
29 changes: 25 additions & 4 deletions packages/metasploit.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,35 @@ 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 /l*v `"$($env:TEMP)\$($env:chocolateyPackageName).$($env:chocolateyPackageVersion).MsiInstall.log`""
}
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

dir c:\

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 d65896a

Please sign in to comment.