Drupal 7, Is there a module that detects file structure changes? Recently one of my clients sites was hacked and hackers uploaded a few directories and files into the web root folder.

I'm looking for a module or a method that has the ability detect file structure changes in the web root of drupal and any sub folder. In the end I want it to be able to email me when files get added or directories get made.
There is quite a few:


https://drupal.org/project/md5check (7.x.1.0 - actively maintained)
https://drupal.org/project/hacked (7.x.2.0-beta -seeking new maintainer)
https://drupal.org/project/sentry_server (6.x.1.x-dev -  seeking co-maintainer)
https://drupal.org/project/file_integrity (abandoned)


I've included those abandoned and seeking new maintainers, in case you want to revive them or use them as starting points for your own project.

However, as noted by Clive, this is easier to set up and maintain outsite of Drupal.  Here  is a broad outline of what you need:

First, recursively run through every file and sub-folder on the server within the current directory of the script and generate a file containong the "master" hash for each.  Repeat this whenever you update your site by installing new modules, etc. or updating old ones.

Create a script (in your favourite scripting language) to do the following, and activate it with cron at regular intervals. Make sure that it is not remorely executable (store it outside the web root).


Load configuration file (list of files to exclude from scan, etc.)
Recursively run through every file and sub-folder on the server within the current directory of the script.
Generate a hash for each file and compare with the master hash
Alert (e.g. by email) if different.


Based on: How to detect if your webserver is hacked and get alerted. They also have a script (WebsiteCDS) that does this taht you can download.  I haven't used it, and can't vouch for the quality of their code.