This is a simple python script that organizations can use in their office computers to block certain websites, for example, www.bing.com or www.facebook.com, during their working hours.
to change the webiste you need to block , open the py file in any code editor , replace the webiste in this line
and save it as pyw file .
first, you need to make some administration changes in the host file, which is located
for windows
C:\Windows\System32\drivers\etc\hosts
right-click on the host file and click properties
after that, click on the safety
then in the groups or usernames box, select all applications packages
, click on edit, then in the permission for users box, click on write permission
now click on ok
now you need to schedule this script
Scheduling in Windows: Scheduling of above script is little bit trick but I will guide you step by step-
1.First of all change the extension of your script from “.py” to “.pyw”. 2.Now open task scheduler. Task scheduler should look like this:
You may see website blocker already scheduled because I have already scheduled in my computer for my testing purpose. Follow further instruction of scheduling carefully in order to schedule website blocker in your computer.
3.Click on “create task”. Fill the name of your choice and flag “Run with highest privilege”.
- Now go to triggers, select “At startup” for begin the task.
5.Go to Action bar and create a new action and give path of your script.
- Go to conditions bar and unflag the power section.
- Press ok and you can see the script scheduled.
- Finally restart your computer and see the magic.
Note: You can also check instantly by clicking run button.