Software Versions: Difference between revisions

From Psygen Wiki
Jump to navigation Jump to search
(Created page with "You can run the below BASH script to get the current versions of:<br /> <pre> echo ""; w; echo "";hostname; echo ""; cat /etc/redhat-release; echo "";date; echo ""&& echo "P...")
 
No edit summary
Line 1: Line 1:
You can run the below BASH script to get the current versions of:<br />
You can run the below BASH script to get the current versions of:<br />


<ul>
    <li>Operating system ( CentOS Linux release 7.2.1511 (Core) )</li>
    <li>PHP</li>
    <li>PHP handlers in use</li>
    <li>Apache</li>
    <li>Apache MPM</li>
    <li>MySQL (Also notes if Maria DB is being used)</li>
</ul>
It also shows the following information:
<ul>
    <li>system hostname</li>
    <li>Who's logged in (<code> w </code>)</li>
    <li>PHP Memory Limit</li>
    <li>Free Memory</li>
    <li>Disk Usage</li>
    <li>Inode Usage</li>
    <li>CPU usage</li>
    <li>Memory usage</li>
    <li>If loadwatch is installed or not</li>
    <li>Current Connections</li>
    <li>The last five root ssh connections</li>
    <li>Possible loaded Apache includes files</li>
</ul>


<pre>
<pre>
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
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
</pre>
</pre>
== References ==
<ol>
  <li>Script by Ryan Oberlin</li>
</ol>

Revision as of 02:32, 12 January 2017

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