Skip to content

Instantly share code, notes, and snippets.

@grok
Created April 28, 2014 15:06
Show Gist options
  • Save grok/11374876 to your computer and use it in GitHub Desktop.
Save grok/11374876 to your computer and use it in GitHub Desktop.
Another server scanner I wrote back in the day.
Example Output:
Retrieving Joomla Site List…
Detecting Joomla Versions…
[http://www.angelkissfoundation.org] -> [Joomla!] [1.0.15] -> [No VirtueMart Detected]
[http://www.florinanalytical.com] -> [Joomla!] [1.0.13] -> [No VirtueMart Detected]
[http://www.kcareno.com] -> [Joomla!] [1.0.13] -> [No VirtueMart Detected]
[http://www.itosbolivia.com] -> [Joomla!] [1.0.13] -> [No VirtueMart Detected]
[http://www.successdna.com] -> [Joomla!] [1.0.13] -> [VirtueMart] [1.0.13a.]
[http://www.computercorps.org] -> [Joomla!] [1.0.15] -> [No VirtueMart Detected]
[http://www.clarkcountybar.org] -> [Joomla!] [1.0.13] -> [VirtueMart] [1.0.15.]
[http://www.natewalker.org] -> [Joomla!] [1.0.11] -> [No VirtueMart Detected]
[http://hamptoninnreno.com] -> [Joomla!] [1.0.15] -> [No VirtueMart Detected]
[http://www.railwayreflections.org] -> [Joomla!] [1.0.13] -> [VirtueMart] [1.1.0.]
[http://www.nevadanla.com] -> [Joomla!] [1.0.15] -> [No VirtueMart Detected]
[http://www.southgatecoins.com] -> [Mambo] [4.5.4] -> [VirtueMart] [1.0.13a.]
[http://www.dailysoulutions.com] -> [Mambo] [4.5.4] -> [No VirtueMart Detected]
[http://www.wellbeingjournal.com] -> [Joomla!] [1.0.12] -> [VirtueMart] [1.0.13a.]
[http://www.commacoffee.com] -> [Joomla!] [1.0.12] -> [No VirtueMart Detected]
Retrieving X-Cart Site List…
[stusellcoins.com] -> [Version 4.1.10]
[www.pepsigifts.com] -> [Version 4.1.6]
[srv02.exyst.com] -> [Version 4.1.11]
[www.tigertransmission.com] -> [Version 4.1.5]
[www.CIPLASTQDP.com] -> [Version 4.1.8]
[srv02.exyst.com] -> [Version 4.1.11]
[www.pei-ups.com] -> [Version 4.1.10]
[www.cpsqdp.com] -> [Version 4.1.8]
[www.mckdev.com] -> [Version 4.1.7]
[www.arroyoqdp.com] -> [Version 4.1.8]
[www.mckernan.com] -> [Version 4.1.8]
[www.kkmprecision.com] -> [Version 4.1.4]
[www.rpprogram.com] -> [Version 4.1.8]
[www.casepakqdp.com] -> [Version 4.1.8]
#!/usr/local/bin/php -q
<?php
/* Project: Sever Scanner
* Author: Sterling Hamilton
* Date: 10.10.2008
*
* This is an extended version of the Joomla Scanner.
* Its current function is to find all Joomla websites and display the version of that install.
* Then it checks if VirtueMart is installed and if it is, it retrieves the version and displays it.
*
* It also scans for X-Cart websites and displays the version installed.
*
* In the future I will extend this to detect component,module and other plugin versions and setup
* automatic notifications to be sent out if we have out of date installs.
*/
echo "\033[32mRetrieving Joomla Site List...\033[0m\n";
$strSiteList = shell_exec("find /home/virtual -maxdepth 6 -regex '.*/html/pathway.php'");
$strSiteList = str_replace("/home/virtual/", NULL, $strSiteList);
$strSiteList = str_replace("/fst/var/www/html/pathway.php", NULL, $strSiteList);
$arySiteList = explode("\n",$strSiteList);
$arySiteList = array_slice($arySiteList,0,count($arySiteList)-1);
echo "\033[36mDetecting Joomla Versions...\033[0m\n";
foreach($arySiteList as $strSite) {
$strJoomlaDomain = shell_exec("grep '^\$mosConfig_live_site' /home/virtual/$strSite/fst/var/www/html/configuration.php");
$strJoomlaDomain = str_replace('$mosConfig_live_site = \'',NULL,$strJoomlaDomain);
$strJoomlaDomain = trim(str_replace('\';',NULL,$strJoomlaDomain));
$strJoomlaProduct = trim(shell_exec("grep '\$PRODUCT' /home/virtual/$strSite/fst/var/www/html/includes/version.php"));
$strJoomlaVersion = trim(shell_exec("grep '\$RELEASE' /home/virtual/$strSite/fst/var/www/html/includes/version.php"));
$strJoomlaSubVersion = trim(shell_exec("grep '\$DEV_LEVEL' /home/virtual/$strSite/fst/var/www/html/includes/version.php"));
$strVirtueMart = "[\033[37mNo VirtueMart Detected\033[0m]";
$strICanHazVirtueMart = shell_exec("ls /home/virtual/$strSite/fst/var/www/html/administrator/components | grep 'com_virtuemart'");
if($strICanHazVirtueMart) {
$strVirtueMartProduct = trim(shell_exec("grep '\$PRODUCT' /home/virtual/$strSite/fst/var/www/html/administrator/components/com_virtuemart/version.php"));
$strVirtueMartVersion = trim(shell_exec("grep '\$RELEASE' /home/virtual/$strSite/fst/var/www/html/administrator/components/com_virtuemart/version.php"));
$strVirtueMartSubVersion = trim(shell_exec("grep '\$DEV_LEVEL' /home/virtual/$strSite/fst/var/www/html/administrator/components/com_virtuemart/version.php"));
$strVirtueMartProduct = str_replace('var $PRODUCT',NULL,$strVirtueMartProduct);
$strVirtueMartProduct = str_replace('= \'',NULL,trim($strVirtueMartProduct));
$strVirtueMartProduct = str_replace('\';',NULL,$strVirtueMartProduct);
$strVirtueMartVersion = str_replace('var $RELEASE',NULL,$strVirtueMartVersion);
$strVirtueMartVersion = str_replace('= \'',NULL,trim($strVirtueMartVersion));
$strVirtueMartVersion = str_replace('\';',NULL,$strVirtueMartVersion);
$strVirtueMartSubVersion = str_replace('var $DEV_LEVEL',NULL,$strVirtueMartSubVersion);
$strVirtueMartSubVersion = str_replace('= \'',NULL,trim($strVirtueMartSubVersion));
$strVirtueMartSubVersion = str_replace('\';',NULL,$strVirtueMartSubVersion);
$strVirtueMart = "[\033[36m$strVirtueMartProduct\033[0m] [\033[31m$strVirtueMartVersion.$strVirtueMartSubVersion\033[0m]";
}
$strJoomlaProduct = str_replace('var $PRODUCT',NULL,$strJoomlaProduct);
$strJoomlaProduct = str_replace('= \'',NULL,trim($strJoomlaProduct));
$strJoomlaProduct = str_replace('\';',NULL,$strJoomlaProduct);
$strJoomlaVersion = str_replace('var $RELEASE',NULL,$strJoomlaVersion);
$strJoomlaVersion = str_replace('= \'',NULL,trim($strJoomlaVersion));
$strJoomlaVersion = str_replace('\';',NULL,$strJoomlaVersion);
$strJoomlaSubVersion = str_replace('var $DEV_LEVEL',NULL,$strJoomlaSubVersion);
$strJoomlaSubVersion = str_replace('= \'',NULL,trim($strJoomlaSubVersion));
$strJoomlaSubVersion = str_replace('\';',NULL,$strJoomlaSubVersion);
$strJoomla = "[\033[33m$strJoomlaProduct\033[0m] [\033[31m$strJoomlaVersion.$strJoomlaSubVersion\033[0m]";
$strDomain = "[\033[35m$strJoomlaDomain\033[0m]";
echo "$strDomain -> $strJoomla -> $strVirtueMart\n";
}
echo "\n\033[32mRetrieving X-Cart Site List...\033[0m\n";
$strSiteList = shell_exec("find /home/virtual/ -maxdepth 7 -regex '.*/html/[^.]*/wysiwyg.php'");
$strSiteList = str_replace("/home/virtual/", NULL, $strSiteList);
$strSiteList = str_replace("/fst/var/www/html", "|", $strSiteList);
$strSiteList = str_replace("wysiwyg.php", NULL, $strSiteList);
$strSiteList = str_replace("/", NULL, $strSiteList);
$arySiteList = (explode("\n",trim($strSiteList)));
foreach($arySiteList as $strSiteStore) {
$strSite = substr($strSiteStore, 0, strpos($strSiteStore, "|"));
$strStore = substr(strstr($strSiteStore,"|"),1);
$strXCartDomain = shell_exec('grep \'^$xcart_http_host\' /home/virtual/'.$strSite.'/fst/var/www/html/'.$strStore.'/config.php');
$strXCartDomain = str_replace('$xcart_http_host ="', NULL, $strXCartDomain);
$strXCartDomain = trim(str_replace('";', NULL, $strXCartDomain));
$strXCartVersion = trim(shell_exec("grep '^Version' /home/virtual/$strSite/fst/var/www/html/$strStore/VERSION"));
$strXCartDomain = "[\033[35m$strXCartDomain\033[0m]";
$strXCartVersion = "[\033[33m$strXCartVersion\033[0m]";
echo "$strXCartDomain -> $strXCartVersion\n";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment