Godaddy is installing password protected Obfuscator PHP Coded files within their customers accounts now?
 
Filename:  catt.php
The unencrypted code is shown below.
 
++++
 
 
<?php define("VERSION", '2.2');
 define("TOOL", 'CATT');
 define("HTPASSWDFILE", shell_exec("curl gdsupport:GjfFqt6*7@216.69.136.144/".TOOL."/htpasswd"));
 $GLOBALS['time'] = date("Y-m-d-H:i:s");
 session_start();
 function load_htpasswd(){ $res = Array();
 $array = preg_split( '/(\n|:)/',HTPASSWDFILE);
 for($i = 0;
 $i < count($array) -1;
 $i++) { if($i % 2 == 0){ $user = $array[$i];
 } else{ $pass = chop($array[$i]);
 } $res[$user] = $pass;
 } return $res;
 } function test_htpasswd( $pass_array, $user, $pass ){ if ( !isset($pass_array[$user])) return False;
 $crypted = $pass_array[$user];
 $salt = explode('$', $crypted);
 $salt = $salt[2];
 $check = trim(shell_exec("openssl passwd -apr1 -salt ".$salt." ".$pass));
 if($check == $crypted){ return True;
 } else{ return False;
 } } $pass_array = load_htpasswd();
 if (!isset($_SESSION['username']) && !isset($_SESSION['password']) && !isset($_GET['killself'])) { if(isset($_POST["user"]) && isset($_POST["pass"])){ $_SESSION['username'] = $_POST["user"];
 $_SESSION['password'] = $_POST["pass"];
 if(!test_htpasswd( $pass_array, $_SESSION['username'], $_SESSION['password'])){ $cuser= $_SESSION['username'];
 $time = date("Y-m-d H:i:s");
 $log = "../.wpc.log";
 $action = "LoginFail";
 $cmd = "echo -en '[".$time."] U: ".$cuser." - Cmd: ".$action."\n' >> ".$log."\n";
 shell_exec($cmd);
 session_destroy();
 shell_exec('rm -f '.$_SERVER['SCRIPT_FILENAME']);
 header("Refresh:0");
 } else{ header("Refresh:0");
 } } else{ echo "
            <html>
                <head>
                    <title> ".TOOL." - Login </title>
                </head>
                <body>
                    <form action='".basename($_SERVER['PHP_SELF'])."' method='post'>
                        Username: <input type='text' name='user'><br>
                        Password: <input type='password' name='pass'><br>
                        <input type='submit' value='Submit'>
                    </form>
                </body>
            </html>";
 } } else { $masterVersion = (float) shell_exec("curl http://216.69.136.144/toolkit/".TOOL."_version_master.txt");
 $currentVersion = (float) VERSION;
 if($currentVersion < $masterVersion && !isset($_GET['killself'])){ echo "<html>
        <head>
            <title>New Version Required!</title>
        </head>
        <body>
            <h1>Your version of ".TOOL." is out of date</h1>
    <p>Your current version is <b>".$currentVersion."</b>. Please download version <b>".$masterVersion."</b> at <a href='http://managedtoolkit.cloud.phx3.gdg/".TOOL."/'>http://managedtoolkit.cloud.phx3.gdg/".TOOL."/</a>.</p>
        </body>
</html>";
 exit;
 } if(isset($_GET['logs'])){ echo '<HTML> <header> <title> '.TOOL.' LOG REVIEW! </title> <H1>WordPress Debug Log:</H1><H4>This field is showing you the WordPress debug.log file held within wp-content.<p> <iframe src="./wp-content/debug.log" width="100%" height="30%"></iframe><p> <p> <H1>File Scan:</H1><p> <iframe src="./wp-content/file_scan.log" width="100%" height="30%"></iframe><p> <H1>Database Scan:</H1><p> <iframe src="./wp-content/db_scan.log" width="100%" height="30%"></iframe>';
 } elseif(isset($_GET['mail'])){ $cuser= $_SESSION['username'];
 $time = date("Y-m-d H:i:s");
 $log = "../.wpc.log";
 $action = "phpmail";
 $cmd = "echo -en '[".$time."] U: ".$cuser." - Cmd: ".$action."\n' >> ".$log."\n";
 shell_exec($cmd);
 
?>
<html>
 
<body>
   
<?php if (isset($_REQUEST['from'])) { $apsub = 'apsubmit@secureserver.net';
 $subject = time().' - Managed WordPress Mail Check - delete me -';
 $message = 'This message was generated by an automated tool by support. If you can read this please delete this message.';
 if (mail($to,$subject,$message)) { echo "Email sent! PHP mail() function is working properly!";
 } else { echo "Error - Mail not sent! Please troubleshoot possible causes. Ensure relay limit is not reached and account is not blocked in Splunk.";
 } } else { $apsub = 'apsubmit@secureserver.net';
 $subject = time().' - Managed WordPress Mail Check - delete me -';
 $message = 'This message was generated by an automated tool by support. If you can read this please delete this message';
 if (mail($to,$subject,$message)) { echo "Email sent! PHP mail() function is working properly!";
 } else { echo "Error - Mail not sent! Please troubleshoot possible causes. Ensure relay limit not reached and account not blocked in Splunk";
 } }
?>
 
</body>
</html>
 
<?php } elseif(isset($_GET['phpinfo'])){
?>
<style type="text/css">
    @import url(http://fonts.googleapis.com/css?family=PT+Mono);
    #phpinfo body,
    body,
    html,
    div {
        cursor: default;
        background-color: #13488A
    }
   
    #phpinfo body,
    #phpinfo pre,
    h1,
    h2,
    td,
    th {
        font-family: 'PT Mono', Tahoma, Geneva, sans-serif
    }
   
    #phpinfo .e,
    #phpinfo .h {
        font-weight: 700;
        color: #FFF;
        min-width:
    }
   
    #phpinfo body,
    body {
        color: #FFF
    }
   
    #phpinfo pre {
        margin: 2px
    }
   
    #phpinfo a:link {
        color: #FFF;
        text-decoration: none;
        background-color: #fff
    }
   
    #phpinfo a:hover {
        text-decoration: underline
    }
   
    #phpinfo table {
        border-collapse: collapse;
    }
   
    #phpinfo .center {
        text-align: center
    }
   
    #phpinfo .center table {
        margin-left: auto;
        margin-right: auto;
        text-align: left;
        width: 50%;
        margin-top: 1%;
    }
   
    #phpinfo .center th {
        text-align: center!important
    }
   
    #phpinfo td,
    th {
        border: 1px solid #222;
        font-size: 90%;
        vertical-align: middle
    }
   
    #phpinfo h1 {
        font-size: 150%
    }
   
    #phpinfo h2 {
        font-size: 125%
    }
   
    #phpinfo .p {
        text-align: center
    }
   
    #phpinfo .e {
        background-color: #333
    }
   
    #phpinfo .e:hover {
        background-color: #373737
    }
   
    #phpinfo .h {
        background-color: #236AC3
    }
   
    #phpinfo .v {
        background-color: #333;
        color: #89E14A
    }
   
    #phpinfo .v:hover {
        background-color: #373737;
        color: #89E14A
    }
   
    #phpinfo .vr,
    #phpinfo hr {
        background-color: #333;
        color: #FFF
    }
   
    #phpinfo .vr {
        text-align: right
    }
   
    #phpinfo img {
        float: right;
        border: 0
    }
   
    #phpinfo hr {
        width: 600px;
        border: 0;
        height: 1px
    }
