Example #1
0
		private function diagnostics_module(){
			$output = '';
			//standard diagnostics
            {
	            $sl_timer = microtime(true);
	            $account = $this->sl_post_request('remote4.php', "act=test_account&host=".$this->host);
	            $sl_timer = microtime(true) - $sl_timer;

		        //curl check
		        $curl = (function_exists('curl_init') && function_exists('curl_exec'));
		        //fopen check
		        $ini_vals = array(1,'1','on','On','ON',true,'true','True','TRUE');
		        $fopen = (function_exists('fopen') && in_array(ini_get('allow_url_fopen'), $ini_vals));

	            $acct_active = $account[0]; // true or reason
				$connected = $this->connected; // type
				$dominfo = $account[1]; //sub~dom
				$php_ver = phpversion(); //actual value
				$client_ip = $account[3];//from our servers, not account
				$client_host = $account[4]; //from our servers, not account
				$file = __FILE__; //abspath
				$docRoot = $_SERVER['DOCUMENT_ROOT'];

				$ver_msg = $this->versionMessage ? $this->versionMessage : $this->getVersionMessage();


		        $output .= '        <!-- Adverts -->';
		        $output .= '        <div class="s5_wrap" >';
		        $output .= '            <div class="s5_w_modwrap">';
		        $output .= '                <div class="s5_backmiddlemiddle2">';
			    $output .= $this->ModuleStart("1", '50', "-light", "Account Verification", "advert", FALSE);
			    /****************************************/
			    //domain
			    //subdomain
			    //active
			    //version
			    $temp = explode('~',$dominfo);
			    $subdomain = $temp[0];
			    $domain = $temp[1];
			    $active = $acct_active=='true' ? 'ACTIVE' : 'DISABLED';
			    $output .= "<br/>Account for <b>$domain</b> is $active<br/><br/>";
			    if($acct_active!='true'){
					$output .= "Reason: $acct_active<br/><br/>";
			    }
			    if(!empty($subdomain)){
					$output .= "Subdomain $subdomain is being used.<br/><br/>";
			    }
			    $output .= "Your version of SecureLive is -$ver_msg";

				$output .= $this->EndModule();
				$output .= $this->ModuleStart("1", "50", "-light", "Test SecureLive", "advert", TRUE);
				/****************************************/
				//ajax test
				$output .= '<br/><input type="button" value="Click to Test" onclick="SL_Test.test(this)" /><br/><br/>';
				$output .= '<div id="sl_test_output"></div>';

		        $output .= $this->EndModule();
		        $output .= '            <div style="clear:both;"></div>'."\n";
		        $output .= '        </div>'."\n";
		        $output .= '    </div>'."\n";
		        $output .= '    <div class="s5_w_modbl"></div>'."\n";
		        $output .= '    <div class="s5_w_modbm"></div>'."\n";
		        $output .= '    <div class="s5_w_modbr"></div>'."\n";
		        $output .= '    <div style="clear:both;"></div>'."\n";
		        $output .= '    <div class="s5_leftshadow" ></div>'."\n";
		        $output .= '    <div class="s5_rightshadow" ></div>'."\n";
		        $output .= '    <!-- End Adverts -->'."\n";
		        $output .= '    <div style="clear:both;"></div>'."\n";
				/////////////////////////////////////////////////////
		        $output .= '    <!-- Bottom Modules -->'."\n";
	            $output .= '        <div class="s5_wrap">'."\n";
	            $output .= '            <div class="s5_bblack_tl"></div>'."\n";
	            $output .= '            <div class="s5_bblack_tm"></div>'."\n";
	            $output .= '            <div class="s5_bblack_tr"></div>'."\n";
	            $output .= '            <div style="clear:both;"></div>'."\n";
	            $output .= '            <div class="s5_bblack_outter">'."\n";
	            $output .= '                <div class="s5_backmiddlemiddle" style="padding-left:8px;">'."\n";
	            $output .= '<div style="padding-top:6px;">';
	            $output .= $this->ModuleStart("1", "50", "", "Connection Info", "user", TRUE);
			    /****************************************/
			    //connection method
			    //speed grade
			    //ip and host
			    if($sl_timer < 0.1){
					$grade = "A+ ($sl_timer seconds)";
			    } elseif($sl_timer < 0.2){
					$grade = "A ($sl_timer seconds)";
			    } elseif($sl_timer < 0.3){
					$grade = "A- ($sl_timer seconds)";
			    } elseif($sl_timer < 0.4){
					$grade = "B+ ($sl_timer seconds)";
			    } elseif($sl_timer < 0.5){
					$grade = "B ($sl_timer seconds)";
			    } elseif($sl_timer < 1){
					$grade = "B- ($sl_timer seconds)";
			    } elseif($sl_timer < 1.5){
					$grade = "C+ ($sl_timer seconds)";
			    } elseif($sl_timer < 2){
					$grade = "C ($sl_timer seconds)";
			    } elseif($sl_timer < 2.5){
					$grade = "C- ($sl_timer seconds)";
			    } elseif($sl_timer < 3){
					$grade = "D+ ($sl_timer seconds)";
			    } elseif($sl_timer < 3.5){
					$grade = "D ($sl_timer seconds)";
			    } elseif($sl_timer < 4){
					$grade = "D- ($sl_timer seconds)";
			    } else {
					$grade = "F ($sl_timer seconds)";
			    }
			    $output .= "Connection Method: $connected<br/><br/>";
			    $output .= "Connection Grade: $grade<br/><br/>";
			    $output .= "Remote IP: $client_ip<br/><br/>";
			    $output .= "Remote Host: $client_host<br/><br/>";

				$output .= $this->EndModule();
				$output .= $this->ModuleStart("1", "50", "", "Server Info", "user", TRUE);
				/****************************************/
				$output .= "PHP version: $php_ver<br/><br/>";
				if($curl){
					$output .= "cURL: enabled<br/><br/>";
				} else {
					$output .= "cURL: disabled<br/><br/>";
				}
				if($fopen){
					$output .= "fopen: enabled<br/><br/>";
				} else {
					$output .= "fopen: disabled<br/><br/>";
				}
				$output .= "Document Root: $docRoot<br/><br/>";
				$output .= "Absolute File Path: $file<br/><br/>";

		        $output .= $this->EndModule();
		        $output .= '                        <div style="clear:both;"></div>'."\n";
		        $output .= '                    </div>'."\n";
		        $output .= '                </div>'."\n";
		        $output .= '                <div class="s5_bblack_bl"></div>'."\n";
		        $output .= '                <div class="s5_bblack_bm"></div>'."\n";
		        $output .= '                <div class="s5_bblack_br"></div>'."\n";
		        $output .= '                <div style="clear:both;"></div>'."\n";
		        $output .= '                <div class="s5_leftshadow"></div>'."\n";
		        $output .= '                <div class="s5_rightshadow"></div>'."\n";
		        $output .= '            </div>'."\n";
		        $output .= '            <!-- End Bottom Modules -->'."\n";
		        $output .= '            <div style="clear:both;"></div>'."\n";
			}
            //CMS specific diagnostics
            {
            	if(!defined('DS')){define( 'DS', DIRECTORY_SEPARATOR );}
				if(!defined('JPATH_BASE')){define('JPATH_BASE', $_SERVER['DOCUMENT_ROOT']);}
				$jFile1 = JPATH_BASE .DS.'includes'.DS.'defines.php';
				$jFile2 = JPATH_BASE .DS.'includes'.DS.'framework.php';
				
				if($this->is_joomla() && file_exists($jFile1) && file_exists($jFile2)){
					
					define( '_JEXEC', 1 );
					include ( $jFile1 );
					include ( $jFile2 );
					
					$this->mainframe =& JFactory::getApplication('site');
					
	                $output .= '        <!-- Adverts -->';
	                $output .= '        <div class="s5_wrap" >';
	                $output .= '            <div class="s5_w_modwrap">';
	                $output .= '                <div class="s5_backmiddlemiddle2">';
	                $output .= $this->ModuleStart("1", "100", "", "Component Diagnosis", "advert", TRUE);

					//check components for bridges
	                $components = JComponentHelper::_Load();
	                $unprotected = array();
	                foreach($components as $com){
						if(substr_count(strtolower($com->name),'bridge')){
							array_push($unprotected,$com->name);
						}
	                }
	                if(count($unprotected)>0 && substr_count($this->account->acct_type,'sj')){
						//show which components and recommend...
						$output .= "Component Scan complete! We detected <b>possible vulnerabilities</b> with the following:<br/><br/>\n";
						foreach($unprotected as $name){
							$output .= "Component: <b>$name</b> is a bridge<br/>\n";
						}
						$output .= "<br/>This means that the components listed \"bridge\" 3rd-party software with Joomla, and SecureJoomla does not protect software that is run outside of Joomla (or that can be accessed outside of Joomla). We recommend that you either upgrade to SecureLive Max, Server Edition, or discontinue use of the 3rd party software that is bridged into Joomla.";
	                } elseif(substr_count($this->account->acct_type,'slm')){
						$output .= "Component Scan complete! You are using SecureLive Server-Edition, so all of your components are currently being protected by SecureLive.\n";
	                } else {
						//say they all passed
						$output .= "Component Scan complete! We did not find any bridges, so all of your components are currently being protected by SecureLive.\n";
	                }

	                $output .= $this->EndModule();
	                $output .= '            <div style="clear:both;"></div>'."\n";
	                $output .= '        </div>'."\n";
	                $output .= '    </div>'."\n";
	                $output .= '    <div class="s5_w_modbl"></div>'."\n";
	                $output .= '    <div class="s5_w_modbm"></div>'."\n";
	                $output .= '    <div class="s5_w_modbr"></div>'."\n";
	                $output .= '    <div style="clear:both;"></div>'."\n";
	                $output .= '    <div class="s5_leftshadow" ></div>'."\n";
	                $output .= '    <div class="s5_rightshadow" ></div>'."\n";
	                $output .= '    <!-- End Adverts -->'."\n";
	                $output .= '    <div style="clear:both;"></div>'."\n";
	                
	                global $sl_admin;
					$sl_admin = $this;
	                
	            }
            }
			return "DONE*sl^module#message*$output";
		}
