Skip to content

Instantly share code, notes, and snippets.

@samir
Created May 31, 2012 02:59
Show Gist options
  • 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' {} \;
@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