Last active
August 29, 2015 13:58
-
-
Save laacz/9977745 to your computer and use it in GitHub Desktop.
Finds primitive PHP backdoor crap in webroot. Each sequential run generates only diff (new or removed suspicious files since last run).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
LASTSCANLOG=/tmp/scanlog.txt | |
THISSCANLOG=/tmp/scanlog.new.txt | |
# Paths to search (space delimited) | |
PATHS="~/ ~/" | |
# Creates file, if it does not exist | |
touch $LASTSCANLOG | |
# Find crap | |
find $PATHS -name "*.php" -exec grep -niH " \(passthru\|shell_exec\|system\|phpinfo\|base64_decode\|popen\|exec\|proc_open\|pcntl_exec\|python_eval\|readfile\)\s*(" '{}' \; >$THISSCANLOG | |
# Show new or removed crap since last run | |
diff $LASTSCANLOG $THISSCANLOG | |
# Save this run as las turn | |
mv $THISSCANLOG $LASTSCANLOG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment