-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
SOCFortress
authored
Aug 9, 2022
1 parent
5145ce2
commit 9360cb7
Showing
1 changed file
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
################################ | ||
########## | ||
# Script execution triggered by Wazuh Manager, wodles-command | ||
# Output converted to JSON and appended to active-responses.log | ||
########## | ||
# RUN LOGONSESSIONS AND STORE CSV | ||
$Sessions_Output_CSV = c:\"Program Files"\Sysinternals\logonsessions.exe -nobanner -c -p | ||
# REMOVE SPACES IN CSV HEADER AND CONVERT TO ARRAY | ||
$Sessions_Output_Array = $Sessions_Output_CSV.PSObject.BaseObject.Trim(' ') -Replace '\s','' | ConvertFrom-Csv | ||
# GO THRU THE ARRAY, CONVERT TO JSON AND APPEND TO active-responses.log | ||
Foreach ($item in $Sessions_Output_Array) { | ||
echo $item | ConvertTo-Json -Compress | Out-File -width 2000 C:\"Program Files (x86)"\ossec-agent\active-response\active-responses.log -Append -Encoding ascii | ||
} |