From 57a0e6e7c805fcfd306a8e7c74dd90e883e5a88a Mon Sep 17 00:00:00 2001 From: giveen Date: Sun, 11 Jan 2026 20:43:22 -0700 Subject: [PATCH] chore: add PowerShell installer for vendored HexStrike deps; call from setup.ps1 --- scripts/install_hexstrike_deps.ps1 | 45 ++++++++++++++++++++++++++++++ scripts/setup.ps1 | 11 ++++++++ 2 files changed, 56 insertions(+) create mode 100644 scripts/install_hexstrike_deps.ps1 diff --git a/scripts/install_hexstrike_deps.ps1 b/scripts/install_hexstrike_deps.ps1 new file mode 100644 index 0000000..68bc45a --- /dev/null +++ b/scripts/install_hexstrike_deps.ps1 @@ -0,0 +1,45 @@ +<# +Install vendored HexStrike Python dependencies (Windows/PowerShell). + +This mirrors `scripts/install_hexstrike_deps.sh` for Windows users. +#> +Set-StrictMode -Version Latest + +Write-Host "Installing vendored HexStrike dependencies (Windows)..." + +# Load .env if present (simple parser: ignore comments/blank lines) +if (Test-Path -Path ".env") { + Write-Host "Sourcing .env" + Get-Content .env | ForEach-Object { + $line = $_.Trim() + if ($line -and -not $line.StartsWith("#") -and $line.Contains("=")) { + $parts = $line -split "=", 2 + $name = $parts[0].Trim() + $value = $parts[1].Trim() + # Only set if not empty + if ($name) { $env:$name = $value } + } + } +} + +$req = Join-Path -Path (Get-Location) -ChildPath "third_party/hexstrike/requirements.txt" + +if (-not (Test-Path -Path $req)) { + Write-Host "Cannot find $req. Is the HexStrike subtree present?" -ForegroundColor Yellow + exit 1 +} + +# Prefer venv python if present +$python = "python" +if (Test-Path -Path ".\venv\Scripts\python.exe") { + $python = Join-Path -Path (Get-Location) -ChildPath ".\venv\Scripts\python.exe" +} + +Write-Host "Using Python: $python" + +& $python -m pip install --upgrade pip +& $python -m pip install -r $req + +Write-Host "HexStrike dependencies installed. Note: many external tools are not included and must be installed separately as described in third_party/hexstrike/requirements.txt." -ForegroundColor Green + +exit 0 diff --git a/scripts/setup.ps1 b/scripts/setup.ps1 index e3f5e2b..d9579d3 100644 --- a/scripts/setup.ps1 +++ b/scripts/setup.ps1 @@ -95,6 +95,17 @@ PENTESTAGENT_DEBUG=false New-Item -ItemType Directory -Force -Path "loot" | Out-Null Write-Host "[OK] Loot directory created" +# Install vendored HexStrike dependencies automatically if present +$hexReq = Join-Path -Path (Get-Location) -ChildPath "third_party/hexstrike/requirements.txt" +if (Test-Path -Path $hexReq) { + Write-Host "Installing vendored HexStrike dependencies..." + try { + & .\scripts\install_hexstrike_deps.ps1 + } catch { + Write-Host "Warning: Failed to install HexStrike deps: $($_.Exception.Message)" -ForegroundColor Yellow + } +} + Write-Host "" Write-Host "Setup complete!" Write-Host ""