• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Freemius - Universal Freemius SDK Null

sharmanhall

Well-known member
Trusted Uploader
Aug 7, 2022
518
1,265
93
⭐️⭐️⭐️⭐️⭐️
Has anyone created a UNIVERSAL Freemius SDK null?
I have attempted my own, and it seems to work well! Null once, and works on ALL Freemius plugins!

---------------------
OVERVIEW:
There are a lot of plugins that use Freemius for plugin activations.
If we get a master-nulled Freemius SDK, we can just replace the freemius SDK folder on every Freemius-enabled plugin!

---------------------
A few plugins I know that use Freemius SDK:
- Buttonizer
- LiveMesh for Elementor/Beaver Builder
- Post to Google My Business
- Unlimited Elements for Elementor
- Addons for Elementor (LiveMesh)
- WP Activity Log
- Woo Floating Cart Pro
- Robin Image Optimizer
- WP Sheet Editor
- Woo Custom Fields
---------------------
GUIDE:
1) Install a plugin, that uses Freemius, like Buttonizer.

2) Navigate to: /wp-admin/admin.php?page=freemius to see what Freemius SDK is running
Freemius-Step-3.png

3) Verify if Freemius is running (See "Active" in the screenshot above)
(Freemius SDK v2.4.4 is active)


4) Go to the plugin install directory, and replace the Freemius SDK folder (v2.4.3) with the nulled version (v2.5.0.1).

4-1) Either rename the folder, or delete it:
Freemius-Step-3-1.png
4-2) Unzip the nulled Freemius (v2.5.0.1)
Note: the nulled version of Freemius needs to be higher than any other plugin's version of Freemius SDK for this to work. Freemius-Step-3-2.png

4-3)
Return to /wp-admin/admin.php?page=freemius and verify the new Freemius SDK version has become active.
Note: the first photo, you can see LiveMesh was the active SDK (v2.4.4) because Buttonizer's was a lower version (v2.4.3)
But now, after using a SDK version higher than v2.4.4, Buttonizer's Freemius SDK takes over (v2.5.0.1)!!!
I made up the version number. It doesn't exist.
Freemius-Step-3-3.png

Let's see if a master nuller can do a better job than me!
Thanks for accepting me into the forum -- I haven't seen anywhere anyone trying to null the actual Freemius SDK, but I think it could help a bunch!

I am not sure if I can post the nulled Freemius SDK here, but if mods allow, I will share what I have.
 
I should note that if you are having issues with Freemius SDK, there is a plugin that I found that clears Freemius DB.

-----

Freemius Fixer: https://github.com/Freemius/freemius-fixer

What does it do?
1) Backs up Freemius data.
2) Cleanup of the Freemius data to start fresh.

-----

This could likely be used to create an on-demand Freemius nuller plugin for ALL instances of the Freemius SDK on the website.

It would need a little rewriting, but this could be valuable to creating a universal Freemius SDK nuller!

Imagine a plugin that Nulls all your Freemius SDK installations in a single click of a button!!

