Skip to content

Search and Remove matched string from the files recursively

Notifications You must be signed in to change notification settings

rahilwazir/RecursiveSearchAndRemove

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Instructions for using the script

  1. First upload the script to the target directory in which you want to search and replace.

  2. Modify the variable $targetDirectory to the directory path you want to scan, this should be relative to the directory in which this file resides.

  3. 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.
  4. The Target Extension for the files you want to find in your directory.

      $targetExtension = '.php';
  5. The Regex Pattern you want to find.

     $pattern = '/(eval\(base64.*?\))\);/';
  6. 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;

Default usage

  • 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.

Custom usage

  • 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

About

Search and Remove matched string from the files recursively

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages