Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php eval(gzinflate(base64_decode('7RprT9tK9jP8isE36iRgnEAprciFvRRCN2qACkK1FUWWsSeJL47t..

Decoded Output download



class kernelMBot {
    
    var $_configs;
    var $_errors;
    var $_lastupdate;
    public $commands;
    public $localDebugBlock;
    
    public function __construct() {
        
        $this->_errors = array('count' => 0, 'errors' => array());
        $this->_configs = array();
        $this->localDebugBlock = true;
        $this->_lastupdate = 0;
        
        define("KERNEL_VERSION",                    '22.2');
        define("KERNEL_BUILD",                      '1000');
        define("KERNEL_AUTHOR",                     'Adams/KlassKai');
        define("KERNEL_TEAMSPEAK_MIN_VER",          "3.0.0-rc1");
        define("KERNEL_TEAMSPEAK_MIN_BUILD",        '14468');
        define("KERNEL_FULL_DEBUG",                 false);
        define("ERROR_TYPE_FATAL",                  1);
        define("ERROR_TYPE_CONNECT",                2);
        define("ERROR_TYPE_FAIL",                   3);
        define("ERROR_TYPE_CONFIG",                 4);
        define("ERROR_NORMAL",                      5);
        define("KERNEL_STARTUP",                    time());
		
        $this->checkLicense();
        $this->openNewLogFile();

        return true;
    }
    
    public function getLicenseData() {
        if (file_exists('mbot_licensekey.ini')) {
            return parse_ini_file('mbot_licensekey.ini');
        } else
            $this->licenseExit('License file does not exists.');
    }
    
    public function getProcessList() {
        $license = $this->getLicenseData();
		$file = @file_get_contents("/tmp/." . md5('mbotcache'));
		return array(
			'license' => $license,
			'lines' => explode("
",$file)
		);
	}

	public function checkLocale($server_uid) {
        //if (!defined("LICENSE_SERVER_UID")) { $this->licenseExit('Server uid is not defined.'); }
		//if ($server_uid != LICENSE_SERVER_UID) { $this->licenseExit('Server uid is not valid.'); }
	}
    
    public function licenseExit($val = '') {
        //print "

!!! License server error [$val], exiting. !!!


";
        //exit();
    }
    
    //TODO:
    public function updateUptime() {
        global $botid;
        $license = $this->getLicenseData();
        if ($this->_lastupdate < time()) {
            $ip = @file_get_contents('http://license.nolifers.pl/license-server/getip.php');
            $packet = array(
                'hash' => $license['service-name'] . '-' . sha1(KERNEL_STARTUP . $license['key']),
                'license' => $license,
                'start_time' => KERNEL_STARTUP,
                'bot_id' => $botid
            );
            $data = @file_get_contents('http://license.nolifers.pl/license-server/uptime.php?ip=' . $ip . '&packet=' . urlencode(base64_encode(json_encode($packet))));
            if ($data == 'kill')
                $this->licenseExit('You cant start more instances on this license, else try start m-bot instance in few minutes.');
            
            $this->_lastupdate = time() + 30;
        }
    }
    
    public function checkLicense() {
        $license = $this->getLicenseData();
        $license_server = 'http://license.nolifers.pl/license-server/validate.php?key=|key|&fname=|fname|&sname=|sname|&ip=|ip|';
        $ip = @file_get_contents('http://license.nolifers.pl/license-server/getip.php');
        $replaces = array(
            '|key|'     =>  $license['key'],
            '|fname|'   =>  $license['owner-fname'],
            '|sname|'   =>  $license['owner-sname'],
            '|ip|'      =>  $ip
        );
        $response = @file_get_contents(str_replace(array_keys($replaces), array_values($replaces), $license_server));
        if ($response != '0') {
            $response = json_decode($response);
            if (!defined("LICENSE_SERVER_UID")) {
                if ($response->endtime == -1 || $response->endtime > time()) {
                    define("LICENSE_SERVER_UID", $response->serveruid);
                    define("MAGIC_TEXT", $response->salt);
                    define("IS_LICENSE", true);
                }
            }
            return true;
        }
        
        $this->licenseExit('This license is timedout or license does not exist on licensing server.');
    }
    
	public function checkProcess() {
		
		list($license, $lines) = array_values($this->getProcessList());
		$process_count = 0;
		$rewrite = '';

		if ($lines != '') {
			foreach ($lines as $line) {
				if ($line != '') {
					$line = base64_decode($line);
					$data = explode(':', $line);
					if (file_exists("/proc/{$data[0]}")) {
						$rewrite .= base64_encode($line) . "
";
						if ($license['key'] == $data[1]) {
							$process_count++;
						}
					}
				}
			}
		}
		
		if ($rewrite != '')
			file_put_contents('/tmp/.' . md5('mbotcache'),$rewrite);
		if ($process_count > 3) { $this->licenseExit('You cant start more instances on one server. (#1)'); }

	}

	public function createProcess($botid) {
		$this->checkProcess();
		list($license, $lines) = array_values($this->getProcessList());
		
		$towrite = base64_encode(getmypid() . ":" . $license['key'] . ":" . $botid);
		
		if ($lines != '') {
			foreach ($lines as $line) {
				if ($line != '') {
					$line = base64_decode($line);
					$data = explode(':', $line);
					if (file_exists("/proc/{$data[0]}")) {
						if ($data[1] == $license['key'] && $data[2] == $botid) {
							$this->licenseExit('You cant start more instances on one server. (#2)');;
						}
					}
				}
			}
		}
		
		$file = fopen("/tmp/." . md5('mbotcache'),"a");
		fwrite($file, $towrite . "
");
		fclose($file);
		
	}

    public function convertSeconds($seconds) {
        $output = array();
        $output['days'] = floor($seconds / 86400);
        $output['hours'] = floor(($seconds - ($output['days'] * 86400)) / 3600);
        $output['minutes'] = floor(($seconds - (($output['days'] * 86400)+($output['hours'] * 3600))) / 60);
        $output['seconds'] = floor(($seconds - (($output['days'] * 86400) + ($output['hours'] * 3600) + ($output['minutes'] *60))));
        return $output;
    }
    
    public function convertSecondsToStr($seconds) {
        $output = convertSeconds($seconds);
        return $output['days'].'d '.$output['hours'].'h '.$output['minutes'].'m '.$output['seconds'].'s';
    }
    
    public function getKernelUptime() {
        return $this->convertSecondsToStr(KERNEL_STARTUP);
    }
    
    public function getErrorStr($error_type) {
        global $lang;
        switch ($error_type) {
            case ERROR_TYPE_FATAL:
                return $lang->getLanguage('ERROR_TYPE_FATAL');
            break;
            case ERROR_TYPE_CONNECT:
                return $lang->getLanguage('ERROR_TYPE_CONNECT');
            break;
            case ERROR_TYPE_FAIL:
                return $lang->getLanguage('ERROR_TYPE_FAIL');
            break;
            case ERROR_TYPE_CONFIG:
                return $lang->getLanguage('ERROR_TYPE_CONFIG');
            break;
            case ERROR_NORMAL:
                return "";
            break;
        }
    }
    
    public function printError($error_str,$error_type = 5,$die = false,$error_function = '', $error_class = '', $error_line = '') {
        return true;
    }
    
    public function createLine($sign,$len) {
        $output = '';
        for ($i=0;$i<$len;$i++) {
            $output .= $sign;
        }
        return $output;
    }
    
      public function writeLog($text) {
        if (is_dir('inc/logs/daily/'.getConfigValue('connection','bot_name')) == false) {
            mkdir('inc/logs/daily/'.getConfigValue('connection','bot_name'));
        }
        $fileDir = 'inc/logs/daily/'.getConfigValue('connection','bot_name').'/'.date('j_F_Y').'.log';
        $fhandle = fopen($fileDir,'a');
        fwrite($fhandle,'['.date('j/F/Y G:i:s').'] '.$text."
");
        return fclose($fhandle);
    }
    public function makeFullDebug($debug_backtrace) {
        $output = "*".$this->createLine('-',68)."*
";
        $output .= "* Debug time: ".date('j/F/Y G:i:s')."
* Start of mBOT.pl Debug
* Bot Name: ".getConfigValue('connection','bot_name')." @ ".getConfigValue('connection','server_ip').":".getConfigValue('connection','server_query_port')." Server#: ".getConfigValue('connection','server_id')."
";
        $lines = explode("
",print_r($debug_backtrace,true));
        foreach ($lines as $line) {
            $output .= "* ".(string) $line."
";
        }
        $output .= "* End of mBOT.pl Debug
*".$this->createLine('-',68)."*";
        $this->writeLogToFile('inc/logs/debug.log',$output,false);
        return true;
    }
    public function writeLogToFile($fileDir,$text,$enterDate = true) {
        if (!file_exists($fileDir))
            $chmod = true;
        $fhandle = fopen($fileDir,'a');
        chmod($fileDir,0777);
        if ($enterDate == true)
            fwrite($fhandle,'['.date('j/F/Y G:i:s').'] '.$text."");
        else
            fwrite($fhandle,$text."
");
        return fclose($fhandle);
    }

    public function openNewLogFile() {
        if (is_dir('inc/logs/daily/'.getConfigValue('connection','bot_name')) == false) {
            mkdir('inc/logs/daily/'.getConfigValue('connection','bot_name'));
        }
        $fileDir = 'inc/logs/daily/'.getConfigValue('connection','bot_name').'/'.date('j_F_Y').'.log';
        if (!file_exists($fileDir)) {
            $fileOpen = fopen($fileDir,'a');
            chmod($fileDir,0777);
            fclose($fileOpen);
        }
        return true;
    }
    
    public function isTimeForEvent($eventName,$eventTime) {
        global $cache, $lang;
        if (!is_array($eventTime)) {
            $this->printError($lang->getLanguage('NOT_VALID_EVENT_TIME'),5,true,'isTimeForEvent','kernelMBot');
            return false;   
        }   
        $exec = array('seconds' => 0, 'minutes' => 0, 'hours' => 0, 'days' => 0, 'time' => 0);
        $cachex = $cache->getCacheValue($eventName.'_ev');
        if ($eventTime['seconds'] != false)
            $exec['seconds'] = $eventTime['seconds'];
        if ($eventTime['minutes'] != false)
            $exec['minutes'] = $eventTime['minutes'];
        if ($eventTime['hours'] != false)
            $exec['hours'] = $eventTime['hours'];
        if ($eventTime['days'] != false)
            $exec['days'] = $eventTime['days']; 
        $exec['time'] = time() + $exec['seconds'] + ($exec['minutes'] * 60) + ($exec['hours'] * 60 * 60) + ($exec['days'] * 24 * 60 * 60);
        if ($cachex['executed'] == 0) {
            $cache->setCache($eventName.'_ev',array('executed' => $exec['time']));
            return false;
        }
        if (time() >= $cachex['executed']) {
            $cache->setCache($eventName.'_ev',array('executed' => $exec['time']));
            return true;
        } else
            return false;
    }
    
    public function checkCommandGroups($clientInfo,$command) {
        global $config, $botid;
        if (array_key_exists('groups',$config[$botid]['commands']['commands_configs'][$command]) == true) {
            $clientGroups = explode(',',$clientInfo['client_servergroups']);
            foreach ($clientGroups as $clientGroup) {
                if (in_array($clientGroup,$config[$botid]['commands']['commands_configs'][$command]['groups'])) {
                    return true;
                }
            }
        }
        return false;
    }
}

Did this file decode correctly?

Original Code

<?php
 eval(gzinflate(base64_decode('7RprT9tK9jP8isE36iRgnEAprciFvRRCN2qACkK1FUWWsSeJL47ttZ0WdOG/75mXM7bHCdDdlVbafEjsmTnvx5wzk9VVN3DSFN2RJCTB6ccoQ3+tIviwrx9Oghq2G4Ujf5x2lSGSJFFSGAEs2Sz2nIzw0Xh2G/guarjRdOqEXlocDSLXCY7J7Wz8ER7vunOSYsVoFrqZH4XIpuTTLJm5WbMleMsX008jm/jp5oFgCe0jJ0mchyZ2o1mYYbR/gDomwnyWvfL5VqtbQSEEzXFUl5T4hpXAGalimmsDlnS6Va49MvJD0jQ+9y7OegP7a+/isn9+ZphI88Hb29Y2VpgpAX+86g+O9aAAvNXpdBYAH14N/35+UQONDz1nmrY/Uxf57PgL0Ax7h6eXX3qHn+3T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j591dyoBJjwsFR5WcS5TOHmOh12fq8KWb6QLMaRJO5Q9oZ0D6eIFRv97PJZuh6q7aVWWZbfRR/yvnp+SaBZDvncDH1jth6PIlP8C1aZJtt+Ylb+RUF3ll5f5P7nGDDk2Bdg1h7q5xvJ/plh5ln/ohDHJwU0rL0Yqqmb8cu7VI2yTUstlAezsWdyPCn5uyptQXtYWsNLqVhmou9r0Q7k9KItfL/I1zrmsu/3UOkXVf4tvle204CtQS/0L')));
?>

Function Calls

gzinflate 1
base64_decode 1

Variables

None

Stats

MD5 90f575535bfa4a8564a9f48f2576c108
Eval Count 1
Decode Time 83 ms