Here is the plugin code:
PHP:
<?php
    /**
     * Plugin Name: Freemius Fixer
     * Plugin URI:  https://freemius.com/
     * Description: Back up and delete all Freemius DB records.
     * Version:     1.0.0
     * Author:      Freemius
     * Author URI:  https://freemius.com
     * License: GPL2
     */

    /**
     * @package     Freemius Fixer
     * @copyright   Copyright (c) 2016, Freemius, Inc.
     * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
     * @since       1.0.0
     */

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

    define( 'WP_FS_CLEANUP__PLUGIN_NAME', __( 'Freemius Fixer' ) );

    add_action( 'init', 'fs_cleanup_check_action' );

    function fs_cleanup_check_action() {
        if ( isset( $_POST['fs_cleanup_action'] ) && ! empty( $_POST['fs_cleanup_action'] ) ) {
            check_admin_referer( 'fs_cleanup_action_' . $_POST['fs_cleanup_action'] );

            if ( 'download' === $_POST['fs_cleanup_action'] ) {
                fs_download_data_dump();
            } else {
                fs_cleanup();
            }
        }
    }

    add_action(
        ( is_multisite() && is_network_admin() ? 'network_' : '' ) . 'admin_menu',
        'fs_cleanup_add_settings_menu'
    );

    function fs_cleanup_add_settings_menu() {
        add_menu_page(
            WP_FS_CLEANUP__PLUGIN_NAME,
            WP_FS_CLEANUP__PLUGIN_NAME,
            'manage_options',
            'fs_cleanup',
            'fs_cleanup_render_settings_menu'
        );
    }

    function fs_cleanup_render_settings_menu() {
        ?>
        <div class="wrap">
            <h1><?php echo esc_html( get_admin_page_title() ) ?></h1>
            <h2><?php _e( 'IMPORTANT: Please download the data dump first and only then click the Fix button.' ) ?></h2>
            <table class="widefat">
                <tbody>
                <tr>
                    <td>
                        <form action="" method="post">
                            <?php wp_nonce_field( 'fs_cleanup_action_download' ) ?>
                            <input type="hidden" name="fs_cleanup_action" value="download"/>
                            <input type="submit" class="button button-primary" value="<?php esc_attr_e( '(1) Download Data' ) ?>">
                        </form>
                    </td>
                        <td><?php _e( 'Please download the corrupted data and send it to the Freemius team via [email protected], along with the error description, for further investigation so the issue can be fixed for others.' ) ?></td>
                </tr>
                <tr class="alternate">
                    <td>
                        <form action="" method="post">
                            <?php wp_nonce_field( 'fs_cleanup_action_cleanup' ) ?>
                            <input type="hidden" name="fs_cleanup_action" value="cleanup"/>
                            <input
                                onclick="if ( confirm( '<?php _e( 'Are you sure you want to clean up the data now? If you have already downloaded the data dump, please proceed.' ) ?>' ) ) this.parentNode.submit(); return false;"
                                type="submit"
                                class="button button-secondary"
                                value="<?php esc_attr_e( '(2) Fix - Clean Up Data & Deactivate' ) ?>">
                        </form>
                    </td>
                    <td><?php _e( 'This will clean up the corrupted data and will auto deactivate this cleanup plugin. After the cleanup you are safe to activate the plugin or theme that had the issue.' ) ?></td>
                </tr>
                </tbody>
            </table>
        </div>
        <?php
    }

    function fs_get_site_freemius_data( $is_network = false ) {
        global $wpdb;

        $fs_option_names = ( "'" . implode( "','", array(
                'fs_accounts',
                'fs_dbg_accounts',
                'fs_active_plugins',
                'fs_api_cache',
                'fs_dbg_api_cache',
                'fs_debug_mode',
            ) ) . "'" );

        if ( $is_network ) {
            $network_id = get_current_network_id();
            $query      = "SELECT meta_key AS option_name, meta_value AS option_value FROM {$wpdb->sitemeta} WHERE meta_key IN ({$fs_option_names}) AND meta_value <> '' AND site_id = {$network_id}";
        } else {
            $query = "SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name IN ({$fs_option_names}) AND option_value <> ''";
        }

        $fs_options_from_db = $wpdb->get_results( $query );

        $fs_options = array();

        foreach ( (array) $fs_options_from_db as $option ) {
            $fs_options[ $option->option_name ] = maybe_unserialize( $option->option_value );
        }

        return $fs_options;
    }

    function fs_get_sites() {
        if ( function_exists( 'get_sites' ) ) {
            // For WP 4.6 and above.
            return get_sites();
        } else if ( function_exists( 'wp_get_sites' ) ) {
            // For WP 3.7 to WP 4.5.
            return wp_get_sites();
        } else {
            // For WP 3.6 and below.
            return get_blog_list( 0, 'all' );
        }
    }

    function fs_download_data_dump() {
        global $wpdb;

        $suppress = $wpdb->suppress_errors();

        $site_fs_options = array();

        if ( ! is_multisite() ) {
            $site_fs_options[] = fs_get_site_freemius_data();
        } else {
            $sites = fs_get_sites();

            foreach ( $sites as $site ) {
                $blog_id = ( $site instanceof WP_Site ) ?
                    $site->blog_id :
                    $site['blog_id'];

                switch_to_blog( $blog_id );

                $fs_options = fs_get_site_freemius_data();

                if ( ! empty( $fs_options ) ) {
                    $site_fs_options[ $blog_id ] = $fs_options;
                }
            }

            $site_fs_options['network'] = fs_get_site_freemius_data( true );
        }

        $wpdb->suppress_errors( $suppress );

        $filename     = ( 'fs-data-dump-' . date( 'YmdHis' ) . '.txt' );
        $file_content = json_encode( $site_fs_options );

        header( 'Content-Type: application/octet-stream' );
        header( "Content-disposition: attachment; filename={$filename}" );
        header( 'Content-Length: ' . strlen( $file_content ) );

        echo $file_content;

        exit;
    }

    function fs_network_cleanup() {
        delete_site_option( 'fs_accounts' );
        delete_site_option( 'fs_dbg_accounts' );
        delete_site_option( 'fs_active_plugins' );
        delete_site_option( 'fs_api_cache' );
        delete_site_option( 'fs_dbg_api_cache' );
        delete_site_option( 'fs_debug_mode' );
    }

    function fs_site_cleanup() {
        delete_option( 'fs_accounts' );
        delete_option( 'fs_dbg_accounts' );
        delete_option( 'fs_active_plugins' );
        delete_option( 'fs_api_cache' );
        delete_option( 'fs_dbg_api_cache' );
        delete_option( 'fs_debug_mode' );
    }

    function fs_cleanup() {
        if ( ! is_multisite() ) {
            fs_site_cleanup();
        } else {
            $sites = fs_get_sites();

            foreach ( $sites as $site ) {
                $blog_id = ( $site instanceof WP_Site ) ?
                    $site->blog_id :
                    $site['blog_id'];

                switch_to_blog( $blog_id );

                fs_site_cleanup();
            }

            fs_network_cleanup();
        }

        if ( ! function_exists( 'get_plugins' ) ) {
            require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
        }

        deactivate_plugins( plugin_basename( __FILE__ ) );

        wp_die( __( 'Freemius records successfully cleared! You are now safe to activate any Freemius-powered plugin or theme.' ), __( 'Error' ) );
    }

    add_action( 'activated_plugin', 'fs_cleanup_activation_redirect_to_settings_page' );

    function fs_cleanup_activation_redirect_to_settings_page( $plugin ) {
        if ( $plugin == plugin_basename( __FILE__ ) ) {
            $path = 'admin.php?page=fs_cleanup';

            $url = is_network_admin() ?
                network_admin_url( $path ) :
                admin_url( $path );

            exit( wp_redirect( $url ) );
        }
    }
 

