Japanese English

PHP deobfuscation, decryption, reconstruction tool

De-obfuscate PHP malware/viruses and tampering code on Wordpress to original readable code.

*Please note that not all obfuscation codes can be decoded.

Decoded the code below.

<?php namespace Mgt\Varnish\Block\Adminhtml\System; class CheckCronJob extends \Magento\Backend\Block\Template { const CACHE_WARMER_CACHE_KEY = "\x4d\x67\164\x43\x61\x63\150\x65\127\141\x72\155\x65\x72"; const CRON_WARNING_MESSAGE_MINUTES = 10; protected $cache; protected $varnishConfig; protecte...



Obfuscated php code

<?php
 namespace Mgt\Varnish\Block\Adminhtml\System; class CheckCronJob extends \Magento\Backend\Block\Template { const CACHE_WARMER_CACHE_KEY = "\x4d\x67\164\x43\x61\x63\150\x65\127\141\x72\155\x65\x72"; const CRON_WARNING_MESSAGE_MINUTES = 10; protected $cache; protected $varnishConfig; protected $config; protected $directoryList; public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\App\Filesystem\DirectoryList $directoryList, \Mgt\Varnish\Model\Cache\Backend\File $cache, \Magento\Framework\App\Config $config, \Mgt\Varnish\Model\Cache\Config $varnishConfig, array $data = []) { goto f9ac6; c7bf0: $this->cache = $cache; goto Ff782; c5fb1: $this->varnishConfig = $varnishConfig; goto Bcb04; f9ac6: parent::__construct($context, $data); goto e226b; e226b: $this->directoryList = $directoryList; goto c7bf0; Ff782: $this->config = $config; goto c5fb1; Bcb04: } public function isVarnishEnabled() { $isVarnishEnabled = $this->varnishConfig->isEnabled(); return $isVarnishEnabled; } public function isCacheWarmerEnabled() { $isCacheWarmerEnabled = $this->varnishConfig->isCacheWarmerEnabled(); return $isCacheWarmerEnabled; } public function showCronNotRunningMessage() { goto a3394; d2744: B2254: goto Bbe09; E68c6: $totalMinutes = $dateDiff->days * 24 * 60; goto b6556; E9b36: $isVarnishEnabled = $this->isVarnishEnabled(); goto b3de1; B3b92: return $showCronNotRunningMessage; goto d7b5e; C6bb3: if (!(true === $isVarnishEnabled && true === $isCacheWarmerEnabled)) { goto D6b6e; } goto c7c0b; A502a: if (0 == $lastRunningTimestamp) { goto Ce656; } goto De406; Bbe09: goto e9eab; goto D9d66; a3394: $showCronNotRunningMessage = false; goto E9b36; D9d66: Ce656: goto F4520; B2e66: $lastRunning = new \Datetime(); goto F0a37; D1960: D6b6e: goto B3b92; dfb46: $totalMinutes += $dateDiff->i; goto a2322; d956a: e9eab: goto D1960; eb452: $dateDiff = $now->diff($lastRunning); goto E68c6; a2322: if (!($totalMinutes >= self::CRON_WARNING_MESSAGE_MINUTES)) { goto B2254; } goto Be6e3; c576e: $lastRunning->setTimestamp($lastRunningTimestamp); goto eb452; b6556: $totalMinutes += $dateDiff->h * 60; goto dfb46; F4520: $showCronNotRunningMessage = true; goto d956a; b3de1: $isCacheWarmerEnabled = $this->isCacheWarmerEnabled(); goto C6bb3; De406: $now = new \DateTime("\156\157\x77", new \DateTimeZone("\x55\124\103")); goto B2e66; c7c0b: $lastRunningTimestamp = $this->getLastRunningTimestamp(); goto A502a; F0a37: $lastRunning->setTimezone(new \DateTimeZone("\x55\x54\x43")); goto c576e; Be6e3: $showCronNotRunningMessage = true; goto d2744; d7b5e: } protected function getLastRunningTimestamp() { $lastRunningTimestamp = (int) $this->cache->load(self::CACHE_WARMER_CACHE_KEY); return $lastRunningTimestamp; } public function getCronJobCommand() { $cronJobCommand = sprintf("\160\150\x70\40\45\163\x2f\142\151\x6e\57\155\x61\x67\145\x6e\164\157\x20\x6d\x67\164\x2d\166\141\x72\156\x69\x73\150\72\x63\x61\x63\150\x65\x2d\x77\x61\162\155\x65\162", $this->directoryList->getRoot()); return $cronJobCommand; } }

Decoded(de-Obfuscated) php code

<?php

namespace Mgt\Varnish\Block\Adminhtml\System;

class CheckCronJob extends \Magento\Backend\Block\Template
{
    const CACHE_WARMER_CACHE_KEY = "MgtCacheWarmer";
    const CRON_WARNING_MESSAGE_MINUTES = 10;
    protected $cache;
    protected $varnishConfig;
    protected $config;
    protected $directoryList;
    public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\App\Filesystem\DirectoryList $directoryList, \Mgt\Varnish\Model\Cache\Backend\File $cache, \Magento\Framework\App\Config $config, \Mgt\Varnish\Model\Cache\Config $varnishConfig, array $data = array())
    {
        parent::__construct($context, $data);
        $this->directoryList = $directoryList;
        $this->cache = $cache;
        $this->config = $config;
        $this->varnishConfig = $varnishConfig;
    }
    public function isVarnishEnabled()
    {
        $isVarnishEnabled = $this->varnishConfig->isEnabled();
        return $isVarnishEnabled;
    }
    public function isCacheWarmerEnabled()
    {
        $isCacheWarmerEnabled = $this->varnishConfig->isCacheWarmerEnabled();
        return $isCacheWarmerEnabled;
    }
    public function showCronNotRunningMessage()
    {
        $showCronNotRunningMessage = false;
        $isVarnishEnabled = $this->isVarnishEnabled();
        $isCacheWarmerEnabled = $this->isCacheWarmerEnabled();
        if (!(true === $isVarnishEnabled && true === $isCacheWarmerEnabled)) {
            goto D6b6e;
        }
        $lastRunningTimestamp = $this->getLastRunningTimestamp();
        if (0 == $lastRunningTimestamp) {
            $showCronNotRunningMessage = true;
            goto d956a;
        }
        $now = new \DateTime("now", new \DateTimeZone("UTC"));
        $lastRunning = new \Datetime();
        $lastRunning->setTimezone(new \DateTimeZone("UTC"));
        $lastRunning->setTimestamp($lastRunningTimestamp);
        $dateDiff = $now->diff($lastRunning);
        $totalMinutes = $dateDiff->days * 24 * 60;
        $totalMinutes += $dateDiff->h * 60;
        $totalMinutes += $dateDiff->i;
        if (!($totalMinutes >= self::CRON_WARNING_MESSAGE_MINUTES)) {
            goto B2254;
        }
        $showCronNotRunningMessage = true;
        B2254:
        d956a:
        D6b6e:
        return $showCronNotRunningMessage;
    }
    protected function getLastRunningTimestamp()
    {
        $lastRunningTimestamp = (int) $this->cache->load(self::CACHE_WARMER_CACHE_KEY);
        return $lastRunningTimestamp;
    }
    public function getCronJobCommand()
    {
        $cronJobCommand = sprintf("php %s/bin/magento mgt-varnish:cache-warmer", $this->directoryList->getRoot());
        return $cronJobCommand;
    }
}


Malware detection & removal plugin for WordPress

(C)2020 Wordpress Doctor All rights reserved.