Skip to content

Commit

Permalink
Merge pull request #90 from akunzai/fix-dsa-dection
Browse files Browse the repository at this point in the history
Fix detection for Trend Micro Deep Security Agent
  • Loading branch information
akunzai authored Apr 12, 2023
2 parents a2319f9 + 55aae65 commit 2bf0d8a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ git pull
Sample output

````markdown
# Windows Secure Auditor: 1.2.0
# Windows Secure Auditor: 1.2.1

## System Information

Expand Down
2 changes: 1 addition & 1 deletion README.zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ git pull
範例輸出

````markdown
# Windows Secure Auditor: 1.2.0
# Windows Secure Auditor: 1.2.1

## 系統資訊

Expand Down
2 changes: 1 addition & 1 deletion SecureAuditor.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# RootModule = ''

# Version number of this module.
ModuleVersion = '1.2.0'
ModuleVersion = '1.2.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
36 changes: 20 additions & 16 deletions rules/Antivirus.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ function Test($config) {
$osInfo = Get-CimInstance -ClassName Win32_OperatingSystem
if ($osInfo.ProductType -ne 1) {
# Windows Server

# ESET Endpoint Security
# https://help.eset.com/efsw/9.0/en-US/work_wmi_provider_data.html
$product = Get-CimInstance -Namespace root/ESET -ClassName ESET_Product -ErrorAction SilentlyContinue
if ($null -ne $product) {
Expand All @@ -35,24 +37,26 @@ function Test($config) {
}
# Trend Micro Deep Security Agent
# https://success.trendmicro.com/dcx/s/solution/1117040-checking-the-version-of-deep-security-agent-using-command-prompt
$products = Get-CimInstance -ClassName Win32_Product -Filter 'Name like "%Trend Micro%"' -ErrorAction SilentlyContinue
$dsaQuery = "$($env:ProgramFiles)\Trend Micro\Deep Security Agent\dsa_query.cmd"
if (Test-Path -Path $dsaQuery -ErrorAction SilentlyContinue -and $null -ne $products -and $products.Count -gt 0) {
$product = $products[0]
Write-CheckList $true "$($i18n.Installed): $($product.Name) $($product.Version)"
# https://help.deepsecurity.trendmicro.com/10/0/command-line-utilities.html#dsa_quer
$dsaStatus = (& $dsaQuery -c GetComponentInfo | Out-String).Trim()
$upToDate = -not [string]::IsNullOrWhiteSpace(($dsaStatus | Select-String "Component.AM.mode: on"))
$patternVersion = ($dsaStatus | Select-String 'Component.AM.version.pattern.VSAPI:')
if ([string]::IsNullOrWhiteSpace($patternVersion)) {
Write-CheckList $false "$($i18n.UpdatedStatus): $($i18n.FailedToCheckUpdateStatus)"
}
else {
$patternVersion = $patternVersion.Split(':')[1].Trim()
# https://success.trendmicro.com/dcx/s/solution/000288677
Write-CheckList $upToDate "$($i18n.UpdatedStatus): $($patternVersion)"
if (Test-Path -Path $dsaQuery -ErrorAction SilentlyContinue) {
$products = Get-CimInstance -ClassName Win32_Product -Filter 'Name like "%Trend Micro%"' -ErrorAction SilentlyContinue
if ($null -ne $products -and $products.Count -gt 0) {
$product = $products[0]
Write-CheckList $true "$($i18n.Installed): $($product.Name) $($product.Version)"
# https://help.deepsecurity.trendmicro.com/10/0/command-line-utilities.html#dsa_quer
$dsaStatus = (& $dsaQuery -c GetComponentInfo | Out-String).Trim()
$upToDate = -not [string]::IsNullOrWhiteSpace(($dsaStatus | Select-String "Component.AM.mode: on"))
$patternVersion = ($dsaStatus | Select-String 'Component.AM.version.pattern.VSAPI:')
if ([string]::IsNullOrWhiteSpace($patternVersion)) {
Write-CheckList $false "$($i18n.UpdatedStatus): $($i18n.FailedToCheckUpdateStatus)"
}
else {
$patternVersion = $patternVersion.Split(':')[1].Trim()
# https://success.trendmicro.com/dcx/s/solution/000288677
Write-CheckList $upToDate "$($i18n.UpdatedStatus): $($patternVersion)"
}
return
}
return
}
# The Microsoft Defender module was not found before Windows Server 2016
# https://www.powershellgallery.com/packages/WindowsDefender/
Expand Down

0 comments on commit 2bf0d8a

Please sign in to comment.