Attachments

  • freemius-fixer-master.zip
    72.6 KB · Views: 24
  • Like
Reactions: TassieNZ
WARNING: USE AT YOUR OWN RISK.

So here is my attempt at a Universal Freemius SDK Null v2.5.0.1

The Freemius SDK (V2.5.0.1) was ripped from this plugin:
https://wordpress.org/plugins/post-to-google-my-business/

----------

Whats included:
- NULLED FREEMIUS 2.5.0.1 SDK (Poorly Nulled lol)
- Original Freemius SDK v2.5.0.1 (Untouched)
- Post to Google My Business Plugin (Original / Untouched)

Install Post to Google My Business,
& replace the Freemius folder with the nulled one here.

----------

With all the nullers here, I think this could be a beneficial endeavor!

WARNING: USE AT YOUR OWN RISK.
 

Attachments

  • freemius-v2.5.0.1-UNIVERSAL-NULLED.zip
    1.9 MB · Views: 71
  • freemius-sdk-2.5.0.1-ORIGINAL.zip
    822.6 KB · Views: 30
  • post-to-google-my-business.3.0.20.zip
    2.1 MB · Views: 16
  • Love
Reactions: TassieNZ
WOW! That one is *much* better than mine; mine is inconsistent -- especially in the 26,000-line-file named class-freemius.php

-----

If done right, any Freemius plugins won't need anything except the Freemius nulled -- and we can leave the rest of the plugin code untouched.

My goal is a universally nulled Freemius SDK that can be deployed through a single plugin installation -- similar to "Freemius Fixer"

The version number would be 9.9.9.9 to ensure that all other Freemius plugins are guaranteed nulled lol

We could deploy a dedicated plugin just to run the nulled Freemius and override all the other plugin's SDK's.
Maybe im just thinking too big lol
 
WOW! That one is *much* better than mine; mine is inconsistent -- especially in the 26,000-line-file named class-freemius.php

-----

If done right, any Freemius plugins won't need anything except the Freemius nulled -- and we can leave the rest of the plugin code untouched.

My goal is a universally nulled Freemius SDK that can be deployed through a single plugin installation -- similar to "Freemius Fixer"

The version number would be 9.9.9.9 to ensure that all other Freemius plugins are guaranteed nulled lol

We could deploy a dedicated plugin just to run the nulled Freemius and override all the other plugin's SDK's.
Maybe im just thinking too big lol
LOL Just thought mine may be of use for you to fine tune yours. :)

Your thinking is good and it's worth doing. Was just giving a helping hand as too busy to do it right now. It's good to see a new member actually trying to help, rather than just the usual beg, beg, beg! :love:

Good luck with the project.

TassieNZ :)
 
Last edited:
LOL Just thought mine may be of use for you to fine tune yours. :)

Your thinking is good and it's worth doing. Was just giving a helping hand as too busy to do it right now. It's good to see a new member actually trying to help, rather than just the usual beg, beg, beg! :love:

Good luck with the project.

