install-windows-simple.ps1ā¢5.86 kB
# MCP Pentest - Simple Windows Installation Script
# Colors for output
function Write-Status {
param([string]$Message)
Write-Host "[INFO] $Message" -ForegroundColor Green
}
function Write-Warning {
param([string]$Message)
Write-Host "[WARNING] $Message" -ForegroundColor Yellow
}
function Write-Error {
param([string]$Message)
Write-Host "[ERROR] $Message" -ForegroundColor Red
}
Write-Host "š§ MCP Pentest Windows Installation" -ForegroundColor Cyan
Write-Host "===================================" -ForegroundColor Cyan
Write-Host ""
# Check if running as administrator
$currentUser = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($currentUser)
$isAdmin = $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Write-Warning "This script is recommended to run as Administrator for best results."
Write-Host "Some installations may fail without admin privileges."
Write-Host ""
}
# Install Chocolatey if not present
Write-Status "Checking Chocolatey..."
if (-not (Get-Command choco -ErrorAction SilentlyContinue)) {
Write-Status "Installing Chocolatey..."
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Refresh environment
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
} else {
Write-Status "Chocolatey already installed"
}
# Install Python
Write-Status "Installing Python..."
if (-not (Get-Command python -ErrorAction SilentlyContinue)) {
choco install python -y
# Refresh environment
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
} else {
Write-Status "Python already installed"
}
# Install Git
Write-Status "Installing Git..."
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
choco install git -y
# Refresh environment
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
} else {
Write-Status "Git already installed"
}
# Install Go
Write-Status "Installing Go..."
if (-not (Get-Command go -ErrorAction SilentlyContinue)) {
choco install golang -y
# Refresh environment
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
} else {
Write-Status "Go already installed"
}
# Install Nmap
Write-Status "Installing Nmap..."
if (-not (Get-Command nmap -ErrorAction SilentlyContinue)) {
choco install nmap -y
} else {
Write-Status "Nmap already installed"
}
Write-Host ""
Write-Status "Installing Python packages..."
# Install essential Python packages
$pythonPackages = @(
"requests",
"beautifulsoup4",
"lxml",
"sqlmap",
"crackmapexec",
"impacket",
"ssh-audit"
)
foreach ($package in $pythonPackages) {
try {
Write-Status "Installing $package..."
python -m pip install $package --quiet
Write-Status "ā Installed: $package"
} catch {
Write-Warning "Failed to install: $package"
}
}
Write-Host ""
Write-Status "Installing Go tools..."
# Add Go bin to PATH if not there
$goBinPath = "$env:USERPROFILE\go\bin"
if ($env:PATH -notlike "*$goBinPath*") {
$env:PATH += ";$goBinPath"
[Environment]::SetEnvironmentVariable("PATH", $env:PATH, "User")
}
# Install Go tools
$goTools = @(
@{Name = "nuclei"; Package = "github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest"},
@{Name = "subfinder"; Package = "github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest"},
@{Name = "httpx"; Package = "github.com/projectdiscovery/httpx/cmd/httpx@latest"},
@{Name = "ffuf"; Package = "github.com/ffuf/ffuf@latest"},
@{Name = "gobuster"; Package = "github.com/OJ/gobuster/v3@latest"}
)
foreach ($tool in $goTools) {
try {
Write-Status "Installing $($tool.Name)..."
go install -v $tool.Package
Write-Status "ā Installed: $($tool.Name)"
} catch {
Write-Warning "Failed to install: $($tool.Name)"
}
}
# Update Nuclei templates
try {
Write-Status "Updating Nuclei templates..."
nuclei -update-templates -silent
} catch {
Write-Warning "Failed to update Nuclei templates"
}
Write-Host ""
Write-Status "Creating directories..."
# Create necessary directories
$directories = @(
"$env:USERPROFILE\.config\mcp-pentest",
"$env:USERPROFILE\.local\share\mcp-pentest\wordlists",
"$env:USERPROFILE\.local\share\mcp-pentest\reports"
)
foreach ($dir in $directories) {
if (-not (Test-Path $dir)) {
New-Item -ItemType Directory -Path $dir -Force | Out-Null
Write-Status "Created: $dir"
}
}
Write-Host ""
Write-Status "Verification:"
# Verify installations
$tools = @("python", "git", "go", "nmap", "nuclei")
foreach ($tool in $tools) {
if (Get-Command $tool -ErrorAction SilentlyContinue) {
Write-Status "ā $tool is available"
} else {
Write-Warning "ā $tool is NOT available"
}
}
Write-Host ""
Write-Host "š Installation completed!" -ForegroundColor Cyan
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Yellow
Write-Host "1. Restart PowerShell to ensure PATH changes take effect"
Write-Host "2. Run: npm install"
Write-Host "3. Run: npm run build"
Write-Host "4. Test with: nuclei -version"
Write-Host ""
Write-Warning "Remember: Only use these tools on systems you own or have permission to test!"