Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions projects/Website Blocker/Instructions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
To block a website, put it inside the website list in both files.
Run these scripts as administrator
18 changes: 18 additions & 0 deletions projects/Website Blocker/website_blocker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import platform

if platform.system() == "Windows":
pathToHosts=r"C:\Windows\System32\drivers\etc\hosts"
elif platform.system() == "Linux":
pathToHosts=r"/etc/hosts"

redirect="127.0.0.1"
websites=["https://www.sislovesme.com/","https://motherless.com/","https://xhamster.com/","https://www.xnxx.com/","https://www.xvideos.com/","https://www.pornhub.com/"]

with open(pathToHosts,'r+') as file:
content=file.read()
for site in websites:
if site in content:
pass
else:
file.write(redirect+" "+site+"\n")

17 changes: 17 additions & 0 deletions projects/Website Blocker/website_unblocker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import platform

if platform.system() == "Windows":
pathToHosts=r"C:\Windows\System32\drivers\etc\hosts"
elif platform.system() == "Linux":
pathToHosts=r"/etc/hosts"

websites=["https://www.sislovesme.com/","https://motherless.com/","https://xhamster.com/","https://www.xnxx.com/","https://www.xvideos.com/","https://www.pornhub.com/"]

with open(pathToHosts,'r+') as file:
content=file.readlines()
file.seek(0)
for line in content:
if not any(site in line for site in websites):
file.write(line)
file.truncate()