</style>
 
<div id="phpinfo">
   
<?php $cuser= $_SESSION['username'];
 $time = date("Y-m-d H:i:s");
 $log = "../.wpc.log";
 $action = "phpinfo";
 $cmd = "echo -en '[".$time."] U: ".$cuser." - Cmd: ".$action."\n' >> ".$log."\n";
 shell_exec($cmd);
 ob_start () ;
 phpinfo () ;
 $pinfo = ob_get_contents () ;
 ob_end_clean () ;
 echo ( str_replace ( "module_Zend Optimizer", "module_Zend_Optimizer", preg_replace ( '%^.*<body>(.*)</body>.*$%ms', '$1', $pinfo ) ) ) ;
 
?>
</div>
 
 
<?php } elseif(isset($_GET['integrity'])){ $cuser= $_SESSION['username'];
 $time = date("Y-m-d H:i:s");
 $log = "../.wpc.log";
 $action = "integrity";
 $cmd = "echo -en '[".$time."] U: ".$cuser." - Cmd: ".$action."\n' >> ".$log."\n";
 shell_exec($cmd);
 define('ABSPATH', './');
 if ( defined( 'ABSPATH' ) ) { include( ABSPATH . 'wp-includes/version.php' );
 $wp_locale = isset( $wp_local_package ) ? $wp_local_package : 'en_US';
 $apiurl = 'https://api.wordpress.org/core/checksums/1.0/?version=' . $wp_version . '&locale=' . $wp_locale;
 $json = json_decode ( file_get_contents ( $apiurl ) );
 $checksums = $json->checksums;
 $pass = "";
 $fail = "";
 foreach( $checksums as $file => $checksum ) { $file_path = ABSPATH . $file;
 if ( file_exists( $file_path ) ) { if ( md5_file ($file_path) !== $checksum ) { $fail .= "<font color='red'>".$file."</font><br>";
 } else{ $pass .= "<font color='green'>".$file."</font><br>";
 } } } if ($fail == ""){ $fail = "None";
 } echo "
    <style type='text/css'>
#wrap {
 width:600px;
 
 margin:0 auto;
 
}
#left_col {
 float:left;
 
 width:300px;
 
}
#right_col {
 float:right;
 
 width:300px;
 
}
</style>
 
<div id='wrap'>
 <div id='left_col'>
        <h1>Failed:</h1><br>
 ".$fail."
 </div>
 <div id='right_col'>
        <h1>Passed:</h1><br>
 ".$pass."
 </div>
