diff --git a/Login_Monitor.ps1 b/Login_Monitor.ps1 index 67070fd..99e9afa 100644 --- a/Login_Monitor.ps1 +++ b/Login_Monitor.ps1 @@ -80,7 +80,7 @@ $script:MonitorLoopInitialized = $false # строки ниже, если правки «мелкие» и вы не хотите менять отображаемую версию в логах). # Рекомендация: при значимых релизах меняйте и $ScriptVersion, и version.txt одинаково; при только # исправлениях на шаре — достаточно поднять patch в version.txt (например 1.3.0.1). -$ScriptVersion = "1.2.27-SAC" +$ScriptVersion = "1.2.28-SAC" # Логи (все под InstallRoot) $LogFile = Join-Path $script:InstallRoot "Logs\login_monitor.log" @@ -1638,6 +1638,22 @@ function Get-DailyReportAuthStats24h { } } +function Expand-DailyReportActiveUserEntries { + param([string[]]$Entries) + $out = [System.Collections.Generic.List[string]]::new() + foreach ($e in @($Entries)) { + if ([string]::IsNullOrWhiteSpace($e)) { continue } + $parts = [regex]::Split($e.Trim(), '(?=👤)') + foreach ($p in $parts) { + $p = $p.Trim() + if ([string]::IsNullOrWhiteSpace($p)) { continue } + if (-not $p.StartsWith('👤')) { $p = "👤 $p" } + [void]$out.Add($p) + } + } + return ,@($out) +} + function Get-DailyReportActiveUsersFromQuser { $lines = [System.Collections.Generic.List[string]]::new() $quserExe = Join-Path $env:SystemRoot 'System32\quser.exe' @@ -1674,6 +1690,7 @@ function Build-DailyReportPlainBodyWindows { $top = @($Stats.top_failed_ips) $sb = [System.Text.StringBuilder]::new() [void]$sb.AppendLine('📊 ЕЖЕДНЕВНЫЙ ОТЧЕТ МОНИТОРИНГА WINDOWS') + [void]$sb.AppendLine("Agent version $ScriptVersion") [void]$sb.AppendLine("🖥️ Сервер: $server") [void]$sb.AppendLine("🕐 Время отчета: $timeStr") [void]$sb.AppendLine('') @@ -2809,7 +2826,7 @@ function Send-DailyReport { try { $reportTime = Get-Date $stats = Get-DailyReportAuthStats24h - $activeUsers = @(Get-DailyReportActiveUsersFromQuser) + $activeUsers = Expand-DailyReportActiveUserEntries -Entries @(Get-DailyReportActiveUsersFromQuser) $plainBody = Build-DailyReportPlainBodyWindows -Stats $stats -ActiveUsers $activeUsers -ReportTime $reportTime $telegramMessage = Convert-DailyReportPlainToTelegramHtml -PlainBody $plainBody diff --git a/README.md b/README.md index 9d13ae8..d6b6513 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ PowerShell-набор для мониторинга входов в Windows с - Документация по развёртыванию: **[Docs/README.md](Docs/README.md)** (RDP-монитор, Exchange, NETLOGON). - **`Encrypt-DpapiForRdpMonitor.ps1`** — опционально для подготовки DPAPI-строк токена/chat id и пароля SMTP (`$MailSmtpPasswordProtectedB64` в файле настроек). - **Локальные настройки RDP-монитора:** **`login_monitor.settings.ps1`** в каталоге установки (образец **`login_monitor.settings.example.ps1`**). При автообновлении **`Login_Monitor.ps1`** с шары файл настроек **не перезаписывается** (как **`exchange_monitor.settings.ps1`** для Exchange). -- **Security Alert Center (SAC):** модуль **`Sac-Client.ps1`** (копируется вместе с `Login_Monitor.ps1`). Режимы **`$UseSAC`**: `off` | `exclusive` | `dual` | `fallback` — контракт в репозитории **security-alert-center** (`docs/agent-integration.md`). Версия релиза: **`$ScriptVersion`** и **`version.txt`** (сейчас **1.2.27-SAC**); **`Sac-Client.ps1`** передаёт ту же версию в SAC (`product_version`). +- **Security Alert Center (SAC):** модуль **`Sac-Client.ps1`** (копируется вместе с `Login_Monitor.ps1`). Режимы **`$UseSAC`**: `off` | `exclusive` | `dual` | `fallback` — контракт в репозитории **security-alert-center** (`docs/agent-integration.md`). Версия релиза: **`$ScriptVersion`** и **`version.txt`** (сейчас **1.2.28-SAC**); **`Sac-Client.ps1`** передаёт ту же версию в SAC (`product_version`). ## Что изменилось (важное) diff --git a/version.txt b/version.txt index 50d6825..54c18bf 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.2.27-SAC +1.2.28-SAC