Skip to content

Instantly share code, notes, and snippets.

@samir
Created May 31, 2012 02:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samir/2840668 to your computer and use it in GitHub Desktop.
Save samir/2840668 to your computer and use it in GitHub Desktop.
Clean infected php files with eval(base64_decode()) functions - usually in wordpress
#!/bin/bash
find . -name "*.php" -type f -exec sed -i 's/<?php \/\*\*\/ eval(base64_decode(\"[a-z0-9A-Z\/\+]*\"));?>//g' {} \;
# or
find . -name "*.php" -type f -exec sed -i 's/<?php \/\*\*\/ eval(base64_decode(\"[^"]*\"));?>//g' {} \;
@borgogelli
Copy link

Does it change file on disk ?
Do you know any other solution to show only the infected files without editing them ?
Regards from Italy

@computercam
Copy link

@borgogelli

the -i flag on sed indicates that it will insert the changes into the file. so yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment