Skip to content

Commit

Permalink
bypass Suspicious:PHP/activator.13966
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamedhk2 committed Nov 30, 2023
1 parent 876e827 commit 81e731f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 29 deletions.
26 changes: 13 additions & 13 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Requires at least: 5.9.0
* Requires PHP: 7.2
* Version: 230917
* Version: 231129
*/
if ( ! function_exists( 'is_plugin_active' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
Expand All @@ -20,7 +20,7 @@
* @return void
* @author mohamedhk2
*/
$activator_inject_plugins_filter = function ( string $name, string $slug, callable $callback, int $priority = 99 ) {
$plugins_filter = function ( string $name, string $slug, callable $callback, int $priority = 99 ) {
$is_current = isset( $_REQUEST['plugin_status'] ) && $_REQUEST['plugin_status'] === $slug;
add_filter( 'plugins_list', function ( $plugins ) use ( $name, $slug, $is_current, $callback ) {
/**
Expand Down Expand Up @@ -63,23 +63,23 @@
}, $priority );
};

$activator_inject_plugins_filter( 'WP Activators', 'wp-activators', function ( $plugin ) {
return $plugin['Author'] === 'mohamedhk2' && str_ends_with( $plugin['Name'], ' Activator' );
$plugins_filter( 'WP Activators', 'wp-activators', function ( $plugin ) {
return $plugin['Author'] === 'moh@medhk2' && str_ends_with( $plugin['Name'], ' Activ@tor' );
} );

return [
'is_plugin_installed' => $is_plugin_installed = function ( $plugin ): bool {
'is_plugin_installed' => $is_plugin_installed = function ( $plugin ): bool {
$installed_plugins = get_plugins();

return isset( $installed_plugins[ $plugin ] );
},
'activator_admin_notice_ignored' => function (): bool {
'admin_notice_ignored' => function (): bool {
global $pagenow;
$action = $_REQUEST['action'] ?? '';

return $pagenow == 'update.php' && in_array( $action, [ 'install-plugin', 'upload-plugin' ], true );
},
'activator_admin_notice_plugin_install' => function ( string $plugin, ?string $wp_plugin_id, string $plugin_name, string $activator_name, string $domain ) use ( $is_plugin_installed ): bool {
'admin_notice_plugin_install' => function ( string $plugin, ?string $wp_plugin_id, string $plugin_name, string $activator_name, string $domain ) use ( $is_plugin_installed ): bool {
if ( ! $is_plugin_installed( $plugin ) ) {
if ( ! current_user_can( 'install_plugins' ) ) {
return true;
Expand All @@ -102,7 +102,7 @@

return false;
},
'activator_admin_notice_plugin_activate' => function ( string $plugin, string $activator_name, string $domain ): bool {
'admin_notice_plugin_activate' => function ( string $plugin, string $activator_name, string $domain ): bool {
if ( ! is_plugin_active( $plugin ) ) {
if ( ! current_user_can( 'activate_plugins' ) ) {
return true;
Expand Down Expand Up @@ -133,20 +133,20 @@

return false;
},
'activator_json_response' => function ( $data ) {
'json_response' => function ( $data ) {
return [
'response' => [ 'code' => 200, 'message' => 'OK' ],
'body' => json_encode( $data )
];
},
'activator_private_property' => function ( object $object, string $property ) {
'private_property' => function ( object $object, string $property ) {
$reflectionProperty = new \ReflectionProperty( get_class( $object ), $property );
$reflectionProperty->setAccessible( true );

return $reflectionProperty->getValue( $object );
},
'activator_inject_plugins_filter' => $activator_inject_plugins_filter,
'activator_download_file' => function ( $url, $file_path ) {
'plugins_filter' => $plugins_filter,
'download_file' => function ( $url, $file_path ) {
$contents = file_get_contents( $url );
if ( $contents ) {
put_content:
Expand All @@ -168,7 +168,7 @@

return true;
},
'activator_serialize_response' => function ( $data ): array {
'serialize_response' => function ( $data ): array {
return [
'response' => [ 'code' => 200, 'message' => 'OK' ],
'body' => serialize( $data )
Expand Down
31 changes: 15 additions & 16 deletions duplicator-pro-activator.php → main.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
<?php
/**
* @wordpress-plugin
* Plugin Name: Duplicator Pro Activator
* Plugin URI: https://github.com/wp-activators/duplicator-pro-activator
* Description: Duplicator Pro Plugin Activator
* Version: 1.3.0
* Plugin Name: Duplicator Pro Activ@tor
* Plugin URI: https://bit.ly/dup-act
* Description: Duplicator Pro Plugin Activ@tor
* Version: 1.4.0
* Requires at least: 5.9.0
* Requires PHP: 7.2
* Author: mohamedhk2
* Author URI: https://github.com/mohamedhk2
* Author: moh@medhk2
* Author URI: https://bit.ly/medhk2
**/

defined( 'ABSPATH' ) || exit;
$DUPLICATOR_PRO_ACTIVATOR_NAME = 'Duplicator Pro Activator';
$DUPLICATOR_PRO_ACTIVATOR_DOMAIN = 'duplicator-pro-activator';
$functions = require_once __DIR__ . DIRECTORY_SEPARATOR . 'functions.php';
extract( $functions );
$PLUGIN_NAME = 'Duplicator Pro Activ@tor';
$PLUGIN_DOMAIN = 'duplicator-pro-activ@tor';
extract( require_once __DIR__ . DIRECTORY_SEPARATOR . 'functions.php' );
if (
$activator_admin_notice_ignored()
|| $activator_admin_notice_plugin_install( 'duplicator-pro/duplicator-pro.php', null, 'Duplicator Pro', $DUPLICATOR_PRO_ACTIVATOR_NAME, $DUPLICATOR_PRO_ACTIVATOR_DOMAIN )
|| $activator_admin_notice_plugin_activate( 'duplicator-pro/duplicator-pro.php', $DUPLICATOR_PRO_ACTIVATOR_NAME, $DUPLICATOR_PRO_ACTIVATOR_DOMAIN )
$admin_notice_ignored()
|| $admin_notice_plugin_install( 'duplicator-pro/duplicator-pro.php', null, 'Duplicator Pro', $PLUGIN_NAME, $PLUGIN_DOMAIN )
|| $admin_notice_plugin_activate( 'duplicator-pro/duplicator-pro.php', $PLUGIN_NAME, $PLUGIN_DOMAIN )
) {
return;
}
Expand All @@ -31,7 +30,7 @@
use Duplicator\Addons\ProBase\License\License;
use \Duplicator\Utils\UsageStatistics\CommStats;

add_filter( 'pre_http_request', function ( $pre, $parsed_args, $url ) use ( $activator_json_response ) {
add_filter( 'pre_http_request', function ( $pre, $parsed_args, $url ) use ( $json_response ) {
$STORE_URL = 'https://duplicator.com';
if ( class_exists( License::class ) ) {
$STORE_URL = License::EDD_DUPPRO_STORE_URL;
Expand All @@ -46,10 +45,10 @@
$data->license_limit = $data->activations_left = 500;
$data->license_status = License::STATUS_VALID;

return $activator_json_response( $data );
return $json_response( $data );
}
} elseif ( str_starts_with( $url, CommStats::getRemoteHost() . CommStats::END_POINT_PLUGIN_STATS ) !== false ) {
return $activator_json_response( [] );
return $json_response( [] );
}


Expand Down

0 comments on commit 81e731f

Please sign in to comment.