From 92d504167e78b606e10734cf5e4bcb6c95fe07f9 Mon Sep 17 00:00:00 2001 From: Palma Solutions LTD Date: Fri, 12 May 2017 09:43:34 +0200 Subject: [PATCH] improved versioning --- sc.php | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/sc.php b/sc.php index 1bf7aa4..d0be174 100644 --- a/sc.php +++ b/sc.php @@ -191,7 +191,7 @@ Order Deny,Allow Deny from all '; - foreach(glob("./*/wp-content/uploads/") as $dirname) + foreach(glob("./{**/*,*}/wp-content/uploads/") as $dirname) { $hta = fopen($dirname."/.htaccess", "w"); fwrite($hta, $htdata); @@ -199,7 +199,6 @@ Deny from all } - // system("for i in `find ../ -type d -path '*/wp-content/uploads';`; do echo $i && echo -e '".$htdata."' >> \$i/.htaccess; done"); // system("for i in `find ../ -type d -path '*/tmp'`; do echo $i && echo -e '".$htdata."' >> \$i/.htaccess; done"); /* Joomla /images may cause a ton of false positive patches so we'll research this further */ // system("for i in `find ./ -type d -path '*/images' -print;`; do echo -e '".$htdata."' >> \$i/.htaccess; done"); @@ -1104,16 +1103,35 @@ $versions = array( ); -echo $versions[0][0]; -system('find '.$this->web_dir.' -type f -path '.$versions[0][1].' -exec grep -H '.$versions[0][2].'{} \; '); -echo $versions[1][0]; -system('find '.$this->web_dir.' -type f -path '.$versions[1][1].' -exec grep -H '.$versions[1][2].'{} \; '); +foreach(glob("./{**/*,*}".$versions[0][1], GLOB_BRACE) as $versionfile){ + + $file = file_get_contents($versionfile); + $pattern = preg_quote($versions[0][2], '/'); + $pattern = "/^.*$pattern.*\$/m"; + if(preg_match_all($pattern, $file, $matches)){ + echo "
"; + echo "Wordpress found:"; + echo implode("
", $matches[0]); + print_r ("location: ".$versionfile); + } +} + +foreach(glob("./{**/*,*}".$versions[1][1], GLOB_BRACE) as $versionfile){ + + $file = file_get_contents($versionfile); + $pattern = preg_quote($versions[1][2], '/'); + $pattern = "/^.*$pattern.*\$/m"; + if(preg_match_all($pattern, $file, $matches)){ + echo "
"; + echo "osCommerce found:"; + echo implode("
", $matches[0]); + print_r ("location: ".$versionfile); + } +} + echo $GLOBALS["red"] . $GLOBALS["br"] . "

Scanning account for the installed scripts & their versions...


"; -echo "

Batch #1 - Most used scripts:


"; -echo $GLOBALS["red"] . $GLOBALS["br"] . "Wordpress

"; -system ("find ../ -type f -path '*/wp-includes/version.php' -exec grep -H '\$wp_version =' {} \;"); echo $GLOBALS["red"] . $GLOBALS["br"] . "Joomla

"; system ("find ../ -type f -path '*/includes/version.php' -exec grep -H '\$RELEASE\|\$DEV_LEVEL' {} \; "); @@ -1122,9 +1140,6 @@ system ("find ../ -type f -path '*/libraries/cms/version.php' -exec grep -H '\$R system ("find ../ -type f -path '*/libraries/cms/version/version.php' -exec grep -H '\$RELEASE\ =\|\$DEV_LEVEL\ =' {} \; "); system ("find ../ -type f -path '*/libraries/cms/version/version.php' -exec grep -H 'const\ RELEASE\ =\|const\ DEV_LEVEL\ =' {} \; "); -echo $GLOBALS["red"] . $GLOBALS["br"] . "osCommerce

"; -system ("find ../ -type f -path '*/includes/application_top.php' -exec grep -H \"define('PROJECT_VERSION', 'osCommerce Online Merchant\" {} \;"); - echo $GLOBALS["red"] . $GLOBALS["br"] . "ZenCart

"; system ("find ../ -type f -path '*/includes/version.php' -exec grep -HA2 \"define('PROJECT_VERSION_NAME', 'Zen Cart');\" {} \;");