Scanning Directory for core dumps"; // grab a listing of current files in this directory $file_list = scandir(getcwd()); // loop through the files, and print those that appear to be core files foreach($file_list as $key => $value) { // is this a core file? if(substr($value,0,5) == "core.") { // yes, this is a core file. print a link to it echo "
$value
"; // keep track of whether we found core files or not $found_core_file = true; } } // print a message if no core files are found if(!$found_core_file) { echo "

No core dumps found.

"; } // if the user clicks a core dump, show them the bdg results // // begin with some security checking // // does the string begin with "core."? if(substr($_GET['core'],0,5) == "core.") { // is the string after the . a string if(is_numeric(str_replace("core.","",$_GET['core']))) { // doesn't appear to be any hackish activity, scan the // core file and print the results $command = "gdb -c " . $_GET['core']; echo "

RUNNING: $command

" . shell_exec($command) . "
"; $command = "strings " . $_GET['core']; echo "

RUNNING: $command

" . shell_exec($command) . "
"; } } ?>