scripts: vendor/install MetasploitMCP during setup (setup.sh, setup.ps1)

This commit is contained in:
giveen
2026-01-14 13:15:47 -07:00
parent abaaca184e
commit 8415d9fcbd
2 changed files with 39 additions and 1 deletions

View File

@@ -106,6 +106,38 @@ if (Test-Path -Path $hexReq) {
}
}
# Attempt to vendor MetasploitMCP via bundled script if not already present
$msDir = Join-Path -Path (Get-Location) -ChildPath "third_party/MetasploitMCP"
$addScript = Join-Path -Path (Get-Location) -ChildPath "scripts/add_metasploit_subtree.sh"
if (-not (Test-Path -Path $msDir) -and (Test-Path -Path $addScript)) {
Write-Host "Vendoring MetasploitMCP into third_party (requires bash)..."
if (Get-Command bash -ErrorAction SilentlyContinue) {
try {
& bash -c "scripts/add_metasploit_subtree.sh"
} catch {
Write-Host "Warning: Failed to vendor MetasploitMCP via bash: $($_.Exception.Message)" -ForegroundColor Yellow
}
} else {
Write-Host "Warning: 'bash' not available; please run scripts/add_metasploit_subtree.sh manually." -ForegroundColor Yellow
}
}
# Install vendored MetasploitMCP dependencies automatically if present
$msReq = Join-Path -Path (Get-Location) -ChildPath "third_party/MetasploitMCP/requirements.txt"
$installMsScript = Join-Path -Path (Get-Location) -ChildPath "scripts/install_metasploit_deps.sh"
if (Test-Path -Path $msReq) {
Write-Host "Installing vendored MetasploitMCP dependencies..."
if (Test-Path -Path $installMsScript -and (Get-Command bash -ErrorAction SilentlyContinue)) {
try {
& bash -c "scripts/install_metasploit_deps.sh"
} catch {
Write-Host "Warning: Failed to install MetasploitMCP deps via bash: $($_.Exception.Message)" -ForegroundColor Yellow
}
} else {
Write-Host "Warning: Could not run install script automatically; run scripts/install_metasploit_deps.sh manually." -ForegroundColor Yellow
}
}
Write-Host ""
Write-Host "Setup complete!"
Write-Host ""

View File

@@ -104,10 +104,16 @@ if [ -f "third_party/hexstrike/requirements.txt" ]; then
bash scripts/install_hexstrike_deps.sh
fi
# Vendor MetasploitMCP via git-subtree if not already vendored
if [ ! -d "third_party/MetasploitMCP" ] && [ -f "scripts/add_metasploit_subtree.sh" ]; then
echo "Vendoring MetasploitMCP into third_party..."
bash scripts/add_metasploit_subtree.sh || echo "Warning: failed to vendor MetasploitMCP; you can run scripts/add_metasploit_subtree.sh manually."
fi
# Install vendored MetasploitMCP dependencies automatically if present
if [ -f "third_party/MetasploitMCP/requirements.txt" ]; then
echo "Installing vendored MetasploitMCP dependencies..."
bash scripts/install_metasploit_deps.sh
bash scripts/install_metasploit_deps.sh || echo "Warning: failed to install MetasploitMCP dependencies."
fi
echo ""