Skip to content

Instantly share code, notes, and snippets.

@sepehr
Last active November 10, 2015 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sepehr/ac49a289e24266030e7d to your computer and use it in GitHub Desktop.
Save sepehr/ac49a289e24266030e7d to your computer and use it in GitHub Desktop.
PHP/Drupal Malware Remover
# Observe the mess, exclude the unnecessary
#
# -r: Recursive
# -I: Skip binaries
#
grep -rI --color "return base64_decode(\\$.*);" /path/to/www/root
# Clean the mess
#
# -r: Recursice
# -I: Skip binaries
# -l: Show full filenames of matched files
# -Z: Ensures that filenames are zero- (i.e., nul-) terminated so that a name containing white space does not get interpreted in the wrong way
#
# xargs -0: Feeds the filenames from grep to "rm -f", separating words by zero (nul) bytes
# -- is very important to mark the end of options and allow for removal of files whose names begin with "-" character
#
grep -rlIZ "return base64_decode(\\$.*);" /path/to/www/root | xargs -0 rm -f --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment