Update sites.inc
This commit is contained in:
184
inc/sites.inc
184
inc/sites.inc
@@ -610,77 +610,79 @@ SITEINFO(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${1}" == "edit" ]; then
|
if [ "${1}" == "edit" ]; then
|
||||||
if [ "${2}" == "" ]; then
|
|
||||||
echo -en "\n${idsCL[LightCyan]}Enter the site number you want to edit: ${idsCL[Default]}"
|
|
||||||
read siteid
|
|
||||||
echo
|
|
||||||
else
|
|
||||||
siteid=${2}
|
|
||||||
fi
|
|
||||||
site=${SITELIST[${siteid}]}
|
|
||||||
sitefile=${gosite}/${site}.conf
|
|
||||||
certpath=$(grep ssl_certificate_key ${sitefile})
|
|
||||||
if [ "${certpath}" != "" ]; then
|
|
||||||
ssl='Yes'
|
|
||||||
certpath=${certpath%/*}; certpath=${certpath#* }
|
|
||||||
SUBJECTNAMES=$(openssl x509 -in ${certpath}/cert.pem -noout -text|grep -oP '(?<=DNS:|IP Address:)[^,]+'|sort -uV)
|
|
||||||
CERTEXPIRE=$(date -d "$(: | openssl x509 -in ${certpath}/cert.pem -text | grep 'Not After' |awk '{print $4,$5,$7}')" '+%s');
|
|
||||||
SUBJECTNAMES=${SUBJECTNAMES//$'\n'/, }
|
|
||||||
else
|
|
||||||
ssl='-'
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$(grep include/proxy.conf ${sitefile})" != "" ]; then
|
while [ "${edit^}" != "E" ]; do
|
||||||
type='Proxy'
|
|
||||||
server=$(grep 'set $server' ${sitefile})
|
if [ "${2}" == "" ]; then
|
||||||
server=${server#*\"}; server=${server%\"*}
|
echo -en "\n${idsCL[LightCyan]}Enter the site number you want to edit: ${idsCL[Default]}"
|
||||||
scheme=$(grep 'set $forward_scheme' ${sitefile})
|
read siteid
|
||||||
scheme=${scheme##* }; scheme=${scheme%;*}
|
echo
|
||||||
port=$(grep 'set $port' ${sitefile})
|
|
||||||
port=${port##* }; port=${port%;*}
|
|
||||||
c=0; spc7=''; spct=$((${cw_spc7}-${#server})); until [ $c = ${spct} ]; do spc7="${spc7} "; c=`expr $c + 1`; done
|
|
||||||
proxyhost="${server}${spc7}:${port}"
|
|
||||||
else
|
|
||||||
type='HTTP'
|
|
||||||
proxyhost=''
|
|
||||||
fi
|
|
||||||
[ "$(grep include/hsts-support.conf ${sitefile})" != "" ] && hsts='Yes' || hsts='-'
|
|
||||||
[ "$(grep include/websocket-support.conf ${sitefile})" != "" ] && wbskt='Yes' || wbskt='-'
|
|
||||||
[ "$(grep include/block-exploits.conf ${sitefile})" != "" ] && explt='Yes' || explt='-'
|
|
||||||
[ "$(grep include/secure-access.conf ${sitefile})" != "" ] && lock='Yes' || lock='-'
|
|
||||||
f=0
|
|
||||||
until [ "${edit}" = "c" ]; do
|
|
||||||
echo -e "\033[K${idsCL[White]}0) Site Address: ${idsCL[Cyan]}${idsST[Bold]}${site}${idsST[Reset]}"
|
|
||||||
echo -e "\033[K${idsCL[White]}1) Site Type: ${idsCL[Cyan]}${idsST[Bold]}${type}${idsST[Reset]}"
|
|
||||||
echo -e "\033[K${idsCL[White]}2) SSL Secure: ${idsCL[Cyan]}${idsST[Bold]}${ssl}${idsST[Reset]} - ${idsCL[LightCyan]}(${SUBJECTNAMES})"
|
|
||||||
echo -e "\033[K${idsCL[White]}3) HSTS Enabled ${idsCL[Cyan]}${idsST[Bold]}${hsts}${idsST[Reset]}"
|
|
||||||
echo -e "\033[K${idsCL[White]}4) Web Sockets: ${idsCL[Cyan]}${idsST[Bold]}${wbskt}${idsST[Reset]}"
|
|
||||||
echo -e "\033[K${idsCL[White]}5) Exploits Block: ${idsCL[Cyan]}${idsST[Bold]}${explt}${idsST[Reset]}"
|
|
||||||
echo -e "\033[K${idsCL[White]}6) Secured Access: ${idsCL[Cyan]}${idsST[Bold]}${lock}${idsST[Reset]}"
|
|
||||||
if [ "${type}" == "Proxy" ]; then
|
|
||||||
echo -e "\033[K${idsCL[White]}7) Proxy Address: ${idsCL[Cyan]}${idsST[Bold]}${server}${idsST[Reset]}"
|
|
||||||
echo -e "\033[K${idsCL[White]}8) Proxy Scheme: ${idsCL[Cyan]}${idsST[Bold]}${scheme}${idsST[Reset]}"
|
|
||||||
echo -e "\033[K${idsCL[White]}9) Proxy Port: ${idsCL[Cyan]}${idsST[Bold]}${port}${idsST[Reset]}"
|
|
||||||
else
|
else
|
||||||
echo -e "\033[K"
|
siteid=${2}
|
||||||
echo -e "\033[K"
|
|
||||||
echo -e "\033[K"
|
|
||||||
fi
|
fi
|
||||||
if [ "${edit}" != "s" ]; then
|
site=${SITELIST[${siteid}]}
|
||||||
if [ $f -eq 0 ]; then
|
sitefile=${gosite}/${site}.conf
|
||||||
echo -e "\033[K"
|
certpath=$(grep ssl_certificate_key ${sitefile})
|
||||||
echo -e "\033[K"
|
if [ "${certpath}" != "" ]; then
|
||||||
echo -e "\033[K (${idsCL[Green]}s${idsCL[Default]})ave, (${idsCL[Red]}c${idsCL[Default]})ancel, (${idsCL[Green]}e${idsCL[Default]})xit"
|
ssl='Yes'
|
||||||
|
certpath=${certpath%/*}; certpath=${certpath#* }
|
||||||
|
SUBJECTNAMES=$(openssl x509 -in ${certpath}/cert.pem -noout -text|grep -oP '(?<=DNS:|IP Address:)[^,]+'|sort -uV)
|
||||||
|
CERTEXPIRE=$(date -d "$(: | openssl x509 -in ${certpath}/cert.pem -text | grep 'Not After' |awk '{print $4,$5,$7}')" '+%s');
|
||||||
|
SUBJECTNAMES=${SUBJECTNAMES//$'\n'/, }
|
||||||
|
else
|
||||||
|
ssl='-'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(grep include/proxy.conf ${sitefile})" != "" ]; then
|
||||||
|
type='Proxy'
|
||||||
|
server=$(grep 'set $server' ${sitefile})
|
||||||
|
server=${server#*\"}; server=${server%\"*}
|
||||||
|
scheme=$(grep 'set $forward_scheme' ${sitefile})
|
||||||
|
scheme=${scheme##* }; scheme=${scheme%;*}
|
||||||
|
port=$(grep 'set $port' ${sitefile})
|
||||||
|
port=${port##* }; port=${port%;*}
|
||||||
|
c=0; spc7=''; spct=$((${cw_spc7}-${#server})); until [ $c = ${spct} ]; do spc7="${spc7} "; c=`expr $c + 1`; done
|
||||||
|
proxyhost="${server}${spc7}:${port}"
|
||||||
|
else
|
||||||
|
type='HTTP'
|
||||||
|
proxyhost=''
|
||||||
|
fi
|
||||||
|
[ "$(grep include/hsts-support.conf ${sitefile})" != "" ] && hsts='Yes' || hsts='-'
|
||||||
|
[ "$(grep include/websocket-support.conf ${sitefile})" != "" ] && wbskt='Yes' || wbskt='-'
|
||||||
|
[ "$(grep include/block-exploits.conf ${sitefile})" != "" ] && explt='Yes' || explt='-'
|
||||||
|
[ "$(grep include/secure-access.conf ${sitefile})" != "" ] && lock='Yes' || lock='-'
|
||||||
|
f=0
|
||||||
|
until [ "${edit}" = "c" ]; do
|
||||||
|
echo -e "\033[K${idsCL[White]}0) Site Address: ${idsCL[Cyan]}${idsST[Bold]}${site}${idsST[Reset]}"
|
||||||
|
echo -e "\033[K${idsCL[White]}1) Site Type: ${idsCL[Cyan]}${idsST[Bold]}${type}${idsST[Reset]}"
|
||||||
|
echo -e "\033[K${idsCL[White]}2) SSL Secure: ${idsCL[Cyan]}${idsST[Bold]}${ssl}${idsST[Reset]} - ${idsCL[LightCyan]}(${SUBJECTNAMES})"
|
||||||
|
echo -e "\033[K${idsCL[White]}3) HSTS Enabled ${idsCL[Cyan]}${idsST[Bold]}${hsts}${idsST[Reset]}"
|
||||||
|
echo -e "\033[K${idsCL[White]}4) Web Sockets: ${idsCL[Cyan]}${idsST[Bold]}${wbskt}${idsST[Reset]}"
|
||||||
|
echo -e "\033[K${idsCL[White]}5) Exploits Block: ${idsCL[Cyan]}${idsST[Bold]}${explt}${idsST[Reset]}"
|
||||||
|
echo -e "\033[K${idsCL[White]}6) Secured Access: ${idsCL[Cyan]}${idsST[Bold]}${lock}${idsST[Reset]}"
|
||||||
|
if [ "${type}" == "Proxy" ]; then
|
||||||
|
echo -e "\033[K${idsCL[White]}7) Proxy Address: ${idsCL[Cyan]}${idsST[Bold]}${server}${idsST[Reset]}"
|
||||||
|
echo -e "\033[K${idsCL[White]}8) Proxy Scheme: ${idsCL[Cyan]}${idsST[Bold]}${scheme}${idsST[Reset]}"
|
||||||
|
echo -e "\033[K${idsCL[White]}9) Proxy Port: ${idsCL[Cyan]}${idsST[Bold]}${port}${idsST[Reset]}"
|
||||||
|
else
|
||||||
echo -e "\033[K"
|
echo -e "\033[K"
|
||||||
echo -e "\033[K"
|
echo -e "\033[K"
|
||||||
echo -e "\033[K"
|
echo -e "\033[K"
|
||||||
echo -e "\033[7A"
|
|
||||||
fi
|
fi
|
||||||
|
if [ "${edit}" != "s" ]; then
|
||||||
while [ "${edit^}" != "E" ]; do
|
if [ $f -eq 0 ]; then
|
||||||
|
echo -e "\033[K"
|
||||||
|
echo -e "\033[K"
|
||||||
|
echo -e "\033[K (${idsCL[Green]}s${idsCL[Default]})ave, (${idsCL[Red]}c${idsCL[Default]})ancel, (${idsCL[Green]}e${idsCL[Default]})xit"
|
||||||
|
echo -e "\033[K"
|
||||||
|
echo -e "\033[K"
|
||||||
|
echo -e "\033[K"
|
||||||
|
echo -e "\033[7A"
|
||||||
|
fi
|
||||||
|
|
||||||
echo -en "\n\033[K${idsCL[LightCyan]}Enter the line number to edit: ${idsCL[Default]}"
|
echo -en "\n\033[K${idsCL[LightCyan]}Enter the line number to edit: ${idsCL[Default]}"
|
||||||
read -n 1 edit
|
read -n 1 edit
|
||||||
|
|
||||||
case "${edit}" in
|
case "${edit}" in
|
||||||
0) ;;
|
0) ;;
|
||||||
1) [ "${type}" == "HTTP" ] && type='Proxy' || type='HTTP';;
|
1) [ "${type}" == "HTTP" ] && type='Proxy' || type='HTTP';;
|
||||||
@@ -708,7 +710,7 @@ SITEINFO(){
|
|||||||
read port
|
read port
|
||||||
echo -e "\033[5A"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[5A"
|
echo -e "\033[5A"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[5A"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
[Ee])
|
[Ee])
|
||||||
echo -e "\n\n\n"
|
echo -e "\n\n\n"
|
||||||
exit 0
|
exit 0
|
||||||
@@ -717,39 +719,39 @@ SITEINFO(){
|
|||||||
echo -e "\n\033[K\033[14A";
|
echo -e "\n\033[K\033[14A";
|
||||||
echo -e "\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K";
|
echo -e "\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K\n\033[K";
|
||||||
echo -e "\033[14A"
|
echo -e "\033[14A"
|
||||||
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
# [ "$edit" = "7" ] && echo -e "\033[5A"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[5A"
|
||||||
# [ "$edit" = "7" ] && echo -e "\033[5A"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[K"; echo -e "\033[5A"
|
echo -e "\033[12A"
|
||||||
echo -e "\033[12A"
|
else
|
||||||
else
|
echo -en "\n\033[K${idsCL[LightCyan]}Confirm changes (Y/n): ${idsCL[Default]}"
|
||||||
echo -en "\n\033[K${idsCL[LightCyan]}Confirm changes (Y/n): ${idsCL[Default]}"
|
read -n 1 confirm
|
||||||
read -n 1 confirm
|
case "${confirm}" in
|
||||||
case "${confirm}" in
|
[Nn])
|
||||||
[Nn])
|
edit=''
|
||||||
edit=''
|
echo -e "\033[12A"
|
||||||
echo -e "\033[12A"
|
;;
|
||||||
;;
|
*)
|
||||||
*)
|
echo -e "\n\n\n"
|
||||||
echo -e "\n\n\n"
|
|
||||||
|
|
||||||
# NEWPROXYSITE_CREATE ${site} ${server} ${port} ${scheme} ${wbskt} ${hsts} ${explt} ${lock}
|
# NEWPROXYSITE_CREATE ${site} ${server} ${port} ${scheme} ${wbskt} ${hsts} ${explt} ${lock}
|
||||||
# SITENAME=${1}
|
# SITENAME=${1}
|
||||||
# PROXYHOST=${2}
|
# PROXYHOST=${2}
|
||||||
# PROXYPORT=${3}
|
# PROXYPORT=${3}
|
||||||
# PROXYSCHEME=${4}
|
# PROXYSCHEME=${4}
|
||||||
# WEBSOCKET=${5}
|
# WEBSOCKET=${5}
|
||||||
# HSTS=${6}
|
# HSTS=${6}
|
||||||
# EXPLOITS=${7}
|
# EXPLOITS=${7}
|
||||||
# SECURE=${8}
|
# SECURE=${8}
|
||||||
|
|
||||||
edit=c
|
edit=c
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
fi
|
fi
|
||||||
f=1
|
f=1
|
||||||
|
done
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user