[ SEA-GHOST MINI SHELL]
Path : /proc/3/cwd/var/lib/zabbix/ |
|
Current File : //proc/3/cwd/var/lib/zabbix/nginx_vhostssl_discovery.sh |
#!/bin/bash
first=1
#echo -ne "{\n";
echo -ne "{ \"data\" : [\n";
for LINE in `dir /etc/nginx/sites-enabled/`
{
vhost=`echo ${LINE}|awk '{print $1}'`
ssl=`cat /etc/nginx/sites-enabled/$vhost 2>/dev/null| grep -v "#"| grep "listen .*:443.*" | awk '{print $2}'| head -n 1|sed 's/;//g'`
if [ ! -z "$ssl" ]; then
if [ $ssl == "*:443" ]; then
ssl="127.0.0.1:443"
fi
domain=`cat /etc/nginx/sites-enabled/$vhost |grep "server_name"|sed 's/server_name//g;s/^[ \t]*//;s/[ \t]*$//;s/;//g'| awk '{print $1}' | head -n 1`
if [ $first == 0 ]; then echo -ne ",\n";
fi
first=0
echo -ne "{"
echo -ne " \"{#DOMAIN}\" : \"$domain\" , \"{#BACKIP}\" : \"$ssl\" ";
echo -ne " }"
fi
}
echo -ne " ]";
echo -ne " }\n";
SEA-GHOST - SHELL CODING BY SEA-GHOST