- Add CMS WordPress
- Some minor bug fixes
This commit is contained in:
parent
3b30a7b170
commit
ef7e3de3a5
@ -31,6 +31,7 @@ clean_up() {
|
|||||||
rm -f $_tmp_filename_php_56
|
rm -f $_tmp_filename_php_56
|
||||||
rm -f $_tmp_filename_php_70
|
rm -f $_tmp_filename_php_70
|
||||||
rm -f $_tmp_filename_php_71
|
rm -f $_tmp_filename_php_71
|
||||||
|
rm -f $_tmp_filename_not_considered
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,6 +268,21 @@ echo "Website; ;PHP Version; ;PHP Engine; ;Database; ;CMS; ;DocumentRoot; ;VHost
|
|||||||
echo ";" >> $filename_php_71
|
echo ";" >> $filename_php_71
|
||||||
|
|
||||||
|
|
||||||
|
_tmp_filename_not_considered=$(mktemp)
|
||||||
|
filename_not_considered="${DST_DIR_CSV}/VHOST_FILES_NOT_CONSIDERED.csv"
|
||||||
|
cat <<EOF > ${DST_PATH_PHP}/vhost_files_not_considered.php
|
||||||
|
<?php
|
||||||
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_not_considered)\"");
|
||||||
|
header('Pragma: no-cache');
|
||||||
|
header('Expires: 0');
|
||||||
|
readfile("$filename_not_considered");
|
||||||
|
?>
|
||||||
|
EOF
|
||||||
|
echo "VHost file" > $filename_not_considered
|
||||||
|
echo ";" >> $filename_not_considered
|
||||||
|
|
||||||
|
|
||||||
cat <<EOF > ${DST_PATH_PHP}/index.php
|
cat <<EOF > ${DST_PATH_PHP}/index.php
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@ -275,16 +291,21 @@ cat <<EOF > ${DST_PATH_PHP}/index.php
|
|||||||
<body>
|
<body>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="websites_summary.php">full summary of all hosted websites</a></li>
|
<li><a href="websites_summary.php">full summary of all hosted websites</a></li>
|
||||||
|
<br />
|
||||||
<li><a href="websites_redirected.php">redirected websites</a></li>
|
<li><a href="websites_redirected.php">redirected websites</a></li>
|
||||||
|
<br />
|
||||||
<li><a href="websites_mod_php.php">websites mod_php</a></li>
|
<li><a href="websites_mod_php.php">websites mod_php</a></li>
|
||||||
<li><a href="websites_php_fpm.php">websites PHP-FPM</a></li>
|
<li><a href="websites_php_fpm.php">websites PHP-FPM</a></li>
|
||||||
<li><a href="websites_php_fcgid.php">websites FastCGI</a></li>
|
<li><a href="websites_php_fcgid.php">websites FastCGI</a></li>
|
||||||
|
<br />
|
||||||
<li><a href="websites_php_53.php">websites PHP v5.3</a></li>
|
<li><a href="websites_php_53.php">websites PHP v5.3</a></li>
|
||||||
<li><a href="websites_php_54.php">websites PHP v5.4</a></li>
|
<li><a href="websites_php_54.php">websites PHP v5.4</a></li>
|
||||||
<li><a href="websites_php_55.php">websites PHP v5.5</a></li>
|
<li><a href="websites_php_55.php">websites PHP v5.5</a></li>
|
||||||
<li><a href="websites_php_56.php">websites PHP v5.6</a></li>
|
<li><a href="websites_php_56.php">websites PHP v5.6</a></li>
|
||||||
<li><a href="websites_php_70.php">websites PHP v7.0</a></li>
|
<li><a href="websites_php_70.php">websites PHP v7.0</a></li>
|
||||||
<li><a href="websites_php_71.php">websites PHP v7.1</a></li>
|
<li><a href="websites_php_71.php">websites PHP v7.1</a></li>
|
||||||
|
<br />
|
||||||
|
<li><a href="vhost_files_not_considered.php"">vhost_files not considered</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@ -345,10 +366,27 @@ done
|
|||||||
# -
|
# -
|
||||||
for _vhost_file in ${_all_vhost_files_arr[@]} ; do
|
for _vhost_file in ${_all_vhost_files_arr[@]} ; do
|
||||||
|
|
||||||
|
_documentroot=""
|
||||||
|
|
||||||
|
_vhost_file_not_considered=false
|
||||||
|
|
||||||
# - Get Server Name
|
# - Get Server Name
|
||||||
# -
|
# -
|
||||||
_server_name=$(grep -i -E "^\s*ServerName" $_vhost_file | sed -e "s/ServerName//" | sed "s/^\s*//" | sed "s/\s*$//" | sort -u)
|
_server_name=$(grep -i -E "^\s*ServerName" $_vhost_file | sed -e "s/ServerName//" | sed "s/^\s*//" | sed "s/\s*$//" | sort -u)
|
||||||
|
|
||||||
|
if [[ $_server_name =~ localhost ]]; then
|
||||||
|
_vhost_file_not_considered=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if ! $_vhost_file_not_considered ; then
|
||||||
|
# - Get documetroot of current VHost configuration file
|
||||||
|
# -
|
||||||
|
_documentroot=$(grep -E "^\s*DocumentRoot" $_vhost_file 2> /dev/null | awk '{print$2}' | sed 's/"//g' | sed 's/\/$//' | sort -u)
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [[ -n $_documentroot ]]; then
|
||||||
|
|
||||||
# - Get Server Aliase
|
# - Get Server Aliase
|
||||||
# -
|
# -
|
||||||
@ -364,13 +402,6 @@ for _vhost_file in ${_all_vhost_files_arr[@]} ; do
|
|||||||
server_aliases="$(echo "$(trim $server_aliases)" | tr '\n' ' ')"
|
server_aliases="$(echo "$(trim $server_aliases)" | tr '\n' ' ')"
|
||||||
|
|
||||||
|
|
||||||
# - Get documetroot of current VHost configuration file
|
|
||||||
# -
|
|
||||||
_documentroot=$(grep -E "^\s*DocumentRoot" $_vhost_file 2> /dev/null | awk '{print$2}' | sed 's/"//g' | sed 's/\/$//' | sort -u)
|
|
||||||
|
|
||||||
|
|
||||||
if [[ -n $_documentroot ]] ; then
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# - Get databases amd type of CMS
|
# - Get databases amd type of CMS
|
||||||
# ---
|
# ---
|
||||||
@ -380,6 +411,7 @@ for _vhost_file in ${_all_vhost_files_arr[@]} ; do
|
|||||||
|
|
||||||
file_to_check="$(dirname $_documentroot)/db.inc.php"
|
file_to_check="$(dirname $_documentroot)/db.inc.php"
|
||||||
file_to_check_mediawiki="$(dirname $_documentroot)/htdocs/LocalSettings.php"
|
file_to_check_mediawiki="$(dirname $_documentroot)/htdocs/LocalSettings.php"
|
||||||
|
file_to_check_wordpress="$(dirname $_documentroot)/htdocs/wp-config.php"
|
||||||
|
|
||||||
_found=false
|
_found=false
|
||||||
if [[ -r "$file_to_check_mediawiki" ]] && [[ ! -d "$file_to_check_mediawiki" ]] ; then
|
if [[ -r "$file_to_check_mediawiki" ]] && [[ ! -d "$file_to_check_mediawiki" ]] ; then
|
||||||
@ -411,6 +443,34 @@ for _vhost_file in ${_all_vhost_files_arr[@]} ; do
|
|||||||
|
|
||||||
site_cms="MediaWiki"
|
site_cms="MediaWiki"
|
||||||
|
|
||||||
|
elif [[ -r "$file_to_check_wordpress" ]] && [[ ! -d "$file_to_check_wordpress" ]] ; then
|
||||||
|
|
||||||
|
db_search_string="define\('DB_NAME'"
|
||||||
|
_found=false
|
||||||
|
if grep -i -q -E "^\s*$db_search_string" $file_to_check_wordpress > /dev/null 2>&1 ; then
|
||||||
|
|
||||||
|
database="$(grep -i -E "^\s*$db_search_string" $file_to_check_wordpress 2> /dev/null \
|
||||||
|
| awk -F ',' '{print$2}' \
|
||||||
|
| awk -F ')' '{print$1}' \
|
||||||
|
| tail -1 )"
|
||||||
|
|
||||||
|
# - Remove leading whitespace characters
|
||||||
|
database="${database#"${database%%[![:space:]]*}"}"
|
||||||
|
# - Remove trailing whitespace characters
|
||||||
|
database="${database%"${database##*[![:space:]]}"}"
|
||||||
|
# - Rmove trailing semicolon characters
|
||||||
|
database="${database%"${database##*[!;]}"}"
|
||||||
|
# - Remove trailing whitespace characters
|
||||||
|
database="${database#"${database%%[!\']*}"}"
|
||||||
|
# - Remove trailing inverted comma characters
|
||||||
|
database="${database%"${database##*[!\']}"}"
|
||||||
|
|
||||||
|
_found=true
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
site_cms="WordPress"
|
||||||
|
|
||||||
elif [[ -r "$file_to_check" ]] && [[ ! -d "$file_to_check" ]]; then
|
elif [[ -r "$file_to_check" ]] && [[ ! -d "$file_to_check" ]]; then
|
||||||
db_search_strings=('\$db_name' '\$mysql_db')
|
db_search_strings=('\$db_name' '\$mysql_db')
|
||||||
_found=false
|
_found=false
|
||||||
@ -539,15 +599,20 @@ for _vhost_file in ${_all_vhost_files_arr[@]} ; do
|
|||||||
echo "$_server_name;;$_php_version;;$_php_engine;;$database;;$site_cms;;$_documentroot;;$_vhost_file;;$server_aliases" >> $_tmp_filename_php_71
|
echo "$_server_name;;$_php_version;;$_php_engine;;$database;;$site_cms;;$_documentroot;;$_vhost_file;;$server_aliases" >> $_tmp_filename_php_71
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
elif ! $_vhost_file_not_considered ; then
|
||||||
_redirect_site=""
|
_redirect_site=""
|
||||||
_redirect_site=$(grep -E "^\s*RewriteRule" $_vhost_file 2> /dev/null | awk '{print$3}' | sed 's/"//g' | sed 's/\/$//' | sed 's/https\?:\/\///g' | sed 's/\$1//g' | sort -u)
|
_redirect_site=$(grep -E "^\s*RewriteRule" $_vhost_file 2> /dev/null | awk '{print$3}' | sed 's/"//g' | sed 's/\/$//' | sed 's/https\?:\/\///g' | sed 's/\$1//g' | sort -u)
|
||||||
if [[ -n "$_redirect_site" ]] ; then
|
if [[ -n "$_redirect_site" ]] ; then
|
||||||
echo "$_server_name;;$_redirect_site;;$_vhost_file" >> $_tmp_filename_redirected
|
echo "$_server_name;;$_redirect_site;;$_vhost_file" >> $_tmp_filename_redirected
|
||||||
else
|
else
|
||||||
echo "$_vhost_file:UNKNOWN"
|
_vhost_file_not_considered=true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if $_vhost_file_not_considered ; then
|
||||||
|
echo "$_vhost_file" >> $_tmp_filename_not_considered
|
||||||
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
cat $_tmp_filename_summary | sort >> $filename_summary
|
cat $_tmp_filename_summary | sort >> $filename_summary
|
||||||
@ -561,5 +626,6 @@ cat $_tmp_filename_php_55 | sort >> $filename_php_55
|
|||||||
cat $_tmp_filename_php_56 | sort >> $filename_php_56
|
cat $_tmp_filename_php_56 | sort >> $filename_php_56
|
||||||
cat $_tmp_filename_php_70 | sort >> $filename_php_70
|
cat $_tmp_filename_php_70 | sort >> $filename_php_70
|
||||||
cat $_tmp_filename_php_71 | sort >> $filename_php_71
|
cat $_tmp_filename_php_71 | sort >> $filename_php_71
|
||||||
|
cat $_tmp_filename_not_considered | sort >> $filename_not_considered
|
||||||
|
|
||||||
clean_up
|
clean_up
|
||||||
|
@ -710,6 +710,7 @@ for domain in "${domain_req_for_del_arr[@]}" ; do
|
|||||||
|
|
||||||
file_to_check="$(dirname $_doc_root)/db.inc.php"
|
file_to_check="$(dirname $_doc_root)/db.inc.php"
|
||||||
file_to_check_mediawiki="$(dirname $_doc_root)/htdocs/LocalSettings.php"
|
file_to_check_mediawiki="$(dirname $_doc_root)/htdocs/LocalSettings.php"
|
||||||
|
file_to_check_wordpress="$(dirname $_doc_root)/htdocs/wp-config.php"
|
||||||
|
|
||||||
_found=false
|
_found=false
|
||||||
if [[ -r "$file_to_check_mediawiki" ]] && [[ ! -d "$file_to_check_mediawiki" ]] ; then
|
if [[ -r "$file_to_check_mediawiki" ]] && [[ ! -d "$file_to_check_mediawiki" ]] ; then
|
||||||
@ -741,6 +742,34 @@ for domain in "${domain_req_for_del_arr[@]}" ; do
|
|||||||
|
|
||||||
site_cms="MediaWiki"
|
site_cms="MediaWiki"
|
||||||
|
|
||||||
|
elif [[ -r "$file_to_check_wordpress" ]] && [[ ! -d "$file_to_check_wordpress" ]] ; then
|
||||||
|
|
||||||
|
db_search_string="define\('DB_NAME'"
|
||||||
|
_found=false
|
||||||
|
if grep -i -q -E "^\s*$db_search_string" $file_to_check_wordpress > /dev/null 2>&1 ; then
|
||||||
|
|
||||||
|
database="$(grep -i -E "^\s*$db_search_string" $file_to_check_wordpress 2> /dev/null \
|
||||||
|
| awk -F ',' '{print$2}' \
|
||||||
|
| awk -F ')' '{print$1}' \
|
||||||
|
| tail -1 )"
|
||||||
|
|
||||||
|
# - Remove leading whitespace characters
|
||||||
|
database="${database#"${database%%[![:space:]]*}"}"
|
||||||
|
# - Remove trailing whitespace characters
|
||||||
|
database="${database%"${database##*[![:space:]]}"}"
|
||||||
|
# - Rmove trailing semicolon characters
|
||||||
|
database="${database%"${database##*[!;]}"}"
|
||||||
|
# - Remove trailing whitespace characters
|
||||||
|
database="${database#"${database%%[!\']*}"}"
|
||||||
|
# - Remove trailing inverted comma characters
|
||||||
|
database="${database%"${database##*[!\']}"}"
|
||||||
|
|
||||||
|
_found=true
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
site_cms="WordPress"
|
||||||
|
|
||||||
elif [[ -r "$file_to_check" ]] && [[ ! -d "$file_to_check" ]]; then
|
elif [[ -r "$file_to_check" ]] && [[ ! -d "$file_to_check" ]]; then
|
||||||
db_search_strings=('\$db_name' '\$mysql_db')
|
db_search_strings=('\$db_name' '\$mysql_db')
|
||||||
_found=false
|
_found=false
|
||||||
|
Loading…
Reference in New Issue
Block a user