From 2b98968d67588789b33bfc3b5a638b522763ec4b Mon Sep 17 00:00:00 2001 From: mattdepaepezurich <107645160+mattdepaepezurich@users.noreply.github.com> Date: Wed, 21 May 2025 16:10:27 -0500 Subject: [PATCH] Update BloodHoundOperator.ps1 Added Timeout/Prefer functionality to Get-BHPath (Invoke-BHCypher / BHCypher) --- BloodHoundOperator.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/BloodHoundOperator.ps1 b/BloodHoundOperator.ps1 index b2e9b7d..79aa5e6 100644 --- a/BloodHoundOperator.ps1 +++ b/BloodHoundOperator.ps1 @@ -3485,8 +3485,9 @@ function Get-BHPath{ [Parameter(Mandatory=0)][Switch]$Cypher, [Parameter(Mandatory=0)][Switch]$NoConvert, [Parameter(Mandatory=0)][Switch]$Minimal, - [Parameter(Mandatory=0)][Alias('dot')][String]$Expand - ) + [Parameter(Mandatory=0)][Alias('dot')][String]$Expand, + [Parameter(Mandatory=0)][Alias('Prefer')][int]$Timeout +) Process{ # Source / Target if($Source -AND $Source -notmatch "^\{"){if($Source -notmatch "^\:"){$Source=":$Source"}} @@ -3521,7 +3522,7 @@ RETURN $Return$(if($OrderBy){"`r`nORDER BY $OrderBy"})$(if($Limit){"`r`nLIMIT $L Write-Verbose "[BH] POST api/v2/graphs/cypher $($CypherQ.trim())" $Body = @{query=$CypherQ;include_properties=$(-Not$Minimal)}|ConvertTo-Json - $QData = Invoke-BHAPI 'api/v2/graphs/cypher' -Method POST -Body $Body -expand $(if($NoConvert){$Expand}else{'data'}) -verbose:$False + $QData = Invoke-BHAPI 'api/v2/graphs/cypher' -Method POST -Body $Body -expand $(if($NoConvert){$Expand}else{'data'}) -verbose:$False -Timeout:$Timeout #$QData = BHPath -Query $CypherQ.trim() -Verbose:$false #if(-Not$shortest -AND -Not$All){$QData.edges=$QData.Edges|Sort-Object {"$($_.sourceS)-$($_.Target)"} -unique} ## NoConvert