sysfile_noti
is a tool written in C to monitor file changes on a Linux system and notify you through a Telegram bot. It leverages the inotify
API to track file events such as creation, modification, deletion, and movement within a specified directory. It might help you to get started in developing more sophiscated and with more feature's for your client, company that you are working in ...
This is just a Sample Code to get you help started ..........
- Monitors file creation, deletion, modification, and movements in a specified directory.
- Sends real-time notifications to a Telegram bot.
- Configurable via a simple
config.ini
file. - notifications you will get in Bot :
- File created: example.txt
- File modified: data.log
- File deleted: old_file.txt
- File moved to: new_location.txt
-
Configuration:
- Create a
config.ini
file with your Telegram bot token and chat ID:token=<your-telegram-token> chat_id=<your-chat-id>
- Create a
-
Specify Directory:
- Update the
path
in the source code to define the directory you want to monitor:const char *path = "/home/user";
- Update the
-
Dependencies:
- Install
libcurl
to handle HTTP requests:sudo apt-get install libcurl4-openssl-dev
- Install
-
Compilation:
- Compile the program using
gcc
with the-lcurl
flag:gcc -o notify notify.c -lcurl
- Compile the program using
-
Run:
- Start monitoring the specified directory:
./notify
- Start monitoring the specified directory:
- Add functionality to monitor all directories in the Linux filesystem.
- Enable auto-run when the system starts.
- Integrate shell scripts for user interaction before execution.
- Add feature to know who changed(user login) & at what time
- Rewrite in other stack's
- ................................