Alrighty then - I have taken the PHP script I wrote to do this and converted it to a Shell script so it would be faster.
It’s prettier…because it has colors now - or a function that helps me produce colors anyway!
Right now it’s still really simple code.
The most complicated bits about it are the regular expressions.
It’s getting to grow to the size where I need to start commenting…BLAH.
For now it’s done. I was going to extend it more - but with all the data we gathered from the 2 basic things it does…well I need to get working on upgrading versions and what not.
Enjoy!
#!/bin/bash Colors() { Escape="\033"; BlackF="${Escape}[30m"; RedF="${Escape}[31m"; GreenF="${Escape}[32m"; YellowF="${Escape}[33m"; BlueF="${Escape}[34m"; PurpleF="${Escape}[35m"; CyanF="${Escape}[36m"; WhiteF="${Escape}[37m"; BlackB="${Escape}[40m"; RedB="${Escape}[41m"; GreenB="${Escape}[42m"; YellowB="${Escape}[43m"; BlueB="${Escape}[44m"; PurpleB="${Escape}[45m"; CyanB="${Escape}[46m"; WhiteB="${Escape}[47m"; BoldOn="${Escape}[1m"; BoldOff="${Escape}[22m"; ItalicsOn="${Escape}[3m"; ItalicsOff="${Escape}[23m"; UnderlineOn="${Escape}[4m"; UnderlineOff="${Escape}[24m"; BlinkOn="${Escape}[5m"; BlinkOff="${Escape}[25m"; InvertOn="${Escape}[7m"; InvertOff="${Escape}[27m"; Reset="${Escape}[0m"; } FindJoomla() { clear && echo -e "${BoldOn}${GreenF}Searching For Joomla Websites...${Reset}"; JoomlaSiteList=`find /home/virtual -maxdepth 6 -regex '.*/html/pathway.php'`; Paths=(${JoomlaSiteList}); printf "${BoldOn}%40s${BoldOff} ${BoldOn}%15s${BoldOff} ${BoldOn}%15s${BoldOff} ${BoldOn}%25s${BoldOff}\n" "Domain" "Product" "Version" "VirtueMart"; for Path in ${Paths[@]} do Site=${Path:14:${#Path}-43}; SiteDomainVariable=`grep '^\$mosConfig_live_site' /home/virtual/${Site}/fst/var/www/html/configuration.php`; SiteDomain=${SiteDomainVariable:24}; SiteDomain=${SiteDomain:0:${#SiteDomain}-2}; Product=`grep '\$PRODUCT' /home/virtual/${Site}/fst/var/www/html/includes/version.php`; Product=`expr match "${Product}" ".*\('[A-Z].*\)"`; Product=${Product:1:${#Product}-3}; Version=`grep '\$RELEASE' /home/virtual/${Site}/fst/var/www/html/includes/version.php`; Version=`expr match "${Version}" ".*\('[0-9].*\)"`; Version=${Version:1:${#Version}-3}; SubVersion=`grep '\$DEV_LEVEL' /home/virtual/${Site}/fst/var/www/html/includes/version.php`; SubVersion=`expr match "${SubVersion}" ".*\('[0-9].*\)"`; SubVersion="."${SubVersion:1:${#SubVersion}-3}; ICanHazComponent=`ls /home/virtual/$Site/fst/var/www/html/administrator/components | grep 'com_virtuemart'`; VirtueMartVersion="N/A"; if [ $ICanHazComponent ] then VirtueMartVersion=`grep '\$RELEASE' /home/virtual/$Site/fst/var/www/html/administrator/components/com_virtuemart/version.php`; VirtueMartVersion=${VirtueMartVersion:17}; VirtueMartVersion=${VirtueMartVersion:0:${#VirtueMartVersion}-2}; fi printf "${BlueF}%40s ${YellowF}%15s ${PurpleF}%15s${CyanF}%25s${Reset}\n" "${SiteDomain}" "${Product}" "${Version}${SubVersion}" "${VirtueMartVersion}"; done echo -e "${BoldOn}${GreenF}Search Complete!${Reset}\n" && MainMenu; } FindXCart() { clear && echo -e "${BoldOn}${GreenF}Searching For X-Cart Websites...${Reset}"; JoomlaSiteList=`find /home/virtual/ -maxdepth 7 -regex '.*/html/[^.]*/wysiwyg.php'`; Paths=(${JoomlaSiteList}); printf "${BoldOn}%40s${BoldOff} ${BoldOn}%15s${BoldOff} ${BoldOn}%25s${BoldOff}\n" "Domain" "Product" "Version"; for Path in ${Paths[@]} do Site=${Path:14}; Site=`expr match ${Site} '\(....[0-9]*\)'`; Store=${Path:0:${#Path}-12}; Store=`expr match ${Store} '.*\(/.*\)'`; Store=${Store:1}; SiteDomainVariable=`grep '^$xcart_http_host' /home/virtual/${Site}/fst/var/www/html/${Store}/config.php`; SiteDomain=${SiteDomainVariable:19}; SiteDomain=${SiteDomain:0:${#SiteDomain}-2}; Product='X-Cart'; Version=`grep '^Version' /home/virtual/$Site/fst/var/www/html/$Store/VERSION`; Version=${Version:8}; printf "${BlueF}%40s ${YellowF}%15s ${PurpleF}%25s${Reset}\n" "${SiteDomain}" "${Product}" "${Version}"; done echo -e "${BoldOn}${GreenF}Search Complete!${Reset}\n" && MainMenu; } Colors # Turn on colors! MainMenu() { MainMenu="${BoldOn}[Main Menu]${BoldOff}\n1) List All Joomla Sites\n2) List All X-Cart Sites\n3) Exit\n"; echo -e ${MainMenu} && echo "What would you like to do?" && read Option; case $Option in 1) FindJoomla;; 2) FindXCart;; 3) clear; exit;; *) clear; echo -e "${BoldOn}${RedF}[Invalid Option]${Reset}\n"; MainMenu;; esac } clear; MainMenu;