Created
May 21, 2014 12:28
-
-
Save 2ndkauboy/fd82459a248f8689dceb to your computer and use it in GitHub Desktop.
This is a simple bash script, that scans text files for typical infections and sends an email to the user. Just setup a cron and run it every couple of hour. And don't worry, even scanning thousand of text files will only take some seconds.
This file contains 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
#!/bin/bash | |
grep '#[0-9a-fA-F]\{6\}#' -r -H -lc /var/www/ --include=*.{html,js,css,php,tpl,sh,py,java,class} | # Only get found issues | |
/usr/bin/mail -E -s 'INFECTED FILES FOUND on example.com' [email protected] # Send EMail | |
grep '/\*[0-9a-fA-F]\{6\}\*/' -r -H -lc /var/www/ --include=*.{html,js,css,php,tpl,sh,py,java,class} | # Only get found issues | |
/usr/bin/mail -E -s 'INFECTED FILES FOUND on example.com' [email protected] # Send EMail | |
grep 'e=w\["eval"\]' -r -H -lc /var/www/ --include=*.{html,js,css,php,tpl,sh,py,java,class} | # Only get found issues | |
/usr/bin/mail -E -s 'INFECTED FILES FOUND on example.com' [email protected] # Send EMail | |
grep '<!--/[0-9a-fA-F]\{6\}-->' -r -H -lc /var/www/ --include=*.{html,js,css,php,tpl,sh,py,java,class} | # Only get found issues | |
/usr/bin/mail -E -s 'INFECTED FILES FOUND on example.com' [email protected] # Send EMail | |
grep 'r=eval' -r -H -lc /var/www/ --include=*.{html,js,css,php,tpl,sh,py,java,class} | # Only get found issues | |
/usr/bin/mail -E -s 'INFECTED FILES FOUND on example.com' [email protected] # Send EMail |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment