This project is a Flask-based application that monitors the activity of a Chrome extension and incognito mode. It ensures that the Chrome browser closes if the extension is inactive or incognito mode is disabled for more than a specified time.
This application works in conjunction with a Chrome extension. The extension sends periodic heartbeat signals to the Flask server to indicate its status and whether Chrome is in incognito mode. If the Flask server does not receive these signals within a specified time (20 seconds in this case), it triggers a countdown to close the Chrome browser to maintain security.
- Monitors the status of a Chrome extension and incognito mode.
- Closes Chrome browser if the extension is inactive or incognito mode is disabled for more than 20 seconds.
- Uses Flask to handle HTTP requests from the Chrome extension.
- Runs a monitoring loop to manage the countdown and potential closure of Chrome.
- Python 3.x
- Flask
- Chrome browser
- A Chrome extension that sends heartbeat signals to the Flask server.
-
Clone the repository:
git clone https://github.com/johntaraj/Extension-Based-Website-Blocker.git
-
Install the required Python packages:
pip install Flask
-
Run the Flask server:
python blocker.py
- The Flask server runs and listens for heartbeat signals from the Chrome extension.
- The Chrome extension periodically sends a POST request to the
/heartbeat
endpoint with its status and incognito mode status. - The Flask server resets the countdown timer upon receiving the heartbeat signal.
- If the Flask server does not receive a heartbeat signal for more than 20 seconds, it triggers a countdown.
- If the countdown reaches zero without receiving a new heartbeat signal, the server closes the Chrome browser.
You need a Chrome extension that sends periodic POST requests to the /heartbeat
endpoint of this Flask server with the status of the extension and incognito mode.
To use the extension, load the folder extension in chrome as developer mode, enable it, and run blocker.py
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please fork the repository and submit a pull request.