In our previous post, we created a database to store all our information and added a config file to read variables from. In this post, we’ll build off that config file while incorporating email alerts when changes are detected.

Update the Config File

Because we’ve already done most of the groundwork, we’ll be Keeping this post fairly short and simple. Setting an email account and where to send our alerts is the perfect opportunity to use the configuration file we created previously.


Sending Emails

This section is the bulk of the code we’ll be adding to the main script. As you can see, it doesn’t take much effort on our part to send an email. They are lots of other options for sending alerts if you want to get creative. You could look at using SMS, Slack, Discord, or even push notifications.


Putting It All Together

Taking our email code, we’re able to update the previous version of the tool with not a whole lot of changes. The full updated script is below.



Email Sent


This wraps up part 4 of building our File Integrity Monitor. With our new email-based alerting, we’ll be notified of any changes made even when we’re not at our machine. In the next post, we’ll be looking at adding the last piece of functionality, restoring modified files to their approved versions.