Advertisement
Guest User

Untitled

a guest
May 7th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4. <title>Core Dump Checker</title>
  5.  
  6. <style type="text/css">
  7. div a{font-size:12px;}
  8. .results{border:1px solid #ccc; padding:2px; width:800px; height:400px; overflow:auto;}
  9. </style>
  10. </head>
  11.  
  12. <body>
  13.  
  14. <?
  15.  
  16. // The purpose of this file is to help find out what is causing
  17. // a core dump
  18.  
  19. echo "<h1>Scanning Directory for core dumps</h1>";
  20.  
  21. // grab a listing of current files in this directory
  22. $file_list = scandir(getcwd());
  23.  
  24. // loop through the files, and print those that appear to be core files
  25. foreach($file_list as $key => $value)
  26. {
  27. // is this a core file?
  28. if(substr($value,0,5) == "core.")
  29. {
  30. // yes, this is a core file. print a link to it
  31. echo " <div>
  32. <a href='?core=$value'>$value</a>
  33. </div>
  34. ";
  35. // keep track of whether we found core files or not
  36. $found_core_file = true;
  37. }
  38. }
  39.  
  40. // print a message if no core files are found
  41. if(!$found_core_file)
  42. {
  43. echo "<h2>No core dumps found.</h2>";
  44. }
  45.  
  46. // if the user clicks a core dump, show them the bdg results
  47. //
  48. // begin with some security checking
  49. //
  50. // does the string begin with "core."?
  51. if(substr($_GET['core'],0,5) == "core.")
  52. {
  53. // is the string after the . a string
  54. if(is_numeric(str_replace("core.","",$_GET['core'])))
  55. {
  56. // doesn't appear to be any hackish activity, scan the
  57. // core file and print the results
  58.  
  59. $command = "gdb -c " . $_GET['core'];
  60. echo " <h2>RUNNING: $command</h2>
  61. <div class='results'>
  62. <pre>" . shell_exec($command) . "</pre>
  63. </div>
  64. ";
  65.  
  66. $command = "strings " . $_GET['core'];
  67. echo " <h2>RUNNING: $command</h2>
  68. <div class='results'>
  69. <pre>" . shell_exec($command) . "</pre>
  70. </div>
  71. ";
  72. }
  73. }
  74.  
  75. ?>
  76.  
  77. </body>
  78.  
  79. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement