scriptz-team

[PHP] SERVER LOG SEARCHER WiTH iPs EXTRACTOR

Jun 4th, 2012
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. <?php
  2. header('Content-Type: text/plain');
  3. /* _____ _____ _ _____ _____ _____ _____ _____ _____
  4. ___| | __ |_| _ |_ _|___ ___|_ _| __| _ | |
  5. |_ -| --| -| | __| | | |- _|___| | | | __| | | | |
  6. |___|_____|__|__|_|__| |_| |___| |_| |_____|__|__|_|_|_|
  7. |s C R i P T z - T E A M . i N F O|----------------------------
  8.  
  9. [PHP] SERVER LOG SEARCHER WiTH iPs EXTRACTOR
  10.  
  11. ADDED SUPPORT TO SHOW iN EXTRACTED iPs UNiQUE iPs NOT 10x THE SAME ONE IP
  12.  
  13. $file -> in what file to search for $searchfor
  14. $searchfor -> what to search in $file
  15. */
  16. $file = "";
  17. $searchfor = "%00"; //Example can be %00 => NULLBYTE ATTACK or ../
  18.  
  19. $do_not_show_ip = array(
  20. ""
  21. ); //Define if you want to remove IPs from Extracted IPs
  22.  
  23.  
  24.  
  25. $contents = file_get_contents($file);
  26. $pattern = preg_quote($searchfor, '/');
  27. $pattern = "/^.*$pattern.*\$/m";
  28.  
  29. function pretty($arr)
  30. {
  31. $retStr = '';
  32. if (is_array($arr)) {
  33. foreach ($arr as $key => $val) {
  34. if (is_array($val)) {
  35. $retStr .= '
  36. ' . pretty($val) . '
  37. ';
  38. } else {
  39. $retStr .= '' . $val . '
  40. ';
  41. /*$retStr .= '
  42. ' . $key . ' => ' . pretty($val) . '
  43. ';
  44. }else{
  45. $retStr .= '
  46. ' . $key . ' => ' . $val . '
  47. ';
  48. */
  49. }
  50. }
  51. }
  52. $retStr .= '';
  53. return $retStr;
  54. }
  55.  
  56.  
  57. if (preg_match_all($pattern, $contents, $matches)) {
  58. echo " _____ _____ _ _____ _____ _____ _____ _____ _____
  59. ___| | __ |_| _ |_ _|___ ___|_ _| __| _ | |
  60. |_ -| --| -| | __| | | |- _|___| | | | __| | | | |
  61. |___|_____|__|__|_|__| |_| |___| |_| |_____|__|__|_|_|_|
  62. |s C R i P T z - T E A M . i N F O|
  63.  
  64. [PHP] SERVER LOG SEARCHER WiTH iPs EXTRACTOR
  65.  
  66. Search results => Results for \$searchfor
  67. Extracted IPs => Extracted IPs from Search results
  68. _______________________________________________________________
  69.  
  70. /**************
  71. Search results:
  72. ***************/
  73.  
  74. ";
  75. echo implode("\n", $matches[0]);
  76. echo "\n\n";
  77. if (preg_match_all("/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/", implode("\n", $matches[0]), $matches)) {
  78. echo "
  79. /**************
  80. Extracted IPs:
  81. ***************/
  82.  
  83. ";
  84. echo str_replace($do_not_show_ip, "", pretty(array_unique($matches[0])));
  85. }
  86. } else {
  87. echo "No matches found";
  88. }
  89. ?>
Advertisement
Add Comment
Please, Sign In to add comment