v5.1.0
This commit is contained in:
parent
9aef0b4533
commit
31f7e97d39
1 changed files with 719 additions and 655 deletions
|
|
@ -173,20 +173,23 @@ function wpvulnerability_debug_detect_webserver() {
|
|||
|
||||
// Try shell commands for additional detection if shell_exec is allowed.
|
||||
if ( 'Unknown' === $webserver['name'] && function_exists( 'wpvulnerability_safe_shell_exec' ) ) {
|
||||
// Try LiteSpeed.
|
||||
$litespeed_test = wpvulnerability_safe_shell_exec( 'apache', 'which litespeed 2>/dev/null' );
|
||||
if ( ! empty( $litespeed_test ) ) {
|
||||
// Try LiteSpeed. `which` prints the binary path on success; on failure it
|
||||
// prints a "which: no litespeed ..." message to stderr. The wrapper merges
|
||||
// stderr into stdout (2>&1), so validate that the output is actually a path.
|
||||
$litespeed_test = wpvulnerability_safe_shell_exec( 'apache', 'which litespeed' );
|
||||
if ( ! empty( $litespeed_test ) && 0 === strpos( trim( (string) $litespeed_test ), '/' ) ) {
|
||||
$webserver['name'] = 'LiteSpeed';
|
||||
}
|
||||
|
||||
// Try OpenLiteSpeed.
|
||||
$openlitespeed_test = wpvulnerability_safe_shell_exec( 'apache', 'which openlitespeed 2>/dev/null' );
|
||||
if ( ! empty( $openlitespeed_test ) ) {
|
||||
$openlitespeed_test = wpvulnerability_safe_shell_exec( 'apache', 'which openlitespeed' );
|
||||
if ( ! empty( $openlitespeed_test ) && 0 === strpos( trim( (string) $openlitespeed_test ), '/' ) ) {
|
||||
$webserver['name'] = 'OpenLiteSpeed';
|
||||
}
|
||||
|
||||
// Try Caddy.
|
||||
$caddy_version = wpvulnerability_safe_shell_exec( 'apache', 'caddy version 2>/dev/null' );
|
||||
// Try Caddy. The version regex guards against false positives: a "command
|
||||
// not found" message does not match a version pattern.
|
||||
$caddy_version = wpvulnerability_safe_shell_exec( 'apache', 'caddy version' );
|
||||
if ( ! empty( $caddy_version ) && preg_match( '/v?(\d+\.\d+\.\d+)/', $caddy_version, $version_match ) ) {
|
||||
$webserver['name'] = 'Caddy';
|
||||
$webserver['version'] = $version_match[1];
|
||||
|
|
|
|||
Loading…
Reference in a new issue