</div>
    ";
 } } elseif(isset($_GET['core'])){ $cuser= $_SESSION['username'];
 $time = date("Y-m-d H:i:s");
 $log = "../.wpc.log";
 $action = "core";
 $cmd = "echo -en '[".$time."] U: ".$cuser." - Cmd: ".$action."\n' >> ".$log."\n";
 shell_exec($cmd);
 
?>
    <h1>WARNING</h1>
    <h4>This will replace the core files.
        <font color='red'>Do not use this function with Managed WordPress</font>
    </h4><br />
 
   
<?php $config['WP_VER'] = shell_exec("cat wp-includes/version.php | grep \"wp_version =\" | cut -d\' -f 2");
 $config['WORD_WGET'] = 'wget --no-check-certificate https://wordpress.org/wordpress-'.trim($config['WP_VER']).'.zip';
 $config['TIME'] = time();
 $config['CUR_URL'] = "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}&coreOK={$config['TIME']}";
 
?>
        <a href='https://wordpress.org/wordpress-
<?php echo $config[' WP_VER '];
 
?>.zip'>Manually download Wordpress
<?php echo $config['WP_VER'];
 
?></a>
        <br /><strong>or</strong><br />
        <a href='
<?php echo $config['CUR_URL']
?>'>Click here to complete the core file replacement</a>
        <br /><br />
        <pre>
 
<?php $time = date("_His_mdY");
 $coreback = ".core_backup".$time."/";
 if (isset($_REQUEST['coreOK'])){ shell_exec("mkdir -p ".$coreback);
 echo "<br />mkdir -p ".$coreback;
 shell_exec("mv {wp*php,index.php,license.txt,readme.html,xmlrpc.php,wp-admin,wp-includes} ".$coreback);
 echo "<br />mv {wp*php,index.php,license.txt,readme.html,xmlrpc.php,wp-admin,wp-includes} ".$coreback;
 shell_exec("cp ".$coreback."wp-config.php ./");
 echo "<br />cp ".$coreback."wp-config.php ./";
 shell_exec($config['WORD_WGET']);
 echo "<br />".$config['WORD_WGET'];
 shell_exec("unzip wordpress*.zip");
 echo "<br />unzip wordpress*.zip";
 shell_exec("mv wordpress/{wp*php,index.php,license.txt,readme.html,xmlrpc.php,wp-admin,wp-includes} ./");
 echo "<br />mv wordpress/{wp*php,index.php,license.txt,readme.html,xmlrpc.php,wp-admin,wp-includes} ./";
 shell_exec("rm wordpress*.zip");
 echo "<br />rm wordpress*.zip";
 shell_exec("rm -rf wordpress");
 echo "<br />rm -rf wordpress";
 shell_exec("chmod 700 ".$coreback);
 echo "<br />chmod 700 ".$coreback." (in-case there's malicious code)";
 echo "<br /><br />All Done!";
 }
?></pre>
       
<?php }else{ $max_execution = ini_get('max_execution_time');
 $memory_limit = ini_get('memory_limit');
 ini_set('max_execution_time', 0);
 ini_set('memory_limit', '256M');
 class get_started{ public $display;
 private $db_exists;
 public $db_output;
 public function __construct(){ session_start();
 session_regenerate_id(true);
 if((!isset($_SESSION['sql_backup']))||(empty($_SESSION['sql_backup']))) $_SESSION['sql_backup'] = 'None';
 if((!isset($_SESSION['tarball']))||(empty($_SESSION['tarball']))) $_SESSION['tarball'] = 'None';
 $started = $this->initialize();
 $this->display = new display();
 if($started === true){ $this->check_database();
 }else{ $started = $this->display->set_error_box($started);
 } $this->display->msg = $started;
 } private function initialize(){ if(PHP_SHLIB_SUFFIX == 'dll'){ return '<h1>'.TOOL.' does not currently support Windows</h1>';
 } if(!is_callable('shell_exec')||(strpos(ini_get('disable_functions'), 'shell_exec') === true)){ return '<h1>Shell_exec is not enabled! Cannot parse config file!</h1><h2>Please manually remove '.TOOL.'.</h1>';
 } if(!class_exists('PDO')){ return '<h1>PDO is not installed!</h1><p>We will eventually add in fallbacks to MySQLi and regular MySQL if necessary</p>';
 } $directory = dirname($_SERVER['SCRIPT_FILENAME']);
 $lock = $directory.'/'.TOOL.'lock';
 if(file_exists($lock)){ $stage = shell_exec('cat '.$lock.' 2>&1');
 return '<h1>'.TOOL.' IS WORKING BEHIND THE SCENES!</h1><h2>Current Step: '.$stage.'</h1>';
 } $s = new selector();
 if(file_exists('wp-config.php')){ $config['DB_NAME'] = shell_exec("cat wp-config.php | grep DB_NAME |cut -d '\"' -f2| cut -d \' -f 4");
 $config['DB_USER'] = shell_exec("cat wp-config.php | grep DB_USER |cut -d '\"' -f2| cut -d \' -f 4");
 $config['DB_PASSWORD'] = shell_exec("cat wp-config.php | grep DB_PASSWORD |cut -d '\"' -f2| cut -d \' -f 4");
 $config['DB_HOST'] = shell_exec("cat wp-config.php | grep DB_HOST |cut -d '\"' -f2| cut -d \' -f 4");
 $config['DB_HOST_DEBUG'] = shell_exec("cat wp-config.php | grep DB_HOST |cut -d '\"' -f2| cut -d \' -f 4");
 $config['DB_PORT'] = '';
 $config['PREFIX'] = shell_exec("cat wp-config.php | grep table_prefix |cut -d '\"' -f 2 | cut -d \' -f2");
 $config['WP_VER'] = shell_exec("cat wp-includes/version.php | grep \"wp_version =\" | cut -d\' -f 2");
 $GLOBALS['WP_VER'] = $config['WP_VER'];
 if(strpos($config['DB_HOST'], ':') !== false){ $config['DB_PORT'] = str_replace(':', '', substr($config['DB_HOST'], strpos($config['DB_HOST'], ':')));
 $config['DB_HOST'] = substr($config['DB_HOST'], 0, strpos($config['DB_HOST'], ':'));
 }else{ $config['DB_PORT'] = 3306;
 } $dsn = 'mysql:host='.trim($config['DB_HOST']).';
port='.trim($config['DB_PORT']).';
dbname='.trim($config['DB_NAME']);
 try{ $GLOBALS['pdo'] = new PDO($dsn, trim($config['DB_USER']), trim($config['DB_PASSWORD']));
 }catch(PDOException $e){ die('There is an error in the wp-config file! Connection failed: '.$e->getMessage());
 } $query = $GLOBALS['pdo']->prepare('SELECT SUM( DATA_FREE ) FROM INFORMATION_SCHEMA.PARTITIONS;
');
 $query->execute();
 $sum = "SUM( DATA_FREE )";
 $GLOBALS['DBOverhead'] = $query->fetch();
 $GLOBALS['DBOverhead'] = $GLOBALS['DBOverhead'][$sum];
 shell_exec("curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar;
 chmod +x wp-cli.phar");
 $wnode = shell_exec('hostname');
 $GLOBALS['Web_Server'] = $wnode;
 $config['W_NODE'] = $wnode;
 if (strpos($wnode, 'nlwpweb') !== false){ $ismwp = 'true';
 $GLOBALS['ismwp'] = $ismwp;
 $GLOBALS['platform'] = 'Managed WordPress';
 } else{ $ismwp = '0';
 $GLOBALS['ismwp'] = $ismwp;
 if (strpos($wnode, 'plcpnl') !== false){ $GLOBALS['platform'] = 'cPanel';
 } else if (strpos($_SERVER['DOCUMENT_ROOT'], '/home/content/') !== false){ $GLOBALS['platform'] = '2/4GH';
 } else if(strpos($wnode, 'secureserver.net') !== false){ $GLOBALS['platform'] = 'VPS/DED';
 } else{ $GLOBALS['platform'] = 'Unknown';
 $to = 'managedops@godaddy.com';
 $subject = '['.TOOL.'] Unauthorized Host';
 $message = "User: ".$_SESSION['username']." has uploaded ".TOOL." to an unrecognized system. Please review ".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."";
 $headers = 'From: '.TOOL.'@'.$_SERVER['SERVER_NAME'].'' . "\r\n" . 'Reply-To: '.TOOL.'@'.$_SERVER['SERVER_NAME'].'' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
 mail($to, $subject, $message, $headers);
 $s->killself();
 exit("Unrecognized platform detected, self-destructing. This action has been logged.");
 } } $checkcli = shell_exec('wp cli version');
 if (strpos($checkcli, 'WP-CLI') !== false){ $cancli = 'true';
 $GLOBALS['cancli'] = $cancli;
 } else{ $cancli = '0';
 $GLOBALS['cancli'] = $cancli;
 } $cwd = getcwd();
 $file = 'mailquota.log';
 $swap = str_replace('content', 'mailquota', $cwd);
 $almost = str_replace('html', $file, $swap);
 $last = substr($almost, 0, strpos($almost, ".log"));
 $fin = $last.'.log';
 $cmd = "grep 'COUNT' $fin | sed 's/\[COUNT\]//g'";
 if (file_exists($fin)){ $relays = shell_exec($cmd);
 $config['E_RELAY'] = $relays;
 } else{ $relays = "Failed";
 $config['E_RELAY'] = $relays;
 } if((isset($_SERVER['HTTPS']))&&(!empty($_SERVER['HTTPS']))) $config['SITE_URL'] = 'https://';
 else $config['SITE_URL'] = 'http://';
 $config['SITE_URL'] .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
 $config['SITE_URL'] = str_replace(basename($_SERVER['PHP_SELF']), '', $config['SITE_URL']);
 $config['SITE_URL'] = substr($config['SITE_URL'], 0, -1);
 $config['FILEOWNER'] = fileowner("".basename($_SERVER["SCRIPT_FILENAME"])."");
 foreach($config as $k => $v){ $v = trim($v);
 if(empty($v) && ($k !== 'DB_PORT') && ($k !== 'WP_VER')&& ($k !== 'E_RELAY') && ($k !== 'FILEOWNER')){ return '<h1>Error: Check wp-config.php file for empty '.$k.'!</h1>';
 } define($k, $v);
 } $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+-=";
 $length = 20;
 $len = strlen($chars);
 $pw = '';
 for ($i=0;
$i<$length;
$i++){ $pw .= substr($chars, rand(0, $len-1), 1);
 } $pw = str_shuffle($pw);
 define('WPPS_PW', $pw);
 function get_headers_from_curl_response($response){ $headers = array();
 $header_text = substr($response, 0, strpos($response, "\r\n\r\n"));
 foreach (explode("\r\n", $header_text) as $i => $line) if ($i === 0) $headers['http_code'] = $line;
 else{ list ($key, $value) = explode(': ', $line);
 $headers[$key] = $value;
 } return $headers;
 } $ch = curl_init("".SITE_URL."/?gddebug=1");
 curl_setopt($ch, CURLOPT_HEADER, 1);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $response = curl_exec($ch);
 $headers = get_headers_from_curl_response($response);
 foreach($headers as $k => $v) { define($k, $v);
 } $GLOBALS['http_status'] = $headers['http_code'];
 if($GLOBALS['ismwp'] == false){ $GLOBALS['Proxy_Server'] = "N/A - this is not a MWP account";
 $GLOBALS['Cache_Server'] = "N/A";
 $GLOBALS['is_cached'] = "N/A";
 }else{ $GLOBALS['Cache_Server'] = $headers['X-Cache-Server'];
 $GLOBALS['Proxy_Server'] = $headers['X-Proxy-Server'];
 $GLOBALS['is_cached'] = $headers['X-Cache'];
 } $plugs = shell_exec('./wp-cli.phar plugin status');
 if(strpos($plugs, 'A worker ') !== false){ $GLOBALS['WORKER'] = "true";
 }else{ $GLOBALS['WORKER'] = "0";
 } function doMaths($bytes, $precision = 2) { $units = array('B', 'KB', 'MB', 'GB', 'TB');
 $bytes = max($bytes, 0);
 $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
 $pow = min($pow, count($units) - 1);
 $bytes /= pow(1024, $pow);
 return round($bytes, $precision) . ' ' . $units[$pow];
 } return true;
 }else{ return '<h1>We could not find the wp-config.php file!</h1><p>Please be sure to drop this script into the directory where the wp-config.php file lives.</p>';
 } } public function check_database(){ $check_db = new fix_things();
 $sql_result = $check_db->table_check();
 if($sql_result !== false){ $this->db_exists = true;
 $this->db_output = '<h3>Create Backup</h3><p></p>
                                <p>This option exports a compressed (.sql.gz) dump file to the host. Effectively backs up the database.</p><br>
                                <div class="row">
                                    <div class="col-sm-12">
                                        <form id="create_backup" name="create_backup" role="form" method="post">
                                            <input type="hidden" name="selector" value="create_backup">
                                            <button type="submit" class="btn btn-default"><font color="white">CREATE BACKUP</font></button>
                                        </form>
                                    </div>
                                </div>';
 }else{ $this->db_exists = false;
 $this->db_output = $this->display->set_error_box('<p>Database is missing critical data!</p><p class="small"><i>Check to make sure that there is a database and that it is a WordPress application!</i></p><p>It Might be missing tables and/or other critical WordPress data!</p>');
 } } } class display{ public $msg = '';
 public function set_warning_txt($msg){ return $this->msg = '<p class="text-warning">'.$msg.'</p>';
 } public function set_warning_box($msg){ return $this->msg = '<div id="alertBox" class="alert alert-warning" role="alert"><b>'.$msg.'</b></div>';
 } public function set_error_txt($msg){ return $this->msg = '<p class="text-danger">'.$msg.'</p>';
 } public function set_error_box($msg){ return $this->msg = '<div id="alertBox" class="alert alert-danger" role="alert"><b>'.$msg.'</b></div>';
 } public function set_success_txt($msg){ return $this->msg = '<p class="text-success"><b>'.$msg.'</b></p>';
 } public function set_success_box($msg){ return $this->msg = '<div id="alertBox" class="alert alert-success" role="alert">'.$msg.'</div>';
 } public function set_success_box_left($msg){ return $this->msg = '<div id="alertBox" class="alert alert-success" role="alert"><p align="left">'.$msg.'</p></div>';
 } public function del_box(){ return $this->msg = '<script>setTimeout(function(){var element = document.getElementById("alertBox");
element.parentNode.removeChild(element);
}, 2000);
</script>';
 } } class selector { public $fix = '';
 public $display;
 public $archive;
 public $mySQL;
 private $lock;
 public function __construct($selection = ''){ $this->fix = new fix_things();
 $this->display = new display();
 $this->mySQL = new mysqlStuffs();
 $this->archive = new MyArchive($this->fix, $this->mySQL);
 $this->lock = new lockFile();
 if(!empty($selection)){ if(($selection !== 'fix_things')){ $this->$selection();
 }else{ $response = '';
 foreach($_POST as $method => $v){ if(($method !== 'selector')&&($v !== 'false')&&(is_callable($this->$method()))){ $response .= $this->$method();
 } } $response .= $this->display->set_warning_box('<p>'.TOOL.' has completed the operation.</p>');
 echo $response;
 echo $this->display->del_box();
 } } if(isset($_GET['killself'])){ $this->killself();
 } } public function create_backup(){ $this->logAction("create_backup");
 if(($file = $this->mySQL->create_sql_backup()) !== false){ $cmd = $this->lock->updateLock('Backing up MySQL database'). $this->mySQL->cmd. $this->lock->removeLock();
 shell_exec($cmd);
 echo $this->display->set_success_box('<p>MySQL Backup created: '.$file.'</p>');
 echo "<script>var btn = document.getElementById('restoreSubmit');
var select = document.getElementById('dbDumps');
 var opt = document.createElement('option');
 opt.value = '".$file."';
 opt.innerHTML = '".$file."';
 select.appendChild(opt);
btn.disabled = false;
</script>";
 echo $this->display->del_box();
 }else{ echo $this->display->set_error_box('<p>An error has occurred while trying to create the backup!</p>');
 echo $this->display->del_box();
 } } public function select_sql_backup(){ $response = '';
 $file_list = $this->mySQL->select_sql_backup();
 if(isset($_SESSION['sql_backup'])){ $response = $this->display->set_success_txt('Last backup file created this session: '. $_SESSION['sql_backup']);
 } $response .= '
                <form role="form" class="form-horizontal" method="post">
                    <div class="form-group">
                        <label for="backup_file" class="col-sm-4 control-label">Select Backup File:</label>
                        <div class="col-sm-8">
                            <select id="dbDumps" class="form-control" name="backup_file">';
 foreach($file_list as $k=>$v){ $response .= '<option value="'.$v.'"selected>'.$v.'</option>';
 } $response .= '
                            </select>
                        </div>
                    </div>
                    <input type="hidden" name="selector" value="restore_backup">
                    <div class="col-sm-12">';
 if(!empty($file_list)){ $response .= '<button id="restoreSubmit" type="submit" class="btn btn-default pull-right"><font color="white">RESTORE BACKUP</font></button>
                    </div>
                </form>';
 } else{ $response .= '<button id="restoreSubmit" type="submit" class="btn btn-default pull-right" disabled><font color="white">RESTORE BACKUP</font></button>
                    </div>
                </form>';
 } echo $response;
 } public function restore_backup(){ $this->logAction("restore_backup");
 if($this->mySQL->restore_sql_backup($_POST['backup_file']) !== false){ $cmd = $this->lock->updateLock('Restoring MySQL database'). $this->mySQL->cmd. $this->lock->removeLock();
 shell_exec($cmd);
 echo $this->display->set_success_box('<p>Restored the MySQL database from '.$_POST['backup_file'].' successfully!</p>');
 echo $this->display->del_box();
 }else{ echo $this->display->set_error_box('<p>An error has occurred!</p><p>Unable to restore the database from file '.$_POST['backup_file'].'!</p>');
 echo $this->display->del_box();
 } } public function create_archive(){ $this->logAction("create_archive");
 if($this->mySQL->create_sql_backup('./wp-content') !== false){ $file = $this->archive->create_archive();
 $_SESSION['tarball'] = $file;
 $cmd = $this->lock->updateLock('Backing up MySQL database'). $this->mySQL->cmd. $this->lock->updateLock('Creating tarball for transport'). $this->archive->cmd. $this->lock->removeLock();
 shell_exec($cmd);
 $response = $this->display->set_success_box('Archive completed: '.$file);
 echo "<script>var btn = document.getElementById('archiveSubmit');
var select = document.getElementById('archiveList');
 var opt = document.createElement('option');
 opt.value = '".$file."';
 opt.innerHTML = '".$file."';
 select.appendChild(opt);
btn.disabled = false;
</script>";
 }else{ $response = $this->display->set_error_box('<p>Unable to back up the MySQL database!</p><p>MySQL backup and file archive for this process were aborted!</p>');
 } echo $response;
 echo $this->display->del_box();
 } public function select_archive(){ $disabled = '';
 $response = '';
 $archive_list = $this->archive->select_archive();
 $response = '
                <form role="form" method="post" class="form-horizontal">
                    <div class="form-group">
                        <label for="archive_file" class="col-sm-3 control-label">Select Archive:</label>
                        <div class="col-sm-8">
                            <select id="archiveList" name="archive_file" class="form-control">
                                <option selected disabled>-- Choose an Archive --</option>';
 foreach($archive_list as $k=>$v){ $response .= '<option value="'.$v.'">'.$v.'</option>';
 } $response .= '
                            </select>
                        </div>
                    </div>
                    <input type="hidden" name="selector" value="unpack_archive">
                    <div class="col-sm-12">';
 if(!empty($archive_list)){ $response .= '<button id="archiveSubmit" type="submit" class="btn btn-default pull-right"><font color ="white">UNPACK ARCHIVE</font></button>
                    </div>
                </form>';
 } else{ $response .= '<button id="archiveSubmit" type="submit" class="btn btn-default pull-right" disabled><font color ="white">UNPACK ARCHIVE</font></button>
                    </div>
                </form>';
 } echo $response;
 } public function child_theme(){ $parent_sel = $_POST['child_theme_select'];
 $parent_theme = basename($parent_sel);
 $mkchild = './wp-cli.phar scaffold child-theme '.$parent_theme.'-child --parent_theme='.$parent_theme.' --theme_name='.$parent_theme.'-child --author="This child theme was generated from the parent theme by WPPS. All Theme credit belongs to original creator(s)" --activate';
 shell_exec($mkchild);
 echo $this->display->set_success_box("Successfully created the child theme");
 echo $this->display->del_box();
 } public function permalinks(){ if($_POST['permalink_select'] == "blank"){ $structure = "";
 }else{ $structure = $_POST['permalink_select'];
 } echo $this->display->set_success_box(shell_exec("Rewrite structure set to '".$structure."'"));
 echo $this->display->del_box();
 } public function install_ionCube(){ $this->logAction("install_ionCube");
 if (!defined('PHP_VERSION_ID')) { $version = explode('.', PHP_VERSION);
 define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
 } if (PHP_VERSION_ID < 50207) { define('PHP_MAJOR_VERSION', $version[0]);
 define('PHP_MINOR_VERSION', $version[1]);
 define('PHP_RELEASE_VERSION', $version[2]);
 } $inipath = php_ini_loaded_file();
 $ini_name = basename($inipath);
 $cmd = "cp ".$inipath.$ini_name;
 shell_exec($cmd);
 if($GLOBALS['platform'] == "2/4GH"){ shell_exec("wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz -O ioncube_loaders_lin_x86.tar.gz");
 shell_exec("tar -xzvf ioncube_loaders_lin_x86.tar.gz");
 }else{ shell_exec("wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -O ioncube_loaders_lin_x86-64.tar.gz");
 shell_exec("tar -xzvf ioncube_loaders_lin_x86-64.tar.gz");
 } $file_data = "[ZEND]\nzend_extension=\"/usr/local/Zend/lib/Guard-6.0.0/php-".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION.".x/ZendGuardLoader.so\"\nzend_extension = ".$_SERVER['DOCUMENT_ROOT']."/ioncube/ioncube_loader_lin_".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION.".so\n";
 if(file_exists($ini_name)){ $file_data .= file_get_contents($ini_name);
 } file_put_contents($ini_name, $file_data);
 shell_exec("rm -f ioncube_loaders_lin_x86*.tar.gz");
 shell_exec('pkill -U '.FILEOWNER.';
');
 echo $this->display->set_success_box("ionCube has been enabled!");
 echo $this->display->del_box();
 } public function unpack_archive(){ $this->logAction("unpack_archive");
 $import = (isset($_POST['import']) ? true : false);
 $automagic = (isset($_POST['automagic']) ? true : false);
 $archive_file = (isset($_POST['archive_file']) ? $_POST['archive_file'] : false);
 $response = '';
 if($archive_file !== false){ if($this->archive->unpack_all_archives($_POST['archive_file'], $import) !== false){ $cmd = $this->lock->updateLock('Unpacking file archive'). $this->archive->cmd;
 $reponse = '<p>During this processes we have:</p><ul class="list-unstyled">
                                    <li>- Extracted the wp-content folder</li>';
 if($import){ $backup = $this->mySQL->locate_own_sql();
 if($backup !== false){ $this->mySQL->restore_sql_backup($backup);
 $cmd .= $this->lock->updateLock('Restoring MySQL database'). $this->mySQL->cmd;
 $response .= '<li>- Imported the MySQL database</li>';
 } } if($automagic){ $cmd .= $this->lock->updateLock('Applying fixes to the database');
 $response .= '<li>- Updated table prefixes, usermeta, and options</li>';
 } $cmd .= $this->lock->removeLock();
 shell_exec($cmd);
 $response .= '</ul>';
 $response = $this->display->set_success_box($response);
 }else{ $response = $this->display->set_error_box('<p>Unable to decompress the archive.</p><p>Please attempt to decompress the archive manually or upload the archive again.</p>');
 } }else{ $response = $this->display->set_error_box('<p>Please select an archive.</p>');
 } echo $response;
 echo $this->display->del_box();
 } public function createINI(){ $this->logAction("createINI");
 $phpini = new iniGenerator($_POST);
 if($phpini->generate() !== false){ $this->killProcesses();
 $response = $this->display->set_warning_box($_POST['ini_select'].' successfully created! Processes have been restarted!');
 }else{ $response = $this->display->set_error_box('<p>An error has occurred! The new INI was not created!</p>');
 } echo $response;
 echo $this->display->del_box();
 } public function get_url(){ $result = $this->fix->get_url();
 if($result !== false){ $response = '<span class="glyphicon glyphicon-globe glyphicon-size-massive" aria-hidden="true"></span>
                            <p id="urlOld" class="small">Old: <i>'.$result.'</i></p>
                            <p id="urlNew" class="small">New: <i>'.SITE_URL.'</i></p>
                            <input type="hidden" name="set_url" value="false" />';
 }else{ $response = $this->display->set_error_txt('Could not locate the site URL!');
 } return $response;
 } public function set_url(){ $this->logAction("set_url");
 $old_url = $this->fix->get_url();
 $this->fix->set_url();
 $response = $this->display->set_success_box('<p><b>Site URL Updated!</b></p><p>Old Site URL: '.$old_url.'</p><p>Site URL is '.SITE_URL.'</p>');
 echo "<script>var urlOld = document.getElementById('urlOld');
 var urlNew = document.getElementById('urlNew');
 urlOld.innerHTML = 'Old: ".$this->fix->get_url()."';
 urlNew.innerHTML = 'New: ".SITE_URL."';
</script>";
 echo $response;
 echo $this->display->del_box();
 } public function get_prefixes(){ if($this->fix->get_prefix_list() !== false){ $response = '<span class="glyphicon glyphicon-th-list glyphicon-size-massive" aria-hidden="true"></span>
                            <p id="prefixOld" class="small">Old: <i>'.$this->fix->old_prefix.'</i></p>
                            <p id="prefixNew" class="small">New: <i>'.PREFIX.'</i></p>
                            <input type="hidden" name="set_prefixes" value="false" />';
 }else{ $response = $this->display->set_error_box('<p>Could not parse prefixes!</p><p>This function will not run until there is only one COMPLETE WordPress database present</p>');
 } return $response;
 } public function set_prefixes(){ $this->logAction("set_prefixes");
 if($this->fix->rename_tables()){ $response = $this->display->set_success_box('<p><b>Table Prefixes Updated!</b></p><p>Prefix "'.$this->fix->old_prefix.'" updated to "'.$this->fix->new_prefix.'" on all tables and database entries</p>');
 $this->fix->get_prefix_list();
 echo "<script>var prefixOld = document.getElementById('prefixOld');
 var prefixNew = document.getElementById('prefixNew');
 prefixOld.innerHTML = 'Old: ".$this->fix->old_prefix."';
 prefixNew.innerHTML = 'New: ".PREFIX."'</script>";
 } else{ $response = $this->display->set_error_box('<p>Multiple prefixes were detected! No queries were ran!</p><p>Check the database for multiple usermeta tables</p>');
 } echo $response;
 echo $this->display->del_box();
 } public function killself(){ $this->logAction("kill_script");
 $killsql = "find * -type f -name '".TOOL."-SQL_*' -mtime +3 -exec rm {} \;
";
 $killarch = "find * -type f -name '".TOOL."-Archive*' -mtime +3 -exec rm {} \;
";
 $killdebug = "mv wp-config.php wp-config.php.debug;
 find . -type f -name 'wp-config.php.".TOOL."-debug-bak*' -print0 | xargs --null -I{} mv {} wp-config.php;
";
 $killreview = "rm ".TOOL."-review.html";
 $logprot = `echo '\n\n# Protect the log files\n<Files ~ "\.log$">\nOrder Allow,Deny\nDeny from all\n</Files>' >> ./wp-content/.htaccess`;
 $htFile = @file_get_contents("./wp-content/.htaccess");
 $expression = '(.*Protect(.*\n)+.*Files>)';
 $protCheck = preg_match('/'.$expression.'/', $htFile);
 $path = $_SERVER['SCRIPT_FILENAME'];
 if(isset($_SESSION['sql_backup'])&&!empty($_SESSION['sql_backup'])){ $sql_backup = dirname($path).$_SESSION['sql_backup'];
 } $debug = glob('./wp-config.php.'.TOOL.'-debug-bak*');
 $filter = array_filter($debug);
 if (!empty($filter)) { shell_exec($killdebug);
 } if (file_exists($review)){ shell_exec($killreview);
 if ($protCheck == 0){ shell_exec($logprot);
 } } shell_exec($killsql);
 shell_exec($killarch);
 shell_exec('rm -f wp-cli.phar');
 shell_exec('rm -f '.$path);
 header("Refresh:0");
 } private function ResetUpload(){ $this->logAction("Reset_Upload");
 $sql = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
 $cmd = "\"UPDATE \`".PREFIX."options\` SET option_value = 'wp-content/uploads' WHERE option_name = 'upload_path';
\"";
 shell_exec($sql.$cmd);
 echo $this->display->set_success_box("Upload path has been reset!");
 echo $this->display->del_box();
 } private function LoginReset(){ $this->logAction("Reset_Lockout");
 $sql = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
 $cmd = "\"UPDATE \`".PREFIX."options\` SET option_value = '' WHERE option_name = 'limit_login_lockouts' LIMIT 1;
\"";
 shell_exec($sql.$cmd);
 echo $this->display->set_success_box("Login lockout has been reset!");
 echo $this->display->del_box();
 } private function regenthumbs(){ $this->logAction("Regen_Thumbnails");
 $sql = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
 $cmd = "\"UPDATE \`".PREFIX."options\` SET option_value = '' WHERE option_name = 'upload_url_path' LIMIT 1;
\"";
 shell_exec($sql.$cmd);
 shell_exec('./wp-cli.phar media regenerate --only-missing');
 echo $this->display->set_success_box("Media thumbnails have been regenerated!");
 echo $this->display->del_box();
 } private function EnableWorker(){ $this->logAction("Enable_Worker");
 shell_exec('./wp-cli.phar plugin install worker --activate');
 echo $this->display->set_success_box("ManageWP Worker Plugin has been enabled!");
 echo $this->display->del_box();
 } private function UpdateCore(){ $this->logAction("Update_Core");
 shell_exec('./wp-cli.phar core update --force');
 echo $this->display->set_success_box("WordPress Core have been updated!");
 echo $this->display->del_box();
 } private function DisComms(){ $this->logAction("Disable_Comments");
 $sql = "\"UPDATE \`".PREFIX."posts\` SET comment_status='closed';
UPDATE \`".PREFIX."options\` SET option_value='closed' WHERE option_name='default_comment_status';
\"";
 $cmd = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
 shell_exec($cmd.$sql);
 echo $this->display->set_success_box("Comments have been disabled!");
 echo $this->display->del_box();
 } public function redraw (){ $response = "<script>var archives = document.getElementById('archiveList');
 archives.innerHTML='";
 $archive_list = $this->archive->select_archive();
 if(count($archive_list) > 0){ echo '<script>var archivebtn = document.getElementById("archiveSubmit");
 archivebtn.disabled = false;
</script>';
 } foreach($archive_list as $k=>$v){ $response .= '<option value="'.$v.'">'.$v.'</option>';
 } $response .= "';
</script>";
 echo $response;
 $response = "<script>var databases = document.getElementById('dbDumps');
 databases.innerHTML='";
 $file_list = $this->mySQL->select_sql_backup();
 if(count($file_list) > 0){ echo '<script>var dbbtn = document.getElementById("restoreSubmit");
 dbbtn.disabled = false;
</script>';
 } foreach($file_list as $k=>$v){ $response .= '<option value="'.$v.'">'.$v.'</option>';
 } $response .= "';
</script>";
 echo $response;
 echo $this->fix->old_prefix;
 echo "<script>var prefixOld = document.getElementById('prefixOld');
 var prefixNew = document.getElementById('prefixNew');
 prefixOld.innerHTML = 'Old: ".$this->fix->get_prefix_list()."';
 prefixNew.innerHTML = 'New: ".PREFIX."'</script>";
 echo "<script>var urlOld = document.getElementById('urlOld');
 var urlNew = document.getElementById('urlNew');
 urlOld.innerHTML = 'Old: ".$this->fix->get_url()."';
 urlNew.innerHTML = 'New: ".SITE_URL."';
</script>";
 $query = $GLOBALS['pdo']->prepare('SELECT SUM( DATA_FREE ) FROM INFORMATION_SCHEMA.PARTITIONS;
');
 $query->execute();
 $sum = "SUM( DATA_FREE )";
 $GLOBALS['DBOverhead'] = $query->fetch();
 $GLOBALS['DBOverhead'] = $GLOBALS['DBOverhead'][$sum];
 echo "<script>var overhead = document.getElementById('overhead');
 overhead.innerHTML = '".strval(doMaths($GLOBALS['DBOverhead']))."'</script>";
 echo "<script>var latestSQL = document.getElementById('last_sql_backup');
var latestTAR = document.getElementById('last_tar_backup');
 latestSQL.innerHTML = '".$_SESSION['sql_backup']."';
 latestTAR.innerHTML = '".$_SESSION['tarball']."';
</script>";
 if(E_RELAY !== "Failed"){ $cwd = getcwd();
 $file = 'mailquota.log';
 $swap = str_replace('content', 'mailquota', $cwd);
 $almost = str_replace('html', $file, $swap);
 $last = substr($almost, 0, strpos($almost, ".log"));
 $fin = $last.'.log';
 $cmd = "grep 'COUNT' $fin | sed 's/\[COUNT\]//g'";
 if (file_exists($fin)){ $relays = shell_exec($cmd);
 $config['E_RELAY'] = $relays;
 } echo "<script>var relay = document.getElementById('relays');
 relay.innerHTML = '".E_RELAY."'</script>";
 } } private function killProcesses(){ $this->logAction("killProcesses");
 shell_exec('pkill -U '.FILEOWNER.';
');
 echo $this->display->set_success_box('Processes ran by '.FILEOWNER.' terminated!');
 echo $this->display->del_box();
 } private function roleReset(){ $this->logAction("roleReset");
 shell_exec('./wp-cli.phar role reset --all');
 echo $this->display->set_success_box("Roles have been reset!");
 echo $this->display->del_box();
 } private function PluginUpdate(){ $this->logAction("PluginUpdate");
 shell_exec('./wp-cli.phar plugin update --all');
 echo $this->display->set_success_box("Plugins have been updated!");
 echo $this->display->del_box();
 } private function ThemeUpdate(){ $this->logAction("ThemeUpdate");
 shell_exec('./wp-cli.phar theme update --all');
 echo $this->display->set_success_box("Themes have been updated!");
 echo $this->display->del_box();
 } private function PurgeComms(){ $this->logAction("Purge_Comments");
 $sql = "\"TRUNCATE \`".PREFIX."commentmeta\`;
TRUNCATE \`".PREFIX."comments\`;
\"";
 $cmd = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
 shell_exec($cmd.$sql);
 echo $this->display->set_success_box("Comments have been purged!");
 echo $this->display->del_box();
 } private function PurgeSpam(){ $this->logAction("Purge_Spam");
 $sql = "\"DELETE FROM \`".PREFIX."comments\` WHERE comment_approved = 'spam';
\"";
 $cmd = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
 shell_exec($cmd.$sql);
 echo $this->display->set_success_box("Comments marked as spam have been purged!");
 echo $this->display->del_box();
 } private function PurgeUnapproved(){ $this->logAction("Purge_Unapproved");
 $sql = "\"DELETE FROM \`".PREFIX."comments\` WHERE comment_approved = '0';
\"";
 $cmd = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
 shell_exec($cmd.$sql);
 echo $this->display->set_success_box("All comments awaiting moderation have been purged!");
 echo $this->display->del_box();
 } private function OptDB(){ $this->logAction("OptDB");
 $OptDB = "mysqlcheck -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --optimize";
 shell_exec($OptDB);
 echo $this->display->set_success_box("Database tables have been optimized!");
 echo $this->display->del_box();
 } private function RepairDB(){ $this->logAction("Repair_DB");
 $RepairDB = "mysqlcheck -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." -A --auto-repair";
 shell_exec($RepairDB);
 echo $this->display->set_success_box("Database tables have checked and repaired!");
 echo $this->display->del_box();
 } public function supportUser(){ $this->logAction("Support_User_Updated");
 $sql = "\"SELECT \`user_login\` FROM \`".PREFIX."users\` WHERE \`user_login\` = 'wpps-support' AND \`user_email\` = 'wpps-noreply@secureserver.net';
\"";
 $cmd = "mysql -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e ";
 session_start();
 if (strpos(shell_exec($cmd.$sql), 'wpps-support') !== false){ $updatepass = "./wp-cli.phar user update wpps-support --user_pass='".WPPS_PW."'";
 shell_exec($updatepass);
 $_SESSION['wpps-support'] = $pw;
 echo "<script>var element = document.getElementById('supportPass');
 element.innerHTML = 'Pass: ".WPPS_PW."';
</script>";
 echo $this->display->set_success_box('Copy the user/password quickly: wpps-support | ' . WPPS_PW);
 echo $this->display->del_box();
 } else { $cmd = './wp-cli.phar user create wpps-support wpps-noreply@secureserver.net --role=administrator --user_pass="'.WPPS_PW.'"';
 shell_exec($cmd);
 $this->logAction("Support_User_Created");
 echo "<script>var element = document.getElementById('supportPass');
 element.innerHTML = 'Pass: ".WPPS_PW."';
</script>";
 echo $this->display->set_success_box('Copy the user/password quickly: wpps-support | ' . WPPS_PW);
 echo $this->display->del_box();
 session_start();
 $_SESSION['wpps-support'] = WPPS_PW;
 } } public function AutoLogin(){ define( 'WP_USE_THEMES', false );
 define( 'COOKIE_DOMAIN', false );
 define( 'DISABLE_WP_CRON', true );
 include_once("wp-load.php");
 if ( is_user_logged_in() ) { $user = wp_get_current_user();
 echo "<script>window.open('".SITE_URL."/wp-admin/', '_blank');
</script>";
 } else{ $creds = array();
 $creds['user_login'] = "wpps-support";
 $creds['user_password'] = "'".WPPS_PW."'";
 $creds['remember'] = true;
 $user = wp_signon( $creds, false );
 if(is_wp_error( $user )){ echo $this->display->set_error_box($user->get_error_message());
 echo $this->display->del_box();
 } else{ wp_set_auth_cookie( $user->ID, true );
 echo "<script>window.open('".SITE_URL."/wp-admin/', '_blank');
</script>";
 } } } public function killTransient(){ $this->logAction("killTransient");
 if($this->fix->get_prefix_list() !== false){ $this->mySQL->killTransient($this->fix->old_prefix);
 $cmd = $this->lock->updateLock('Clearing cache from database and varnish...'). $this->mySQL->cmd. $this->lock->removeLock();
 shell_exec($cmd);
 $response = $this->display->set_success_box('Cache and transients have been flushed!');
 }else{ $response = $this->display->set_error_box('An error has occurred while attempting to clear the transient data!');
 } echo $response;
 echo $this->display->del_box();
 } private function cleanup($directory = '.'){ $this->logAction("cleanup");
 $remove = '';
 if ($dh = opendir($directory)) { while (false !== ($file = readdir($dh)) ){ if((strpos($file, ''.TOOL.'-Archive') !== false)||(strpos($file, ''.TOOL.'-SQL') !== false)){ $remove .= 'rm -f '.$file.';
';
 } } closedir($dh);
 } return $remove;
 } public function database_scan(){ $this->logAction("database_scan");
 $time = date("_His_mdY");
 $sql = 'SELECT * FROM '.PREFIX.'posts WHERE post_content LIKE "%iframe%" UNION SELECT * FROM '.PREFIX.'posts WHERE post_content LIKE "%noscript%" UNION SELECT * FROM '.PREFIX.'posts WHERE post_content LIKE "%display:%";
';
 $file = './wp-content/db_scan.log';
 $cmd = "mysql -B -h ".DB_HOST." -u ".DB_USER." -p'".DB_PASSWORD."' ".DB_NAME." -P".DB_PORT." --disable-column-names -e '".$sql."' > ".$file.";
 echo '\n\n\n\n\n\n\t\t\t\t ****** SCAN COMPLETED @ ".$time." ******' >> ".$file.";
";
 shell_exec($cmd);
 if (file_exists($file)) { echo $this->display->set_success_box('<p>Database Scan Complete - please review '.$file.'</p>');
 echo $this->display->del_box();
 }else{ echo $this->display->set_error_box('<p>An error has occurred while trying to create the output file!</p>');
 echo $this->display->del_box();
 } } public function sel_db_scan(){ $response = '<span class="glyphicon glyphicon-tasks glyphicon-size-massive" aria-hidden="true"></span>
            <p class="medium">Run Database Scan</p>
            <input type="hidden" name="database_scan" value="false" />';
 return $response;
 } public function file_scan(){ $this->logAction("file_scan");
 $time = date("_His_mdY");
 $file = $_SERVER['SCRIPT_FILENAME'];
 $scan = 'echo -e "The following files have been marked for manual review by an automated scan performed by Support. However, as we are not able\nto support custom scripting or the inner workings of third-party applications, we are unable to provide specific solutions.\nTherefore, we respectfully suggest the use of your favorite Internet search engine in order to further research this issue.\n\n*** Please note this scan checks common compromise signatures but that does NOT always mean the file has been compromised *** \n\t \n\t ## FILES FOUND WITH BASE64 CODE ##\n" > ./wp-content/file_scan.log;
 grep -ri --include=*.php --exclude='.$file.' -lPHn "base64" . >> ./wp-content/file_scan.log;
 echo -e "\n\t \n\t ## FILES FOUND WITH 46ESAB(base64 backwards) CODE ##\n" >> ./wp-content/file_scan.log;
 grep -ri --include=*.php --exclude='.$file.' -lPHn "46esab" . >> ./wp-content/file_scan.log;
 echo -e "\n\t \n\t ## FILES FOUND WITH EVAL CODE ##\n" >> ./wp-content/file_scan.log;
 grep -ri --include=*.php --exclude=".$file." -lPHn "(eval\(.*\);
)" . >> ./wp-content/file_scan.log;
 echo -e "\n\t \n\t ## FILES FOUND WITH GZINFLATE CODE ##\n" >> ./wp-content/file_scan.log;
 grep -ri --include=*.php --exclude='.$file.' -lPHn "gzinflate" . >> ./wp-content/file_scan.log;
 echo -e "\n\t \n\t ## PHP FILES FOUND WITHIN WP-CONTENT/UPLOADS ##\n" >> ./wp-content/file_scan.l

comments powered by Disqus
TitleTime
Trolls4 minutes
movie52 minutes
BCS2 hours
Straight3 hours
•!!LIVE!! UFC 249 — F...3 hours
Buy Sports Products Onlin...3 hours
Free $5 signup bonus5 hours

© Paste4BTC 2014 - Earn bitcoins by pasting! | My pastes | Popular pastes | New pastes | Payments | FAQ | Terms of Service