OmarAzizi / File-Specter

A linux daemon that monitors you files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flie Specter ⛓️

C Icon

  1. About File Specter
  2. Demo
  3. The Reason Behind This
  4. Installation & Usage
  5. Daemon Implementation

About File Specter

The file inspector or as I like to call it File Specter is a multithreaded Linux Daemon that monitors your files and notifies you via desktop notifications if they have been accessed.

Demo

Screencast.from.2024-02-04.21-43-09.mp4

The Reason Behind It

The main reason I created this daemon is primarily because I'm trying to teach myself systems-level programming in UNIX-based systems and familiarize myself with the available system libraries and their APIs. So this is probably not the best way I could write a daemon as I'm still learning. Therefore, if you have any suggestions for improvement or if you spot any bugs, you can contribute to this repository or reach out to me, so I can learn from it.

Installation & Usage

In order to install open the terminal and write:

git clone https://github.com/OmarAzizi/File-Specter.git

Then change your directory and build the project:

cd File-Specter
make filespecter

To run it properly you need to give it the path to the file you want to monitor, so you need to run it as follows:

./filespecterd <path>

Daemon Implementation

Monitoring The Files

To monitor the files I used the inotify API, which provides a mechanism for monitoring filesystem events.

Multithreading

I used threads in the daemon so that instead of doing the work sequentially, it can monitor the file and report any changes or access to it on different threads. Therefore, they run in parallel and they wont wait for each other to finish executing inorder to run. To get that done, I used the POSIX threads (Pthreads).

Desktop Notifications

To show the user that his file has been accessed, instead of printing it to the syslog, I used the libnotify notification API to do that in real-time.

About

A linux daemon that monitors you files

License:MIT License


Languages

Language:C 87.4%Language:Makefile 12.6%