Skip to content

Commit

Permalink
Merge pull request #45 from f-bader/bugfix/44
Browse files Browse the repository at this point in the history
Add additional check if subTechnique already exists
  • Loading branch information
f-bader authored Jan 20, 2025
2 parents 2f830cc + 5db240b commit b5e508c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ This way the following KQL query will be converted...

## Changelog

### 2.4.4
* FIX: Duplicated MITRE subTechniques in rare cases

### 2.4.3
* FIX: Fix upstream issues with [powershell-yaml](https://github.com/cloudbase/powershell-yaml)

### 2.4.2
* FIX: Arm to YAML used `techniques` instead of `relevantTechniques`

Expand Down
2 changes: 1 addition & 1 deletion src/SentinelARConverter.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'SentinelARConverter.psm1'

# Version number of this module.
ModuleVersion = '2.4.3'
ModuleVersion = '2.4.4'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
9 changes: 6 additions & 3 deletions src/public/Convert-SentinelARArmToYaml.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,14 @@ function Convert-SentinelARArmToYaml {
if ( -not $AnalyticsRuleCleaned.Contains($KeyName) ) {
$AnalyticsRuleCleaned.Add($KeyName, @())
}
# Add subTechnique if the mainTechnique is not already present
if (-not($AnalyticsRuleCleaned[$KeyName].contains($technique))) {

if ( $AnalyticsRuleCleaned[$KeyName].contains($value) ) {
# Do nothing if subTechnique is already present
} elseif (-not($AnalyticsRuleCleaned[$KeyName].contains($technique))) {
# Add subTechnique if the mainTechnique is not already present
$AnalyticsRuleCleaned[$KeyName] += $value
# Replace mainTechnique with subTechnique
} else {
# Replace mainTechnique with subTechnique
$AnalyticsRuleCleaned[$KeyName][$AnalyticsRuleCleaned[$KeyName].indexOf($technique)] = $value
}
}
Expand Down

0 comments on commit b5e508c

Please sign in to comment.