Giter Site home page Giter Site logo

website-blocker's Introduction

Python Website Blocker

This is an application built with python that will block certain websites from being able to be accessed during work hours (8 AM to 4 PM).

This program will check the current time every 5 seconds by using a while loop and the package datetime. If the current time is between 8 AM and 4 PM then it will open the hosts file and write in the website names that we want to block. The hosts file contains the mappings of IP addresses that are linked to host names.

This is what a sample hosts file may look like. Here we are linking the Facebook website with our localhost IP adress 127.0.0.1.

# HOST FILE 
## 
127.0.0.1 localhost 
255.255.255.255 broadcasthost 
::1 localhost 

127.0.0.1 www.facebook.com 
127.0.0.1 facebook.com 

When we try to access the Facebook website, the broswer will redirect us to our localhost IP address instead. Since the Facebook website does not exist on our localhost, the broswer will give us back an error page instead. This is the error page that the browser gives us when we try to access Facebook during work hours This is the error page that the browser gives us when we try to access Facebook during work hours

If the current time is not during work hours, then it will open the hosts file and remove the website names so that they will not be blocked anymore using the truncate() method.

This is perfect for preventing employees from visiting certain websites on work computers, restricting website access to kids, or to just simply help you avoid distractions!

website-blocker's People

Contributors

shubhamj010 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.