This project monitors both the clipboard and filesystem for specific activities within a specified root directory. It is designed to:
- Prevent users from copying files or directories within the root directory and outside the directory to the clipboard.
- Clipboard Monitoring: Monitors the clipboard for any file paths being copied, and if the path belongs to the restricted directory, the content is cleared.
- Cross-platform (Windows-only currently): This solution uses Windows-specific APIs (Windows.h, AclAPI.h) and is compatible with Windows operating systems.
- Project Setup
- Directory Structure
- How It Works
- Compilation Instructions
- Troubleshooting
- Contributions
To run this project, you will need:
- A Windows operating system (the project is specifically built for Windows).
- A C++ development environment (like Microsoft Visual Studio, or MinGW).
- Windows SDK (for access to Windows APIs like Windows.h, AclAPI.h).
/project-root
├── main.cpp # Main entry point for the application.
├── clipboard_monitor.cpp # Clipboard monitoring implementation.
├── clipboard_monitor.h # Header file for clipboard monitoring.
└── README.md # This file.The ClipboardMonitor class monitors the clipboard for any copied content that may refer to the restricted root directory. If such content is found, the clipboard is cleared to prevent any attempt to paste restricted content.
Important functions:
- OpenClipboard(): Opens the clipboard for access.
- EmptyClipboard(): Clears the clipboard content.
- CloseClipboard(): Closes the clipboard access.
The main() function initializes the monitoring by calling ClipboardMonitor::start() on a specified directory path. It then enters an infinite loop (while (true)) to keep the application running, periodically checking the clipboard and filesystem.
- The clipboard is continuously monitored. If any text is copied that contains a file path within the restricted directory, the text is removed from the clipboard to prevent its use.
- Only paths that contain the restricted directory path are blocked.
git clone https://github.com/yourusername/Data-Security-Sentinel.git
cd Data-Security-Sentinel- Open your C++ IDE (e.g., Visual Studio) and create a new C++ project.
- Add all the source files (main.cpp, clipboard_monitor.cpp) and header files (clipboard_monitor.h) to your project.
- Ensure that your project is configured to link against the Windows SDK libraries, especially for Windows-specific functions like AclAPI.h, windows.h, etc.
- Compile the project using your IDE's build options.
Alternatively, if you're using a command-line interface like g++ (MinGW), you can use the following command:
cd path/to/your/directory
g++ main.cpp clipboard_monitor.cpp -o MonitorApp -laclOnce compiled, run the executable (MonitorApp.exe). The program will start monitoring the specified directory and clipboard for any restricted actions.
./MonitorApp.exe- Failed to open directory for monitoring:
- Ensure the directory exists and the program has proper permissions to access it.
- You may need to run the program with administrator privileges to modify file system permissions.
- Permission errors when setting file or directory protection:
- Make sure the program has the necessary administrative rights to modify security settings of files and directories.
- Clipboard not clearing when paths are copied:
- Check that the clipboard contains a path that includes the root directory. If the path does not match, the clipboard content will not be cleared.
Feel free to contribute to this project by forking the repository, making improvements, and submitting pull requests.