Created
September 25, 2015 16:14
-
-
Save rushipkar90/ef321bf299dcf6fe805c to your computer and use it in GitHub Desktop.
modsecuritycheck.sh
This file contains hidden or 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
#/bin/bash | |
read -p "Enter the IP address/domain : " prompt | |
konta=`find /usr/local/apache/logs -name "error_*" -mtime -1 | grep -v "gz"` | |
for i in $konta ; do | |
echo $i; | |
grep Security "$i" | grep $prompt > /usr/local/src/mod_security.txt; | |
total=`cat /usr/local/src/mod_security.txt | wc -l`; | |
#results=`cat $i | grep Security | grep $prompt` | |
#echo $results; | |
echo $total | |
if [ $total -ne 0 ]; then | |
cat /usr/local/src/mod_security.txt; | |
else | |
echo "Check old logs" | |
konta1=`find /usr/local/apache/logs -name "error_*" -mtime -1 | grep -w "gz"` | |
for j in $konta1 ; do | |
{ | |
zcat $j | grep Security | grep $prompt > /usr/local/src/mod_security.txt; | |
cat /usr/local/src/mod_security.txt; | |
} | |
done; | |
#else | |
#for l in `cat /usr/local/src/mod_security.txt`; do | |
#echo $l; | |
#done; | |
#cat /usr/local/src/mod_security.txt; | |
fi | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment