From c4b4e9471a4cb108a8e561d32e2e530433afede7 Mon Sep 17 00:00:00 2001 From: Scott Sutherland Date: Thu, 12 Sep 2024 16:21:40 -0500 Subject: [PATCH] Update Analyze-HuntSMBShares.ps1 Added sankey chart. --- Scripts/Analyze-HuntSMBShares.ps1 | 163 +++++++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 1 deletion(-) diff --git a/Scripts/Analyze-HuntSMBShares.ps1 b/Scripts/Analyze-HuntSMBShares.ps1 index 25777fd..e77c800 100644 --- a/Scripts/Analyze-HuntSMBShares.ps1 +++ b/Scripts/Analyze-HuntSMBShares.ps1 @@ -5,7 +5,7 @@ #-------------------------------------- # Author: Scott Sutherland, 2024 NetSPI # License: 3-clause BSD -# Version: v1.85 +# Version: v1.86 # References: This script includes custom code and code taken and modified from the open source projects PowerView, Invoke-Ping, and Invoke-Parrell. function Analyze-HuntSMBShares { @@ -2079,6 +2079,67 @@ function Analyze-HuntSMBShares }else{ $RemediationSavings = $RemediationSaveSnP } + + # ---------------------------------------------------------------------- + # Generate Sankey Summary C H M L + # ---------------------------------------------------------------------- + + # Create critical edge + if($RiskLevelCountCritical -gt 0){ + $SanKeyCritical = @" + { + source: 'ACEs ($ExcessiveSharePrivsCount)', + target: 'Critical ($RiskLevelCountCritical)', + value: $RiskLevelCountCritical, + color: '#93E6C4', // Custom color for this edge + }, +"@ + }else{ + $SanKeyCrtiical = "" + } + + # Create high edge + if($RiskLevelCountHigh -gt 0){ + $SanKeyHigh = @" + { + source: 'ACEs ($ExcessiveSharePrivsCount)', + target: 'High ($RiskLevelCountHigh)', + value: $RiskLevelCountHigh, + color: '#FB897C', // Custom color for this edge + }, +"@ + }else{ + $SanKeyHigh = "" + } + + # Create medium edge + if($RiskLevelCountMedium -gt 0){ + $SanKeyMedium = @" + { + source: 'ACEs ($ExcessiveSharePrivsCount)', + target: 'Medium ($RiskLevelCountMedium)', + value: $RiskLevelCountMedium, + color: '#FDAC70', // Custom color for this edge + }, +"@ + }else{ + $SanKeyMedium = "" + } + + # Create low edge + if($RiskLevelCountLow -gt 0){ + $SanKeyLow = @" + { + source: 'ACEs ($ExcessiveSharePrivsCount)', + target: 'Low ($RiskLevelCountLow)', + value: $RiskLevelCountLow, + color: '#FEDA94', // Custom color for this edge + }, +"@ + }else{ + $SanKeyLow = "" + } + # ---------------------------------------------------------------------- # Create ShareGraph Nodes and Edges @@ -3522,6 +3583,7 @@ $NewHtmlReport = @" + Report