getMessage(); } } closedir($fp); return $ret; } } if (DEBUG === true) { ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); ini_set('html_errors', '1'); ini_set('docref_root', 'http://www.php.net/'); ini_set('error_prepend_string', "
"); ini_set('error_append_string', '
'); error_reporting(E_ALL); } else { ini_set('error_reporting', E_ALL & ~E_NOTICE); } // Try to, if required, allocate the max allowed memory to this script. ini_set('memory_limit', -1); // Retrieve posted data $data = json_decode(file_get_contents('php://input'), true); // Get absolute path of this file $default = str_replace('/', DS, dirname($_SERVER['SCRIPT_FILENAME'])); // Folder where to start the scan $folder = $default; if ($data !== []) { $task = trim(filter_var(($data['task'] ?? ''), FILTER_UNSAFE_RAW)); if (in_array($task, ['doSearch', 'doKill'])) { switch ($task) { case 'doSearch': // Get parameters // Folder where to start the scan $folder = rtrim(base64_decode(filter_var(($data['folder'] ?? $default), FILTER_UNSAFE_RAW)), DS) . DS; // String to search $query = trim(base64_decode(filter_var(($data['query'] ?? ''), FILTER_UNSAFE_RAW))); // Filter for file's restriction (like *.php) $filter = trim(base64_decode(filter_var(($data['filter'] ?? ''), FILTER_UNSAFE_RAW))); if ('' == $filter) { $filter = '*'; } // Follow symbolic links or not (boolean) $links = boolval(trim(filter_var(($data['links'] ?? ''), FILTER_UNSAFE_RAW))); // is the $query parameter contains a regular expression or not (boolean) $regex = boolval(trim(filter_var(($data['regex'] ?? ''), FILTER_UNSAFE_RAW))); $results = ''; if ('' !== $query) { $results = json_encode(AvontureFct::php_grep($folder, $query, $filter, $links, $regex)); } header('Content-Type: text/json'); echo $results; break; case 'doKill': if (!DEMO) { // Don't kill when demo mode enabled //unlink(__FILE__); } // return 0 when the file still exists $arr['removed'] = is_file(__FILE__) ? 0 : 1; echo json_encode($arr); break; default: echo 'Unsupported task'; break; } die(); } } // Get the GitHub corner $github = ''; if (is_file($cat = __DIR__ . DIRECTORY_SEPARATOR . 'octocat.tmpl')) { $github = str_replace('%REPO%', REPO, file_get_contents($cat)); } ?> PHP-Grep
  • Update the folder if needed, where to start the search
  • Enter the text to search for in the Expression area
  • Specify a filter like *.php (or nothing to scan all files)
  • Click on the "Start the search" button


The script has been successfully removed from the server

An error has occurred while trying removing the script; please do it yourself

No occurrence of {{ query }} has been found in folder {{ folder }} (sub-folders included).