Sterling Hamilton

09 Oct, 2008

Joomla Scanner!

Posted by: Sterling Hamilton In: Code

I wrote a script today that basically goes through and finds all websites on our servers and displays the ones that have Joomla and what version of Joomla it has installed.

Example Output:
Retrieving Site List…
[http://www.breweryarts.org] [Mambo] [4.5.4]
[http://www.artbyblair.com] [Mambo] [4.5.4]
[http://www.budgaugh.com] [Joomla!] [1.0.13]
[http://www.ecomadness.com] [Joomla!] [1.0.15]
[http://www.janusstudio.com] [Joomla!] [1.0.11]
[http://www.sharonchandler.com] [Mambo] [4.5.4]

See code below:

#!/usr/local/bin/php -q
<?php
 
  /* Joomla Scanner
   * Author:  Sterling Hamilton
   * Date:    10.09.2008
   *
   * Use from the command line.
   * Example default use:   # php JoomlaScanner.php
   *  -> This will search all domains and see if they have Joomla.
   *  -> If they do it will find what version of Joomla it is and display it along with the proper domain.
   */
 
 
  echo "\033[32mRetrieving 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);
 
  foreach($arySiteList as $site) {
 
    $domain = shell_exec("grep '^\$mosConfig_live_site' /home/virtual/$site/fst/var/www/html/configuration.php");
    $domain = str_replace('$mosConfig_live_site = \'',NULL,$domain);
    $domain = trim(str_replace('\';',NULL,$domain));
 
    $product = trim(shell_exec("grep '\$PRODUCT' /home/virtual/$site/fst/var/www/html/includes/version.php"));
    $version  = trim(shell_exec("grep '\$RELEASE' /home/virtual/$site/fst/var/www/html/includes/version.php"));
    $subversion = trim(shell_exec("grep '\$DEV_LEVEL' /home/virtual/$site/fst/var/www/html/includes/version.php"));
 
    $product = str_replace('var $PRODUCT',NULL,$product);
    $product = str_replace('= \'',NULL,trim($product));
    $product = str_replace('\';',NULL,$product);
    $version = str_replace('var $RELEASE',NULL,$version);
    $version = str_replace('= \'',NULL,trim($version));
    $version = str_replace('\';',NULL,$version);
    $subversion = str_replace('var $DEV_LEVEL',NULL,$subversion);
    $subversion = str_replace('= \'',NULL,trim($subversion));
    $subversion = str_replace('\';',NULL,$subversion);
 
    echo "[\033[35m$domain\033[0m] [$product] [\033[31m$version.$subversion\033[0m]\n";
  }
 
?>

No Responses to "Joomla Scanner!"

Comment Form

You must be logged in to post a comment.

Categories

Archives

About

Hi, You’ve found my website, well done!

I’m a web designer and an all round geek, hence the funky website. I live in Reno and work in Carson City with a great group of web developers.

I’d describe myself as quiet, shy and simply a nice guy - but I’d be lying. But one can try right? I like my music rocking, my tea hot, and my shoes custom, as well as my daily dose of caffeine, gaming and technology.

I rock green eyes, curly brown hair which I tend to keep on the long side, and a complexion that can be illustrated with a blank sheet of paper. I dress business casual most of the time or just casual and I drive the most generic car on the planet.