linux - Setting up a 'find' command cron/bash script, which emails if there are any results? -


i'd setup cron job checks e.g. every 24 hours see if 'find' command 1 below (which checks malicious shell hacking scripts) has results:

find /home/username/public_html -type f -print0 | xargs -0 egrep '(\/tmp\/cmd(temp)?|sniper_sa|(c99|r57|php)shell|milw0rm)' 

and if there results, receive email @ specified email address exam@ple.com.

perhaps cron job calls bash script run once per day, find command run via bash script, , bash script checks number of characters find command returns , sends email if greater 0. not sure if that's best approach it's 1 think of.

i don't know enough bash programming implement though (or similar alternative) - implementation of like?

the default action of cron email if there output script edit crontab (crontab -e) , add mailto variable @ top.

mailto=exam@ple.com 30 1 * * * find /home/username/public_html -type f -print0 | xargs -0 egrep '(\/tmp\/cmd(temp)?|sniper_sa|(c99|r57|php)shell|milw0rm)' 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -