-
First upload the script to the target directory in which you want to search and replace.
-
Modify the variable
$targetDirectory
to the directory path you want to scan, this should be relative to the directory in which this file resides. -
Modify
$remove
accordingly.$remove = true; //This will search and remove the matching pattern. $remove = false; //This will only search and show the results for matching pattern.
-
The Target Extension for the files you want to find in your directory.
$targetExtension = '.php';
-
The Regex Pattern you want to find.
$pattern = '/(eval\(base64.*?\))\);/';
-
If you want to log the results in a file then make sure you create write permission for this file
eval_removal_log.html
$logResults = true;
- By default, the script is written to find and replace Eval Base64 Decode or Encode recursively in directory. This can help you identify if there is any malicious code in your directory and remove it using this script.
- This script can be modifed to search any other pattern by modifying the
$pattern
variable. You can use your own regex pattern here to find or replace the desired matching pattern