root / plugins / ossec / ossec-active-response @ e5ce7492
Historique | Voir | Annoter | Télécharger (1,48 ko)
| 1 | d19c429a | Ankush Grover | |
|---|---|---|---|
| 2 | # /bin/ sh |
||
| 3 | # |
||
| 4 | if [ "$1" = "autoconf" ] ; then |
||
| 5 | |||
| 6 | echo "yes" |
||
| 7 | # |
||
| 8 | exit 0 |
||
| 9 | # |
||
| 10 | fi |
||
| 11 | # |
||
| 12 | # |
||
| 13 | logdir="/var/ossec/logs/" |
||
| 14 | if [ "$1" = "config" ] ; then |
||
| 15 | # |
||
| 16 | echo "graph_title Active Response" |
||
| 17 | # |
||
| 18 | echo "graph_args --base 1000 -l 0 " |
||
| 19 | # |
||
| 20 | echo "graph_vlabel Number of active response" |
||
| 21 | # |
||
| 22 | echo "graph_category Ossec" |
||
| 23 | # |
||
| 24 | echo "graph_scale no" |
||
| 25 | # |
||
| 26 | echo "c_add_actions.label Number of Rules added" |
||
| 27 | # |
||
| 28 | echo "c_add_actions.draw LINE2" |
||
| 29 | # |
||
| 30 | echo 'c_add_actions.min 0' |
||
| 31 | # |
||
| 32 | echo "c_del_actions.label Number of Rules deleted" |
||
| 33 | # |
||
| 34 | echo "c_del_actions.draw LINE2" |
||
| 35 | # |
||
| 36 | echo 'c_del_actions.min 0' |
||
| 37 | # |
||
| 38 | exit 0 |
||
| 39 | # |
||
| 40 | fi |
||
| 41 | # |
||
| 42 | # |
||
| 43 | |||
| 44 | |||
| 45 | ####Deleting the temporary logs files ########## |
||
| 46 | rm -fr /tmp/ossecactive* |
||
| 47 | |||
| 48 | |||
| 49 | ###For Loop for grepping the last 5 mins logs and moving it to the /tmp |
||
| 50 | |||
| 51 | month="$(date "+%b")"; time="$(date "+%d")";year="$(date "+%Y")"; |
||
| 52 | if [ "$time" -le "9" ]; then |
||
| 53 | search1="$month $time" |
||
| 54 | else |
||
| 55 | search1="$month $time" |
||
| 56 | fi |
||
| 57 | |||
| 58 | #search1="$month $time" |
||
| 59 | #echo "$search1" |
||
| 60 | for (( i = 5; i>=0; i-- )) ; do grep $(date "+%R" -d "-$i min") /var/ossec/logs/active-responses.log | grep "$search1" | grep "$year" >> /tmp/ossecactive.log;done |
||
| 61 | |||
| 62 | |||
| 63 | #############Fore Loop Ends########## |
||
| 64 | |||
| 65 | ####Grepping the Hosts Blocked in last 5 mins########### |
||
| 66 | NB_ADD=`cat /tmp/ossecactive.log| grep add | wc -l` |
||
| 67 | |||
| 68 | ###########Grepping the Hosts Removed from the blocked list in last 5 mins############ |
||
| 69 | |||
| 70 | NB_DEL=`cat /tmp/ossecactive.log | grep del | wc -l` |
||
| 71 | # |
||
| 72 | # |
||
| 73 | |||
| 74 | ############Displaying the VALUES############# |
||
| 75 | echo "c_add_actions.value ${NB_ADD}"
|
||
| 76 | # |
||
| 77 | echo "c_del_actions.value ${NB_DEL}" #
|
||
| 78 | # |
||
| 79 | exit 0 |
