So I’ve seen these Wordpress plugins which check WP files for modifications and alert admin if any files are changed (or added or removed), but all those plugins are traversing whole directory tree in regular intervals, either with a script scheduled with cron job or (even worse) on each page load.
So I thought how that’s not very efficient and I’ve made this program which uses Linux
inotifywait tool to monitor folder(s) for changes and responds on each modification. It is basically a program where you can define multiple folders (sites) to be watched, and whenever a file is removed, modified or added to the any of the watched folders the program will reverse the action, quarantine the modification/new file, and log it so you can allow it later if you want. It can watch all file types or only files of certain type (extension), and by default it’ll watch .php, .htm[l], .css, .js and .sql files only.
Here’s a demo:
It’s much faster than going through all the (sub)folders checking the files as it responds to file system changes (almost) in real-time. And it can be used for any site, not necessarily PHP-based or Wordpress powered site. One bonus option which is not shown in the demo above is ability to exclude any file/folder from the watched list so you can exclude e.g. cache folder which is constantly being changed.
So what do you think? Would anyone use this tool? Should I invest more time in this? If so, I’ll definitely need some help turning this into real linux service, as now it’s just a
.sh file running in the background.