forked from branchnetconsulting/wazuh-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
show-wazuh-rule
24 lines (20 loc) · 872 Bytes
/
show-wazuh-rule
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
#
# show-wazuh-rule [rule_id]
# by Kevin Branch, and greatly improved by Facundo Orsi
#
# Use this to find and display the full Wazuh rule identified by rule_id. It wi ll search through both stock and custom rules.
#
echo
ID=$1
FILES=`grep "id=\"$ID\"" /var/ossec/ruleset/rules/*.xml /var/ossec/etc/rules/*. xml -l`
if [ ! -z "$FILES" ];then
for F in $FILES; do
echo $F":"
echo
grep -Pzo "[ |\t]*<rule id=\"$ID\" .*(.|\n)*?</rule>" $F -h
echo -ne "\n"
done
else
echo "Rule $ID not found"
fi