Hi All
I have script that find 777 dir with specific extension like .php .Now after finding all 777 directory i will place in httpd.conf using a directory directive ,Now i was not do that,if directory entry exitst in httpd.conf then script ignor it dont show me at stdout else if it dont find directory entry in httpd.cong then alert me at stdout.I hope you understand what i mean below is my code take a look
For example this is in httpd.conf
<Directory "/var/www/html/abc">
some thing
</Directory>
<Directory "/var/www/html/xyz">
some thing
</Directory>
#!/bin/bash
check=/var/www/html
tail -n +993 /etc/httpd/conf/httpd.conf | grep -H "Directory" | awk -F" " '{ print $3 }' | sed 's/[">]//g' >> file.apache
while read line
do
find $check -type d -perm /o=w | while read DIR
do
if [ "$line" != "$DIR" ]
echo "$line"
then
test=$(cd "$DIR"; ls -A *.php *.php3 2>/dev/null | wc -l)
if [ "$test" != "0" ]
then
inject1="Bad Apache Dir ${DIR} $test"
echo $inject1
fi
fi
done
done < "file.apache"