TassieNZ :)
Ok, so here is my attempt to make a full plugin deploy:

PHP:
<?php
    /**
     * Plugin Name: Freemius SDK (Nulled)
     * Plugin URI:  https://babia.to/
     * Description: Automatically null Freemius SDK
     * Version:     6969
     * Author:      sharmanhall, TassieNZ
     * Author URI:  https://babia.to/
     * License: GPL2
     */

    /**
     * @package     Freemius SDK (Nulled)
     * @copyright   Copyright (c) 2022, babiato, Inc.
     * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
     * @since       1.0.0
     */

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

    if ( version_compare( PHP_VERSION, '7.0', '<' ) ) {
    exit( sprintf( 'Freemius SDK Nulled requires PHP 7.0 or higher. Your WordPress site is using PHP %s.', PHP_VERSION ) );
    }
    global  $wp_version ;
    if ( version_compare( $wp_version, '4.9.0', '<' ) ) {
        exit( sprintf( 'Freemius SDK Nulled requires WordPress 4.9.0 or higher. Your WordPress version is %s.', $wp_version ) );
    }

    define( 'WP_FS_CLEANUP__PLUGIN_NAME', __( 'Freemius SDK Nulled by Sharmanhall' ) );

    add_action( 'init', 'fs_cleanup_check_action' );

    function fs_cleanup_check_action() {
        if ( isset( $_POST['fs_cleanup_action'] ) && ! empty( $_POST['fs_cleanup_action'] ) ) {
            check_admin_referer( 'fs_cleanup_action_' . $_POST['fs_cleanup_action'] );

            if ( 'download' === $_POST['fs_cleanup_action'] ) {
                fs_download_data_dump();
            } elseif ( 'cleanup' === $_POST['fs_cleanup_action'] ){
                fs_cleanup();
            }
            elseif ( 'getnulled' === $_POST['fs_cleanup_action'] ){
                fs_getnulled();

            }
        }
    }

    add_action(
        ( is_multisite() && is_network_admin() ? 'network_' : '' ) . 'admin_menu',
        'fs_cleanup_add_settings_menu'
    );

    function fs_cleanup_add_settings_menu() {
        add_menu_page(
            WP_FS_CLEANUP__PLUGIN_NAME,
            WP_FS_CLEANUP__PLUGIN_NAME,
            'manage_options',
            'fs_cleanup',
            'fs_cleanup_render_settings_menu'
        );
    }

    function fs_cleanup_render_settings_menu() {
        ?>
        <div class="wrap">
            <h1><?php echo esc_html( get_admin_page_title() ) ?></h1>
            <h2><?php _e( 'IMPORTANT: Please download the data dump first and only then click the Fix button. THEN null your installation using the NULL button!' ) ?></h2>
            <table class="widefat">
                <tbody>
                <tr>
                    <td>
                        <form action="" method="post">
                            <?php wp_nonce_field( 'fs_cleanup_action_download' ) ?>
                            <input type="hidden" name="fs_cleanup_action" value="download"/>
                            <input type="submit" class="button button-primary" value="<?php esc_attr_e( '(1) Download Data' ) ?>">
                        </form>
                    </td>
                        <td><?php _e( 'Please download the corrupted data and send it to the Freemius team via [email protected], along with the error description, for further investigation so the issue can be fixed for others.' ) ?></td>
                </tr>
                <tr class="alternate">
                    <td>
                        <form action="" method="post">
                            <?php wp_nonce_field( 'fs_cleanup_action_cleanup' ) ?>
                            <input type="hidden" name="fs_cleanup_action" value="cleanup"/>
                            <input
                                onclick="if ( confirm( '<?php _e( 'Are you sure you want to clean up the data now? If you have already downloaded the data dump, please proceed.' ) ?>' ) ) this.parentNode.submit(); return false;"
                                type="submit"
                                class="button button-secondary"
                                value="<?php esc_attr_e( '(2) Fix - Clean Up Data & Deactivate' ) ?>">
                        </form>
                    </td>
                    <td><?php _e( 'This will clean up the corrupted data and will auto deactivate this cleanup plugin. After the cleanup you are safe to activate the plugin or theme that had the issue.' ) ?></td>
                </tr>
                <tr>
                    <td>
                        <form action="" method="post">
                            <?php wp_nonce_field( 'fs_cleanup_action_null' ) ?>
                            <input type="hidden" name="fs_cleanup_action" value="getnulled"/>
                            <input type="submit" class="button button-primary" value="<?php esc_attr_e( '(3) Get Freemius Nulled' ) ?>">
                        </form>
                    </td>
                        <td><?php _e( 'Click here to null Freemius!' ) ?></td>
                </tr>
                </tbody>
            </table>
        </div>
        <?php
    }

    function fs_get_site_freemius_data( $is_network = false ) {
        global $wpdb;

        $fs_option_names = ( "'" . implode( "','", array(
                'fs_accounts',
                'fs_dbg_accounts',
                'fs_active_plugins',
                'fs_api_cache',
                'fs_dbg_api_cache',
                'fs_debug_mode',
            ) ) . "'" );

        if ( $is_network ) {
            $network_id = get_current_network_id();
            $query      = "SELECT meta_key AS option_name, meta_value AS option_value FROM {$wpdb->sitemeta} WHERE meta_key IN ({$fs_option_names}) AND meta_value <> '' AND site_id = {$network_id}";
        } else {
            $query = "SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name IN ({$fs_option_names}) AND option_value <> ''";
        }

        $fs_options_from_db = $wpdb->get_results( $query );

        $fs_options = array();

        foreach ( (array) $fs_options_from_db as $option ) {
            $fs_options[ $option->option_name ] = maybe_unserialize( $option->option_value );
        }

        return $fs_options;
    }

    function fs_get_sites() {
        if ( function_exists( 'get_sites' ) ) {
            // For WP 4.6 and above.
            return get_sites();
        } else if ( function_exists( 'wp_get_sites' ) ) {
            // For WP 3.7 to WP 4.5.
            return wp_get_sites();
        } else {
            // For WP 3.6 and below.
            return get_blog_list( 0, 'all' );
        }
    }

    function fs_download_data_dump() {
        global $wpdb;

        $suppress = $wpdb->suppress_errors();

        $site_fs_options = array();

        if ( ! is_multisite() ) {
            $site_fs_options[] = fs_get_site_freemius_data();
        } else {
            $sites = fs_get_sites();

            foreach ( $sites as $site ) {
                $blog_id = ( $site instanceof WP_Site ) ?
                    $site->blog_id :
                    $site['blog_id'];

                switch_to_blog( $blog_id );

                $fs_options = fs_get_site_freemius_data();

                if ( ! empty( $fs_options ) ) {
                    $site_fs_options[ $blog_id ] = $fs_options;
                }
            }

            $site_fs_options['network'] = fs_get_site_freemius_data( true );
        }

        $wpdb->suppress_errors( $suppress );

        $filename     = ( 'fs-data-dump-' . date( 'YmdHis' ) . '.txt' );
        $file_content = json_encode( $site_fs_options );

        header( 'Content-Type: application/octet-stream' );
        header( "Content-disposition: attachment; filename={$filename}" );
        header( 'Content-Length: ' . strlen( $file_content ) );

        echo $file_content;

        exit;
    }

    function fs_network_cleanup() {
        delete_site_option( 'fs_accounts' );
        delete_site_option( 'fs_dbg_accounts' );
        delete_site_option( 'fs_active_plugins' );
        delete_site_option( 'fs_api_cache' );
        delete_site_option( 'fs_dbg_api_cache' );
        delete_site_option( 'fs_debug_mode' );
    }

    function fs_site_cleanup() {
        delete_option( 'fs_accounts' );
        delete_option( 'fs_dbg_accounts' );
        delete_option( 'fs_active_plugins' );
        delete_option( 'fs_api_cache' );
        delete_option( 'fs_dbg_api_cache' );
        delete_option( 'fs_debug_mode' );
    }

    function fs_cleanup() {
        if ( ! is_multisite() ) {
            fs_site_cleanup();
        } else {
            $sites = fs_get_sites();

            foreach ( $sites as $site ) {
                $blog_id = ( $site instanceof WP_Site ) ?
                    $site->blog_id :
                    $site['blog_id'];

                switch_to_blog( $blog_id );

                fs_site_cleanup();
            }

            fs_network_cleanup();
        }

        if ( ! function_exists( 'get_plugins' ) ) {
            require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
        }

        deactivate_plugins( plugin_basename( __FILE__ ) );

        wp_die( __( 'Freemius records successfully cleared! You are now safe to activate any Freemius-powered plugin or theme.' ), __( 'Error' ) );
    }

    add_action( 'activated_plugin', 'fs_cleanup_activation_redirect_to_settings_page' );

    function fs_cleanup_activation_redirect_to_settings_page( $plugin ) {
        if ( $plugin == plugin_basename( __FILE__ ) ) {
            $path = 'admin.php?page=fs_cleanup';

            $url = is_network_admin() ?
                network_admin_url( $path ) :
                admin_url( $path );

            exit( wp_redirect( $url ) );
        }
    }

    function fs_getnulled() {
        if ( function_exists( 'mbp_fs' ) ) {
            // Create a helper function for easy SDK access.
            mbp_fs()->set_basename( false, __FILE__ );
        } else {
            if ( !function_exists( 'mbp_fs' ) ) {
                function mbp_fs()
                {
                    global  $mbp_fs ;
                    
                    if ( !isset( $mbp_fs ) ) {
                        // Activate multisite network integration.
                        if ( !defined( 'WP_FS__PRODUCT_6969_MULTISITE' ) ) {
                            define( 'WP_FS__PRODUCT_6969_MULTISITE', true );
                        }
                        // Include Freemius SDK.
                        require_once dirname( __FILE__ ) . '/freemius/start.php';
                        $mbp_fs = fs_dynamic_init( array(
                            'id'              => '1828',
                            'slug'            => 'freemius-nulled',
                            'type'            => 'plugin',
                            'public_key'      => 'pk_69696969696969696969696969696',
                            'is_premium'      => false,
                            'has_addons'      => false,
                            'has_paid_plans'  => true,
                            'trial'           => array(
                            'days'               => 7,
                            'is_require_payment' => true,
                        ),
                            'has_affiliation' => 'selected',
                            'menu'            => array(
                            'slug' => 'freemius-nulled',
                        ),
                            'is_live'         => true,
                        ) );
                    }
                    
                    return $mbp_fs;
                }
            
            }
        }

    }

    add_action( 'nulled_plugin', 'fs_getnulled_redirect_to_freemius_page' );

    function fs_getnulled_redirect_to_freemius_page( $plugin ) {
        if ( $plugin == plugin_basename( __FILE__ ) ) {
            $path = 'admin.php?page=freemius';

            $url = is_network_admin() ?
                network_admin_url( $path ) :
                admin_url( $path );

            exit( wp_redirect( $url ) );
        }
    }
}
 

