Skip to content

Commit f7043e6

Browse files
authored
Merge pull request #31 from LuccaSA/refactor
add new option
2 parents 47f0232 + ef07cd3 commit f7043e6

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ PRINT_CURRENT_RESULT=1
2525
# Set to 1 to enable ANSSI maturity level display, 0 to disable
2626
ANSSI_LVL=0
2727

28+
# Notify when no changes
29+
NOTIFY_WHEN_NO_CHANGES=1
30+
2831
# Domain Configuration
2932
# If not set, will use $env:USERDNSDOMAIN
3033
DOMAIN=

Initial-deploy.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ Function Show-FinalInstructions {
404404
Write-Host "Additional configuration options in .env:" -ForegroundColor Cyan
405405
Write-Host " • PRINT_CURRENT_RESULT: Set to 1 to include all flagged rules in notifications" -ForegroundColor White
406406
Write-Host " • ANSSI_LVL: Set to 1 to enable ANSSI compliance level reporting" -ForegroundColor White
407+
Write-Host " • NOTIFY_WHEN_NO_CHANGES: Set to 1 to enable a report even if nothing change between two scan" -ForegroundColor White
407408
Write-Host ""
408409

409410
Write-Host "Next steps:" -ForegroundColor Green

PingCastle-Notify.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- add -noscan option to skip PingCastle scan
2424
- add -full_report option to force full report
2525
- add anssi rules link
26+
- add notify when no changes option
2627
date: 08/08/2025
2728
version: 2.0
2829
#>
@@ -189,6 +190,7 @@ $domainSuffix = if ($envVars["DOMAIN"] ) { $envVars["DOMAIN"] } else {
189190
($env:USERDNSDOMAIN).ToLower()
190191
}
191192
$anssi_lvl_enabled = if ($envVars["ANSSI_LVL"]) { [int]$envVars["ANSSI_LVL"] } else { 0 }
193+
$notify_when_no_changes = if ($envVars["NOTIFY_WHEN_NO_CHANGES"]) { [int]$envVars["NOTIFY_WHEN_NO_CHANGES"] } else { 0 }
192194

193195
#region Variable
194196
$ApplicationName = 'PingCastle'
@@ -701,10 +703,10 @@ if (-not ($old_report.FullName)) {
701703
# write message regarding previous score
702704
if ([int]$previous_score -eq [int]$total_point -and (IsEqual $StaleObjects_old $StaleObjects) -and (IsEqual $PrivilegedAccounts_old $PrivilegedAccounts) -and (IsEqual $Anomalies_old $Anomalies) -and (IsEqual $Trusts_old $Trusts)) {
703705
if ($addedVuln -or $removedVuln -or $warningVuln) {
704-
$sentNotification = $True
706+
$sentNotification = $true
705707
$connectorBodies = Update-ConnectorsStatus $connectorBodies "There is no new vulnerability yet some rules have changed !"
706708
} else {
707-
$sentNotification = $False
709+
$sentNotification = if ($notify_when_no_changes -eq 1) { $true } else { $false }
708710
$connectorBodies = Update-ConnectorsStatus $connectorBodies "There is no new vulnerability ! :tada:"
709711
}
710712
} elseIf ([int]$previous_score -lt [int]$total_point) {

0 commit comments

Comments
 (0)