Website Blocker Project Presentation
Website Blocker Project Presentation
A Project Presentation
Introduction
• In the digital age, distractions are constant.
Social media, video platforms, and gaming
sites often lead to reduced productivity. A
website blocker application can help users
stay focused by restricting access to specific
sites during certain hours.
Objective
• To develop a Python-based website blocker
that allows users to block distracting websites
during work or study hours through a user-
friendly interface.
Why Use a Website Blocker?
• Improves concentration
• Reduces procrastination
• Enhances productivity
• Supports digital well-being
Project Overview
• This project involves building a Python
application that manipulates the system hosts
file to block specific websites temporarily.
Technologies Used
• • Python
• • Tkinter (GUI)
• • OS and datetime modules
• • Text file handling
System Requirements
• • Python 3.x
• • Admin/root access (to modify hosts file)
• • Cross-platform (Windows/Linux/Mac)
Hosts File
• The hosts file is a local file used by the
operating system to map hostnames to IP
addresses. By redirecting sites to localhost, we
can block them.
How Blocking Works
• • Websites are redirected to 127.0.0.1
• • This prevents the browser from accessing
the real site
• • The script controls access based on time
Main Features
• • Add/remove websites from block list
• • Set work hours for blocking
• • Auto-block based on time
• • GUI interface
• • Logs activity
Application Workflow
• 1. User inputs websites
• 2. Sets work hours
• 3. Starts blocker
• 4. Script edits hosts file accordingly
• 5. Logs actions
Python Libraries Used
• • tkinter – GUI
• • os – system operations
• • datetime – scheduling
• • threading – background process
• • time – sleep function
GUI Interface
• A Tkinter-based graphical interface allows
users to add websites, start or stop blocking,
and view logs.
Step 1: GUI Initialization
• Create main window
• Add input fields, buttons, and text area
• Organize layout with grid or pack
Step 2: Website Management
• Functions to add websites to block list
• Remove websites
• Update the local file
Step 3: Blocking Logic
• Read current time
• Compare with user-defined hours
• If in working hours, modify hosts file
Step 4: Logging
• Log each block/unblock activity with
timestamps
• Display logs in a scrolled text box
Sample Code Snippet
• with open(hosts_path, 'r+') as file:
• content = file.read()
• for site in websites:
• if site not in content:
• file.write(f'{redirect_ip} {site}\n')
Background Thread
• Use threading to run the blocker in
background without freezing GUI.
Scheduling
• Allows user to define blocking hours (e.g., 9
AM to 5 PM)
Handling Permissions
• Modifying hosts file may require admin
privileges. Users should run the app with
elevated rights.
Security Considerations
• Avoid exposing sensitive operations
• Validate user input to prevent abuse
Advantages
• • Simple and effective
• • Helps form better digital habits
• • Fully local – no internet dependency
Limitations
• • Can be bypassed by tech-savvy users
• • Requires admin rights
• • Only blocks browser-based access
Possible Improvements
• • Add password protection
• • Track screen time
• • Integrate with browser plugins
• • Auto-start on boot
Use Cases
• • Students focusing on study
• • Employees reducing distractions
• • Parents limiting access for kids
User Interface Preview
• A screenshot or mockup of the app GUI.
Demo Flow
• 1. Launch app
• 2. Enter websites
• 3. Set time
• 4. Click start
• 5. Websites get blocked
Testing
• Test blocking during working hours
• Test unblocking after working hours
• Test UI responsiveness
Code Modularity
• Functions are separated for logic, GUI, file
handling, and threading.
Error Handling
• Includes try-except blocks
• Handles file errors, permissions, and invalid
inputs.
Cross-Platform
• Compatible with Windows and Unix-like
systems. Uses platform-specific paths.
Ethical Use
• Should not be used to control others without
consent. Intended to support self-discipline.
Open Source
• This project can be extended, improved, or
integrated with community tools.
Future Scope
• Add scheduler
• Remote control via web app
• Detailed usage analytics
Conclusion
• This Python-based website blocker is a simple
yet powerful tool to help users stay productive
and manage digital distractions.
Q&A
• Any Questions?
Thank You
• Presented by [Your Name]