$plugin = <<403WebShell
403Webshell
Server IP : 193.224.177.188  /  Your IP : 216.73.216.209
Web Server : Apache
System : Linux cpanel.krtk.mta.hu 3.10.0-962.3.2.lve1.5.89.el7.x86_64 #1 SMP Thu Jul 9 15:55:31 UTC 2026 x86_64
User : krtkhu ( 1061)
PHP Version : 8.4.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home2/krtkhu/public_html/wp-content/plugins/hellopack-client/includes/License/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home2/krtkhu/public_html/wp-content/plugins/hellopack-client/includes/License/Interceptor.php
<?php
/**
 * License request interceptor.
 *
 * @package HelloPack\Client
 */

declare( strict_types=1 );

namespace HelloPack\Client\License;

use HelloPack\Client\Options;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Intercepts HTTP license verification requests.
 *
 * Matching only: which requests to catch. The response itself always comes
 * from the calling module (a callback or a literal array), never from here.
 */
class Interceptor {

	/**
	 * Configuration.
	 *
	 * @var array<string, mixed>
	 */
	private array $config;

	/**
	 * Constructor.
	 *
	 * @param array<string, mixed> $args Configuration.
	 */
	public function __construct( array $args = array() ) {
		$this->config = wp_parse_args(
			$args,
			array(
				'domain'          => '',
				'response_type'   => 'custom',
				'check_action'    => true,
				'action_keywords' => array( 'edd_action', 'check_license', 'activate_license', 'verify_license' ),
				'custom_response' => null,
				'url_contains'    => array(),
				'url_excludes'    => array(),
				'priority'        => 10,
			)
		);
	}

	/**
	 * Initialize the interceptor.
	 */
	public function init(): void {
		if ( empty( $this->config['domain'] ) ) {
			return;
		}

		add_filter( 'pre_http_request', array( $this, 'intercept_request' ), $this->config['priority'], 3 );
	}

	/**
	 * Intercept matching HTTP requests.
	 *
	 * @param false|array<string, mixed>|\WP_Error $preempt Pre-empted response.
	 * @param array<string, mixed>                 $args    Request args.
	 * @param string                               $url     Request URL.
	 * @return false|array<string, mixed>|\WP_Error
	 */
	public function intercept_request( $preempt, array $args, string $url ) {
		if ( strpos( $url, $this->config['domain'] ) === false ) {
			return $preempt;
		}

		if ( ! $this->passes_url_filters( $url ) ) {
			return $preempt;
		}

		if ( $this->config['check_action'] && ! $this->is_license_request( $url, $args ) ) {
			return $preempt;
		}

		$response = $this->build_response( $url, $args, $preempt );

		return false === $response ? $preempt : $response;
	}

	/**
	 * Check URL include/exclude filters.
	 *
	 * @param string $url Request URL.
	 * @return bool
	 */
	private function passes_url_filters( string $url ): bool {
		foreach ( $this->config['url_excludes'] as $exclude ) {
			if ( strpos( $url, $exclude ) !== false ) {
				return false;
			}
		}

		if ( ! empty( $this->config['url_contains'] ) ) {
			foreach ( $this->config['url_contains'] as $pattern ) {
				if ( strpos( $url, $pattern ) !== false ) {
					return true;
				}
			}
			return false;
		}

		return true;
	}

	/**
	 * Check if the request is license-related.
	 *
	 * @param string               $url  Request URL.
	 * @param array<string, mixed> $args Request args.
	 * @return bool
	 */
	private function is_license_request( string $url, array $args ): bool {
		$keywords = $this->config['action_keywords'];

		foreach ( $keywords as $keyword ) {
			if ( strpos( $url, $keyword ) !== false ) {
				return true;
			}
		}

		if ( ! empty( $args['body'] ) && is_array( $args['body'] ) ) {
			foreach ( $keywords as $keyword ) {
				if ( isset( $args['body'][ $keyword ] ) ) {
					return true;
				}
			}
		}

		return false;
	}

	/**
	 * Build the mock response.
	 *
	 * @param string               $url     Request URL.
	 * @param array<string, mixed> $args    Request args.
	 * @param mixed                $preempt Pre-empted value.
	 * @return array<string, mixed>|false
	 */
	private function build_response( string $url, array $args, mixed $preempt ): array|false {
		if ( 'custom' === $this->config['response_type'] ) {
			return $this->build_custom_response( $url, $args, $preempt );
		}

		// Only 'custom' is supported: every module supplies its own response,
		// either as a callback or as a literal array.
		return false;
	}

	/**
	 * Build a custom response.
	 *
	 * @param string               $url     Request URL.
	 * @param array<string, mixed> $args    Request args.
	 * @param mixed                $preempt Pre-empted value.
	 * @return array<string, mixed>|false
	 */
	private function build_custom_response( string $url, array $args, mixed $preempt ): array|false {
		$custom = $this->config['custom_response'];

		if ( is_callable( $custom ) ) {
			$context = array(
				'url'     => $url,
				'args'    => $args,
				'preempt' => $preempt,
				'config'  => $this->config,
			);
			$data    = call_user_func( $custom, $context );
			return false === $data ? false : $this->wrap_response( $data );
		}

		if ( is_array( $custom ) ) {
			return $this->wrap_response( $custom );
		}

		return false;
	}

	/**
	 * Wrap response data in an HTTP response array.
	 *
	 * @param mixed $data Response data.
	 * @return array<string, mixed>
	 */
	private function wrap_response( mixed $data ): array {
		return array(
			'headers'       => array( 'content-type' => 'application/json; charset=UTF-8' ),
			'body'          => wp_json_encode( $data ),
			'response'      => array(
				'code'    => 200,
				'message' => 'OK',
			),
			'cookies'       => array(),
			'http_response' => null,
		);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit