Christian. Thank you very much for your help! I replaced the original decoder with a customized decoder. Then when I do a check with this log I do see srcip.
But nothing has actually changed. Active-response for rule id 60204 does not work.
.
for this script`s.
:: Simple script to run Windows Firewall Block
:: The script executes a powershell script and appends output.
@ECHO OFF
ECHO.
"C:\Program Files\PowerShell\7\"pwsh.exe -executionpolicy ByPass -File "C:\Program Files (x86)\ossec-agent\active-response\bin\windowsfirewall.ps1"
:Exit
windowsfirewall.ps1################################
##Script to add/remove destination ip to windows firewall
################################
##########
##@
opensecure.co##########
# Read the Alert that triggered the Active Response in manager and convert to Array
$INPUT_JSON = Read-Host
$INPUT_ARRAY = $INPUT_JSON | ConvertFrom-Json
$INPUT_ARRAY = $INPUT_ARRAY | ConvertFrom-Json
$ErrorActionPreference = "SilentlyContinue"
$command = $INPUT_ARRAY."command"
$hostip = (Get-WmiObject -Class Win32_NetworkAdapterConfiguration | where {$_.DHCPEnabled -ne $null -and $_.DefaultIPGateway -ne $null}).IPAddress | Select-Object -First 1
$destinationip = $INPUT_ARRAY."parameters"."alert".
"data"."win"."eventdata"."ipAddress" <!-- These fields changed for ip -->#Add Destination IP to Windows Firewall
if ( $command -eq 'add' -AND $destinationip -ne '127.0.0.1' -And $destinationip -ne '0.0.0.0' -And $destinationip -ne $hostip )
{
New-NetFirewallRule -DisplayName "Wazuh Active Response - $destinationip" -Direction Inbound –LocalPort Any -Protocol Any -Action Block -RemoteAddress $destinationip
echo "$destinationip added to blocklist via Windows Firewall" | ConvertTo-Json -Compress | Out-File -width 2000 C:\"Program Files (x86)"\ossec-agent\active-response\active-responses.log -Append -Encoding ascii
}
#Remove Destination IP from Windows Firewall
if ( $command -eq 'delete' -AND $destinationip -ne '127.0.0.1' -And $destinationip -ne '0.0.0.0' -And $destinationip -ne $hostip )
{
Remove-NetFirewallRule -DisplayName "Wazuh Active Response - $destinationip"
echo "$destinationip removed to blocklist via Windows Firewall" | ConvertTo-Json -Compress | Out-File -width 2000 C:\"Program Files (x86)"\ossec-agent\active-response\active-responses.log -Append -Encoding ascii
}