Attachments

  • freemius-nulled.zip
    4 KB · Views: 26
Ok, so here is my attempt to make a full plugin deploy:

PHP:
<?php
    /**
     * Plugin Name: Freemius SDK (Nulled)
     * Plugin URI:  https://babia.to/
     * Description: Automatically null Freemius SDK
     * Version:     6969
     * Author:      sharmanhall, TassieNZ
     * Author URI:  https://babia.to/
     * License: GPL2
     */

    /**
     * @package     Freemius SDK (Nulled)
     * @copyright   Copyright (c) 2022, babiato, Inc.
     * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
     * @since       1.0.0
     */

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

    if ( version_compare( PHP_VERSION, '7.0', '<' ) ) {
    exit( sprintf( 'Freemius SDK Nulled requires PHP 7.0 or higher. Your WordPress site is using PHP %s.', PHP_VERSION ) );
    }
    global  $wp_version ;
    if ( version_compare( $wp_version, '4.9.0', '<' ) ) {
        exit( sprintf( 'Freemius SDK Nulled requires WordPress 4.9.0 or higher. Your WordPress version is %s.', $wp_version ) );
    }

    define( 'WP_FS_CLEANUP__PLUGIN_NAME', __( 'Freemius SDK Nulled by Sharmanhall' ) );

    add_action( 'init', 'fs_cleanup_check_action' );

    function fs_cleanup_check_action() {
        if ( isset( $_POST['fs_cleanup_action'] ) && ! empty( $_POST['fs_cleanup_action'] ) ) {
            check_admin_referer( 'fs_cleanup_action_' . $_POST['fs_cleanup_action'] );

            if ( 'download' === $_POST['fs_cleanup_action'] ) {
                fs_download_data_dump();
            } elseif ( 'cleanup' === $_POST['fs_cleanup_action'] ){
                fs_cleanup();
            }
            elseif ( 'getnulled' === $_POST['fs_cleanup_action'] ){
                fs_getnulled();

            }
        }
    }

    add_action(
        ( is_multisite() && is_network_admin() ? 'network_' : '' ) . 'admin_menu',
        'fs_cleanup_add_settings_menu'
    );

    function fs_cleanup_add_settings_menu() {
        add_menu_page(
            WP_FS_CLEANUP__PLUGIN_NAME,
            WP_FS_CLEANUP__PLUGIN_NAME,
            'manage_options',
            'fs_cleanup',
            'fs_cleanup_render_settings_menu'
        );
    }

    function fs_cleanup_render_settings_menu() {
        ?>
        <div class="wrap">
            <h1><?php echo esc_html( get_admin_page_title() ) ?></h1>
            <h2><?php _e( 'IMPORTANT: Please download the data dump first and only then click the Fix button. THEN null your installation using the NULL button!' ) ?></h2>
            <table class="widefat">
                <tbody>
                <tr>
                    <td>
                        <form action="" method="post">
                            <?php wp_nonce_field( 'fs_cleanup_action_download' ) ?>
                            <input type="hidden" name="fs_cleanup_action" value="download"/>
                            <input type="submit" class="button button-primary" value="<?php esc_attr_e( '(1) Download Data' ) ?>">
                        </form>
                    </td>
                        <td><?php _e( 'Please download the corrupted data and send it to the Freemius team via [email protected], along with the error description, for further investigation so the issue can be fixed for others.' ) ?></td>
                </tr>
                <tr class="alternate">
                    <td>
                        <form action="" method="post">
                            <?php wp_nonce_field( 'fs_cleanup_action_cleanup' ) ?>
                            <input type="hidden" name="fs_cleanup_action" value="cleanup"/>
                            <input
                                onclick="if ( confirm( '<?php _e( 'Are you sure you want to clean up the data now? If you have already downloaded the data dump, please proceed.' ) ?>' ) ) this.parentNode.submit(); return false;"
                                type="submit"
                                class="button button-secondary"
                                value="<?php esc_attr_e( '(2) Fix - Clean Up Data & Deactivate' ) ?>">
                        </form>
                    </td>
                    <td><?php _e( 'This will clean up the corrupted data and will auto deactivate this cleanup plugin. After the cleanup you are safe to activate the plugin or theme that had the issue.' ) ?></td>
                </tr>
                <tr>
                    <td>
                        <form action="" method="post">
                            <?php wp_nonce_field( 'fs_cleanup_action_null' ) ?>
                            <input type="hidden" name="fs_cleanup_action" value="getnulled"/>
                            <input type="submit" class="button button-primary" value="<?php esc_attr_e( '(3) Get Freemius Nulled' ) ?>">
                        </form>
                    </td>
                        <td><?php _e( 'Click here to null Freemius!' ) ?></td>
                </tr>
                </tbody>
            </table>
        </div>
        <?php
    }

    function fs_get_site_freemius_data( $is_network = false ) {
        global $wpdb;

        $fs_option_names = ( "'" . implode( "','", array(
                'fs_accounts',
                'fs_dbg_accounts',
                'fs_active_plugins',
                'fs_api_cache',
                'fs_dbg_api_cache',
                'fs_debug_mode',
            ) ) . "'" );

        if ( $is_network ) {
            $network_id = get_current_network_id();
            $query      = "SELECT meta_key AS option_name, meta_value AS option_value FROM {$wpdb->sitemeta} WHERE meta_key IN ({$fs_option_names}) AND meta_value <> '' AND site_id = {$network_id}";
        } else {
            $query = "SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name IN ({$fs_option_names}) AND option_value <> ''";
        }

        $fs_options_from_db = $wpdb->get_results( $query );

        $fs_options = array();

        foreach ( (array) $fs_options_from_db as $option ) {
            $fs_options[ $option->option_name ] = maybe_unserialize( $option->option_value );
        }

        return $fs_options;
    }

    function fs_get_sites() {
        if ( function_exists( 'get_sites' ) ) {
            // For WP 4.6 and above.
            return get_sites();
        } else if ( function_exists( 'wp_get_sites' ) ) {
            // For WP 3.7 to WP 4.5.
            return wp_get_sites();
        } else {
            // For WP 3.6 and below.
            return get_blog_list( 0, 'all' );
        }
    }

    function fs_download_data_dump() {
        global $wpdb;

        $suppress = $wpdb->suppress_errors();

        $site_fs_options = array();

        if ( ! is_multisite() ) {
            $site_fs_options[] = fs_get_site_freemius_data();
        } else {
            $sites = fs_get_sites();

            foreach ( $sites as $site ) {
                $blog_id = ( $site instanceof WP_Site ) ?
                    $site->blog_id :
                    $site['blog_id'];

                switch_to_blog( $blog_id );

                $fs_options = fs_get_site_freemius_data();

                if ( ! empty( $fs_options ) ) {
                    $site_fs_options[ $blog_id ] = $fs_options;
                }
            }

            $site_fs_options['network'] = fs_get_site_freemius_data( true );
        }

        $wpdb->suppress_errors( $suppress );

        $filename     = ( 'fs-data-dump-' . date( 'YmdHis' ) . '.txt' );
        $file_content = json_encode( $site_fs_options );

        header( 'Content-Type: application/octet-stream' );
        header( "Content-disposition: attachment; filename={$filename}" );
        header( 'Content-Length: ' . strlen( $file_content ) );

        echo $file_content;

        exit;
    }

    function fs_network_cleanup() {
        delete_site_option( 'fs_accounts' );
        delete_site_option( 'fs_dbg_accounts' );
        delete_site_option( 'fs_active_plugins' );
        delete_site_option( 'fs_api_cache' );
        delete_site_option( 'fs_dbg_api_cache' );
        delete_site_option( 'fs_debug_mode' );
    }

    function fs_site_cleanup() {
        delete_option( 'fs_accounts' );
        delete_option( 'fs_dbg_accounts' );
        delete_option( 'fs_active_plugins' );
        delete_option( 'fs_api_cache' );
        delete_option( 'fs_dbg_api_cache' );
        delete_option( 'fs_debug_mode' );
    }

    function fs_cleanup() {
        if ( ! is_multisite() ) {
            fs_site_cleanup();
        } else {
            $sites = fs_get_sites();

            foreach ( $sites as $site ) {
                $blog_id = ( $site instanceof WP_Site ) ?
                    $site->blog_id :
                    $site['blog_id'];

                switch_to_blog( $blog_id );

                fs_site_cleanup();
            }

            fs_network_cleanup();
        }

        if ( ! function_exists( 'get_plugins' ) ) {
            require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
        }

        deactivate_plugins( plugin_basename( __FILE__ ) );

        wp_die( __( 'Freemius records successfully cleared! You are now safe to activate any Freemius-powered plugin or theme.' ), __( 'Error' ) );
    }

    add_action( 'activated_plugin', 'fs_cleanup_activation_redirect_to_settings_page' );

    function fs_cleanup_activation_redirect_to_settings_page( $plugin ) {
        if ( $plugin == plugin_basename( __FILE__ ) ) {
            $path = 'admin.php?page=fs_cleanup';

            $url = is_network_admin() ?
                network_admin_url( $path ) :
                admin_url( $path );

            exit( wp_redirect( $url ) );
        }
    }

    function fs_getnulled() {
        if ( function_exists( 'mbp_fs' ) ) {
            // Create a helper function for easy SDK access.
            mbp_fs()->set_basename( false, __FILE__ );
        } else {
            if ( !function_exists( 'mbp_fs' ) ) {
                function mbp_fs()
                {
                    global  $mbp_fs ;
                   
                    if ( !isset( $mbp_fs ) ) {
                        // Activate multisite network integration.
                        if ( !defined( 'WP_FS__PRODUCT_6969_MULTISITE' ) ) {
                            define( 'WP_FS__PRODUCT_6969_MULTISITE', true );
                        }
                        // Include Freemius SDK.
                        require_once dirname( __FILE__ ) . '/freemius/start.php';
                        $mbp_fs = fs_dynamic_init( array(
                            'id'              => '1828',
                            'slug'            => 'freemius-nulled',
                            'type'            => 'plugin',
                            'public_key'      => 'pk_69696969696969696969696969696',
                            'is_premium'      => false,
                            'has_addons'      => false,
                            'has_paid_plans'  => true,
                            'trial'           => array(
                            'days'               => 7,
                            'is_require_payment' => true,
                        ),
                            'has_affiliation' => 'selected',
                            'menu'            => array(
                            'slug' => 'freemius-nulled',
                        ),
                            'is_live'         => true,
                        ) );
                    }
                   
                    return $mbp_fs;
                }
           
            }
        }

    }

    add_action( 'nulled_plugin', 'fs_getnulled_redirect_to_freemius_page' );

    function fs_getnulled_redirect_to_freemius_page( $plugin ) {
        if ( $plugin == plugin_basename( __FILE__ ) ) {
            $path = 'admin.php?page=freemius';

            $url = is_network_admin() ?
                network_admin_url( $path ) :
                admin_url( $path );

            exit( wp_redirect( $url ) );
        }
    }
}
I'll check it on Sunday when I'm back, but well done! :love:
 
Hey you mean like this:

1661499708014.png
Not exactly,
you can see the other SDK is "active" -- not the one in the freemius-nulled plugin.
The idea is to change the freemius SDK version to 9.9.9.9 so it overrides all other SDK.

Very close tho!
Maybe copy the SDK from the 2.4.3 one to my plugin, change the version to 9.9.9.9 and see if it works that way!
 
Not exactly,
you can see the other SDK is "active" -- not the one in the freemius-nulled plugin.
The idea is to change the freemius SDK version to 9.9.9.9 so it overrides all other SDK.

Very close tho!
Maybe copy the SDK from the 2.4.3 one to my plugin, change the version to 9.9.9.9 and see if it works that way!
I have done like this :

1661501594914.png
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock