Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Update script architecture to make it more modular and readable #61

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
simplify colors
  • Loading branch information
mattyjones committed Sep 29, 2021
commit 5418d03ae45e61ba6fd389bed76cc1afc69b79f7
30 changes: 15 additions & 15 deletions includes/applications
Original file line number Diff line number Diff line change
Expand Up @@ -2,79 +2,79 @@

software_configs()
{
echo -e "\e[00;33m### SOFTWARE #############################################\e[00m"
echo -e "\e[$orange### SOFTWARE #############################################\e[$default"

#sudo version - check to see if there are any known vulnerabilities with this
sudover=`sudo -V 2>/dev/null| grep "Sudo version" 2>/dev/null`
if [ "$sudover" ]; then
echo -e "\e[00;31m[-] Sudo version:\e[00m\n$sudover"
echo -e "\e[$red[-] Sudo version:\e[$default\n$sudover"
echo -e "\n"
fi

#mysql details - if installed
mysqlver=`mysql --version 2>/dev/null`
if [ "$mysqlver" ]; then
echo -e "\e[00;31m[-] MYSQL version:\e[00m\n$mysqlver"
echo -e "\e[$red[-] MYSQL version:\e[$default\n$mysqlver"
echo -e "\n"
fi

#checks to see if root/root will get us a connection
mysqlconnect=`mysqladmin -uroot -proot version 2>/dev/null`
if [ "$mysqlconnect" ]; then
echo -e "\e[00;33m[+] We can connect to the local MYSQL service with default root/root credentials!\e[00m\n$mysqlconnect"
echo -e "\e[$orange[+] We can connect to the local MYSQL service with default root/root credentials!\e[$default\n$mysqlconnect"
echo -e "\n"
fi

#mysql version details
mysqlconnectnopass=`mysqladmin -uroot version 2>/dev/null`
if [ "$mysqlconnectnopass" ]; then
echo -e "\e[00;33m[+] We can connect to the local MYSQL service as 'root' and without a password!\e[00m\n$mysqlconnectnopass"
echo -e "\e[$orange[+] We can connect to the local MYSQL service as 'root' and without a password!\e[$default\n$mysqlconnectnopass"
echo -e "\n"
fi

#postgres details - if installed
postgver=`psql -V 2>/dev/null`
if [ "$postgver" ]; then
echo -e "\e[00;31m[-] Postgres version:\e[00m\n$postgver"
echo -e "\e[$red[-] Postgres version:\e[$default\n$postgver"
echo -e "\n"
fi

#checks to see if any postgres password exists and connects to DB 'template0' - following commands are a variant on this
postcon1=`psql -U postgres -w template0 -c 'select version()' 2>/dev/null | grep version`
if [ "$postcon1" ]; then
echo -e "\e[00;33m[+] We can connect to Postgres DB 'template0' as user 'postgres' with no password!:\e[00m\n$postcon1"
echo -e "\e[$orange[+] We can connect to Postgres DB 'template0' as user 'postgres' with no password!:\e[$default\n$postcon1"
echo -e "\n"
fi

postcon11=`psql -U postgres -w template1 -c 'select version()' 2>/dev/null | grep version`
if [ "$postcon11" ]; then
echo -e "\e[00;33m[+] We can connect to Postgres DB 'template1' as user 'postgres' with no password!:\e[00m\n$postcon11"
echo -e "\e[$orange[+] We can connect to Postgres DB 'template1' as user 'postgres' with no password!:\e[$default\n$postcon11"
echo -e "\n"
fi

postcon2=`psql -U pgsql -w template0 -c 'select version()' 2>/dev/null | grep version`
if [ "$postcon2" ]; then
echo -e "\e[00;33m[+] We can connect to Postgres DB 'template0' as user 'psql' with no password!:\e[00m\n$postcon2"
echo -e "\e[$orange[+] We can connect to Postgres DB 'template0' as user 'psql' with no password!:\e[$default\n$postcon2"
echo -e "\n"
fi

postcon22=`psql -U pgsql -w template1 -c 'select version()' 2>/dev/null | grep version`
if [ "$postcon22" ]; then
echo -e "\e[00;33m[+] We can connect to Postgres DB 'template1' as user 'psql' with no password!:\e[00m\n$postcon22"
echo -e "\e[$orange[+] We can connect to Postgres DB 'template1' as user 'psql' with no password!:\e[$default\n$postcon22"
echo -e "\n"
fi

#apache details - if installed
apachever=`apache2 -v 2>/dev/null; httpd -v 2>/dev/null`
if [ "$apachever" ]; then
echo -e "\e[00;31m[-] Apache version:\e[00m\n$apachever"
echo -e "\e[$red[-] Apache version:\e[$default\n$apachever"
echo -e "\n"
fi

#what account is apache running under
apacheusr=`grep -i 'user\|group' /etc/apache2/envvars 2>/dev/null |awk '{sub(/.*\export /,"")}1' 2>/dev/null`
if [ "$apacheusr" ]; then
echo -e "\e[00;31m[-] Apache user configuration:\e[00m\n$apacheusr"
echo -e "\e[$red[-] Apache user configuration:\e[$default\n$apacheusr"
echo -e "\n"
fi

Expand All @@ -86,22 +86,22 @@ fi
#installed apache modules
apachemodules=`apache2ctl -M 2>/dev/null; httpd -M 2>/dev/null`
if [ "$apachemodules" ]; then
echo -e "\e[00;31m[-] Installed Apache modules:\e[00m\n$apachemodules"
echo -e "\e[$red[-] Installed Apache modules:\e[$default\n$apachemodules"
echo -e "\n"
fi

#htpasswd check
htpasswd=`find / -name .htpasswd -print -exec cat {} \; 2>/dev/null`
if [ "$htpasswd" ]; then
echo -e "\e[00;33m[-] htpasswd found - could contain passwords:\e[00m\n$htpasswd"
echo -e "\e[$orange[-] htpasswd found - could contain passwords:\e[$default\n$htpasswd"
echo -e "\n"
fi

#anything in the default http home dirs (a thorough only check as output can be large)
if [ "$thorough" = "1" ]; then
apachehomedirs=`ls -alhR /var/www/ 2>/dev/null; ls -alhR /srv/www/htdocs/ 2>/dev/null; ls -alhR /usr/local/www/apache2/data/ 2>/dev/null; ls -alhR /opt/lampp/htdocs/ 2>/dev/null`
if [ "$apachehomedirs" ]; then
echo -e "\e[00;31m[-] www home dir contents:\e[00m\n$apachehomedirs"
echo -e "\e[$red[-] www home dir contents:\e[$default\n$apachehomedirs"
echo -e "\n"
fi
fi
Expand Down
Loading