Example #2
0
			if ($sl_timer > 1 && $sl_timer < 2.5){
				array_push($warnings, "Connection speed from your server to SecureLive's server is in fair condition, the response times should be investigated.");
				$cmsscore += .5;
			}
			if ($sl_timer > 2.5 && $sl_timer < 4){
				array_push($warnings, "Connection speed from your server to SecureLive's server is in poor condition, the response times should be investigated.");
				$cmsscore += 3.5;
			}
			if ($sl_timer > 4){
				array_push($warnings, "Connection speed from your server to SecureLive's server is in very poor condition, there is a problem and should be investigated.");
				$cmsscore += 9.5;
			}

			# Bridge Components installed and Joomla version
			if(substr_count($this->account->acct_type,'slm') == false){
			    $components = JComponentHelper::_Load();
			    $unprotected = array();
			    foreach($components as $com){
					if(substr_count(strtolower($com->name),'bridge')){
						$cmsscore += 4.5;
						array_push($warnings, "<b>".$com->name."</b> is a bridge. Bridged software such as Forums, Galleries or other software that is not installed with the Joomla framework is not protected outside of Joomla. These scripts can be ran independantly from outside of Joomla and SecureLive does not protect these programs. You may change your version of SecureLive to SecureLive Server Edition to protect these types of programs. <a href='#' onclick='sl_gateway.open(\"help\",\"&id=bridge_warn\");return false;'>What do I do?</a>");
					}
			    }
			}
		}
	}

	/**
	* Display the results in a nice rounded card with a score
	*
	* @var float