[ SEA-GHOST MINI SHELL]
Path : /proc/3/cwd/var/lib/zabbix/ |
|
Current File : //proc/3/cwd/var/lib/zabbix/apache_docroot_discovery.sh |
#!/bin/bash
first=1
for LINE in `dir /etc/apache2/sites-enabled/`
{
vhost=`echo ${LINE}|awk '{print $1}'`
ssl=`cat /etc/apache2/sites-enabled/$vhost | grep "<VirtualHost .*:443"| awk '{print $2}'|sed 's/>//g'`
docroot=`cat /etc/apache2/sites-enabled/$vhost | grep "DocumentRoot .*"| awk '{print $2}'`
if [ ! -z "$ssl" ]; then
if [ $first == 0 ]; then echo -ne ",\n";
fi
list+=$(echo "${docroot} ")
fi
}
dirlist=$(echo "${list}" | tr ' ' '\n'| sort | uniq)
echo -ne "{ \"data\" : [\n";
for line in ${dirlist}
do
if [ ! -z "$line" ]; then
if [ $first == 0 ]; then echo -ne ",\n";
fi
first=0
echo -ne "{"
echo -ne " \"{#DOCROOT}\" : \"$line\" ";
echo -ne " }"
fi
done
echo -ne " ]";
echo -ne " }";
SEA-GHOST - SHELL CODING BY SEA-GHOST