Software Versions

From Psygen Wiki
Revision as of 04:19, 20 January 2017 by Admin (talk | contribs)
Jump to navigation Jump to search

Check-all One-liner

You can run the below BASH script to get the current versions of:

  • Operating system ( CentOS Linux release 7.2.1511 (Core) )
  • PHP
  • PHP handlers in use
  • Apache
  • Apache MPM
  • MySQL (Also notes if Maria DB is being used)

It also shows the following information:

  • system hostname
  • Who's logged in ( w )
  • PHP Memory Limit
  • Free Memory
  • Disk Usage
  • Inode Usage
  • CPU usage
  • Memory usage
  • If loadwatch is installed or not
  • Current Connections
  • The last five root ssh connections
  • Possible loaded Apache includes files
echo ""; w; echo "";hostname; echo ""; cat /etc/redhat-release; echo "";date; echo ""&& echo "PHP Memory Limit"; php -i |grep memory_limit | grep -v HIST; echo ""; echo "Free Memory"; free -m; echo "" && echo "Disk Usage";df -h; echo ""; echo "Inodes"; df -i;echo "";echo ""; echo "PHP, Apache, MySQL Version"; vphp=$(php -v | sed -n 1p | cut -d' ' -f2- | cut -d' ' -f1|cut -c1-3|sort -b); vhttpd=$(httpd -v | grep version| cut -d '/' -f2- | cut -d' ' -f1|cut -c1-3|sort -b); vmaria=$(mysql --version | grep -i -o mariadb); vsql=$(grep -i mysql /var/cpanel/cpanel.config | grep version | cut -d'=' -f2-); if [ "$vphp" > "5.5" ]; then echo -e "PHP Version: \e[92m$vphp\e[0m";else echo -e "PHP Version: \e[31m$vphp\e[0m"; fi ; if [ "$vhttpd" > "2.2" ];then echo -e "Apache Version: \e[92m$vhttpd\e[0m"; else echo -e "Apache Version: \e[31m$vhttpd\e[0m";fi;httpd -V | grep 'MPM'; if [ "$vsql" < "5.6" ]; then echo -e "MySQL Version: \e[31m$vsql\e[0m";else echo -e "MySQL Version: \e[92m$vsql\e[0m";fi; if [ "$vmaria" = "MariaDB" ]; then echo -e "\e[95mServer is using MariaDB\e[0m"; fi;  echo "" && echo "PHP Handler Info"; /usr/local/cpanel/bin/rebuild_phpconf --current ; echo "" && echo "CPU"; sar | sed -n 3p|sed -e 's/12.*AM/Time       /g'; sar | tail -7; echo " "; echo "Memory Usage"; sar -r| sed -n 3p| sed -e 's/12.*AM/Time       /g'; sar -r | tail -7; echo "";if [ -e /root/loadwatch ]; then echo -e "\e[32mLoadwatch found\e[0m"; else echo -e "\e[31mLoadwatch not found\e[0m"; fi; echo ""; echo "Current Connections";netstat -nt 2>/dev/null | egrep ':80|:443'| awk '{print $5}' | awk -F: 'BEGIN { OFS = ":"} {$(NF--)=""; print}' | awk '{print substr($0, 1, length($0)-1)}' | sort | uniq -c | sort -rn | head; echo ""; echo "Last Five Root SSH Connections"; last | grep root |head;echo ""; echo "Possible loaded Apache includes files"; for i in $(find /usr/local/apache/conf/includes/ -type f \( -name "post*" -o -name "pre*" \) -size +0k); do echo -e "\e[32m$i\e[0m"; done; echo ""; if [ ! -e /usr/local/lp/logs/bash_eternal_history ]; then echo -e "\e[31mBash Eternal Not Found\e[0m"; echo ""; fi


References

  1. Script by Ryan Oberlin