diff --git a/PowerHuntShares.psm1 b/PowerHuntShares.psm1
index fb8640a..49d8f12 100644
--- a/PowerHuntShares.psm1
+++ b/PowerHuntShares.psm1
@@ -4,7 +4,7 @@
#--------------------------------------
# Author: Scott Sutherland, 2024 NetSPI
# License: 3-clause BSD
-# Version: v1.105
+# Version: v1.106
# References: This script includes custom code and code taken and modified from the open source projects PowerView, Invoke-Ping, and Invoke-Parrell.
function Invoke-HuntSMBShares
{
@@ -1804,10 +1804,6 @@ function Invoke-HuntSMBShares
# ----------------------------------------------------------------------
# Calculate risk score per acl - ace insights
# ----------------------------------------------------------------------
- # add interesting file flags
- # add risk score
- # create table for later use
- # output table to file
# foreach acl update the record
$ExcessiveSharePrivsFinal = $ExcessiveSharePrivs |
@@ -2128,8 +2124,78 @@ function Invoke-HuntSMBShares
$UniqueFileSystemRightsSeries = "[" + ($UniqueFileSystemRightsCounts -replace(" ",",")) + "]"
$UniqueFileSystemRightsSeries = $UniqueFileSystemRightsSeries -replace(" ",",")
+
# ----------------------------------------------------------------------
- # Create Computer Insight Summary Information
+ # Create Identity Insights Summary Information
+ # ----------------------------------------------------------------------
+
+ # Get share owners
+ [array]$IdentityOwnerList = $ExcessiveSharePrivsFinal | select ShareOwner -Unique -ExpandProperty ShareOwner
+ $IdentityOwnerListCount = $IdentityOwnerList | measure | select count -ExpandProperty count
+
+ # Get identity references
+ [array]$IdentityReferenceList = $ExcessiveSharePrivsFinal | select IdentityReference -Unique -ExpandProperty IdentityReference
+ $IdentityReferenceListCount = $IdentityReferenceList | measure | select count -ExpandProperty count
+
+ # Combine identity lists
+ $IdentityCombinedList = $IdentityOwnerList + $IdentityReferenceList | sort | select -Unique
+ $IdentityCombinedListCount = $IdentityCombinedList | measure | select count -ExpandProperty count
+
+ # Process each identity
+ $IdentityTableRows = $IdentityCombinedList |
+ foreach {
+
+ # Set target identity
+ $TargetIdentity = $_
+
+ # Get share owner count
+ $TargetIdentityOwnerCount = $ExcessiveSharePrivsFinal | where ShareOwner -eq "$TargetIdentity" | select SharePath | measure | select count -ExpandProperty count
+
+ # Get share access count
+ $TargetIdentityShareAccessCount = $ExcessiveSharePrivsFinal | where IdentityReference -eq "$TargetIdentity" | select SharePath -Unique | measure | select count -ExpandProperty count
+ $TargetIdentityShareAccess = $ExcessiveSharePrivsFinal | where IdentityReference -eq "$TargetIdentity" | select SharePath -Unique -ExpandProperty SharePath | ForEach-Object { $ASDF = $_; "$ASDF
" } | Out-String
+
+ # Get ACE low risk
+ $TargetIdentityLowRiskCount = $ExcessiveSharePrivsFinal | where IdentityReference -eq "$TargetIdentity" | where RiskLevel -eq "Low" | select SharePath -Unique |measure | select count -ExpandProperty count
+ #$TargetIdentityLowRisk = $ExcessiveSharePrivsFinal | where IdentityReference -eq "$TargetIdentity" | where RiskLevel -eq "Low" | select SharePath -Unique | ForEach-Object { $ASDF = $_; "$ASDF
" } | Out-String
+
+ # Get ACE medium risk
+ $TargetIdentityMediumRiskrCount = $ExcessiveSharePrivsFinal | where IdentityReference -eq "$TargetIdentity" | where RiskLevel -eq "Medium" | select SharePath -Unique | measure | select count -ExpandProperty count
+ #$TargetIdentityMediumRisk = $ExcessiveSharePrivsFinal | where IdentityReference -eq "$TargetIdentity" | where RiskLevel -eq "Medium" | select SharePath -Unique | ForEach-Object { $ASDF = $_; "$ASDF
" } | Out-String
+
+ # Get ACE high risk
+ $TargetIdentityHighRiskCount = $ExcessiveSharePrivsFinal | where IdentityReference -eq "$TargetIdentity" | where RiskLevel -eq "High" | select SharePath -Unique | measure | select count -ExpandProperty count
+ #$TargetIdentityHighRisk = $ExcessiveSharePrivsFinal | where IdentityReference -eq "$TargetIdentity" | where RiskLevel -eq "High" | select SharePath -Unique | ForEach-Object { $ASDF = $_; "$ASDF
" } | Out-String
+
+ # Get ACE critical risk
+ $TargetIdentityCriticalRiskCount = $ExcessiveSharePrivsFinal | where IdentityReference -eq "$TargetIdentity" | where RiskLevel -eq "Critical" | select SharePath -Unique | measure | select count -ExpandProperty count
+ #$TargetIdentityCriticalRisk = $ExcessiveSharePrivsFinal | where IdentityReference -eq "$TargetIdentity" | where RiskLevel -eq "Critical" | select SharePath -Unique | ForEach-Object { $ASDF = $_; "$ASDF
" } | Out-String
+
+ # Get interesting files count (same as share names)
+ $TargetIdentityInterestingFiles = "tbd"
+
+ $BuildIdentityTableRows = @"
+
Identity | +Owned Shares | +Accessible Shares | +Low Risk Shares | +Medium Risk Shares | +High Risk Shares | +Critical Risk Shares | + +
---|