![]() We just request you to keep the copyright message in the files. The complete source can be downloaded here and you are free to change or use it any application. This status would get reset again by running updater the next time. One way would be to have a fourth status for the semaphore called DISABLE which would prevent the scanner from running. ![]() This part has been kept open-ended as there are multiple ways of handling false alarms. Preferably you should run updater once after you make any changes to the file, so that scanner does not trigger a false alarm. The current code will send a false alarm if you make changes or upload changes to files on your webserver and the scanner runs automatically after that. Ideally you should put scanner.php in a cron job to run periodically and send auto-notification for changes. Then you can run scanner.php any number of times to detect changes. Once you have specified the files and paths in files.dat, run updater.php. You can still run scanner.php without the mail part – it will display the files which have changed. There is space and comments left for it at the end of scanner.php. In scanner.php you need to add in your own code to send the actual notification mail. Make sure the folder has write permissions since phpmonlist.dat will need to be updated periodically by updater.php the status is set back to Idle HOW TO MAKE ALL THIS WORKįirst put all the files in a folder in your website. If the status is not idle they terminate without doing any work. The updater and scanner both check the status of the semaphore before running. Idle – neither scanner not updater is running.The three states are stored as a simple string: If there is a difference it stores in a notification list and then sends the list as a mail. Scanner.php will run and compare the datetimes of each file in phpmonlist.dat and compare it with its current datetime. The PHPmonlist.dat thus created will contain the entries of individual files. Updater.php will run through files.dat and get the file datetime of each file mentioned If it finds a wildcard entry it will expand it first to get all the files matching that wildcard. It stores the full filepath and the datetime it was created. PHPmonlist.dat is an xml file created by the updater when it runs. So if a folder has subfolders, then each of those subfolders also need to be entered separately. This file has to be created by hand as every website would have different files to be monitored. The source file repository files.dat takes in a single path per row:Īs shown above you can put relative paths or absolute paths, with or without wildcard characters. If there is a difference then it flags it as a changed file. The scanner compares the current file date/time for each file in files.dat and compares it to the stored file date/time for the file in phpfilemon.dat. The updater stores the latest file dates and times of each file in files.dat, in phpfilemon.dat. scanner.php – processes phpfilemon.dat to detect changes and sends notification mails.updater.php – runs through all the files in files.dat and creates phpfilemon.dat.semaphore.dat – this acts like a simplistic semaphore to prevent the scanner and updater from running at the same time.phpfilemon.dat – this is an xml file which is created once the updater is run.files.dat – this is the source file respository which defines which paths/files need to be monitored.but we wanted something simple which could be used on any shared hosts without having to install something on the server. There are lot of defacement and change scanners available both commercial and open source like TripWire etc. What PHPfilemon does is detect changes and send notifications so it can be applied to any number of things. This can also be used as a notification system, every time someone uploads or does authorized changes to the files on the website. This can be mainly used as a notification tool for security purposes in case someone hacks into the website and plants extra code or malicious code in one of the files/pages physically. What led us to the creation of PHPFileMon was finding a simple way of monitoring if any file on a website had been altered or changed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |