Anti Porn HOSTS File
The purpose of this repository is to distribute a useful means to fight porn addiction.
If you are willing to improve your life and get rid of porn addiction then visit NoFap®
What's the HOSTS file and how it can prevent access to porn sites?
A HOSTS file contains the mappings of IP addresses to host names on a system.
Within that HOSTS file we can prevent our browser from accessing porn sites.
What's so special about this repository?
HOSTS.txt contains a huge list of porn sites (probably the biggest list you can find on the Internet).
Just copy-pasting its contents on your machine's HOSTS file enables the blocking mechanism.
HOSTS on Windows 7/8.x/10/11
Using Notepad
- Right mouse click on Notepad icon then click on
Run as administrator
- File → Open... then insert the path
C:\windows\system32\drivers\etc\hosts
- Add a new line and copy-paste the entire content of HOSTS.txt
- Save
- Reboot
Using Windows PowerShell
- Open HOSTS.txt and add a newline to the beginning
- Save and close HOSTS.txt
- Open Windows PowerShell
- Run this command in Windows PowerShell:
Get-Content HOSTS.txt | Add-Content "C:\windows\system32\drivers\etc\hosts"
Using Cygwin
- Open HOSTS.txt and add a newline to the beginning
- Save and close HOSTS.txt
- Right mouse click on Cygwin icon then click on 'Run as adminstrator`
cd
to where HOSTS.txt lives- Run this command in Cygwin:
cat HOSTS.txt >> /cygdrive/c/Windows/System32/drivers/etc/hosts
- Reboot
The steps in Cygwin should be similar on in any POSIX compatible system running on Windows.
HOSTS on Linux and macOS
- Open the terminal
- Type
sudo vim /etc/hosts
- Add a new line and copy-paste the entire content of HOSTS.txt
- Save
- Reboot
HOSTS on Android
Using Hosts Go
- Install Hosts Go
- Download "HOSTS.txt" and put it somewhere inside your phone
- Open Hosts Go
- Click on HOSTS EDITOR button
- Click on three dots top-right corner
- Import HOSTS file you previously downloaded
- Go back and START
Using DNS66
- Install DNS66
- Open DNS66
- Click on HOSTS button to select the "HOSTS" section of the APP
- Click on the + floating button on the lower-right corner
- Insert a title of your choice and the following url: https://raw.githubusercontent.com/4skinSkywalker/Anti-Porn-HOSTS-File/master/HOSTS.txt
- Save the filter you created by clicking the check mark on the top-right corner
- Press the refresh button on the top-right corner
- Go back to the "START" section of the APP and start it
- You should notice a symbol indicating an active VPN on your Android system
Rooting (requires computer)
THIS METHOD IS FOR ADVANCED USERS ONLY
Assuming you already took the steps to root your device, which won't be instructed here, have adb
installed on a computer, and also understand the risks that can come with rooting a device:
- Connect your device via USB to your computer.
- Enable Developer mode on your device if you haven't done so already. (Settings > About phone > Tap "Build number" five times)
- Make sure the USB Debugging (and Rooted Debugging), options are enabled. (Settings > System > Developer options > "USB debugging" & "Rooted debugging")
- Find your device by running
adb devices
on your computer. (If it prints "unauthorized", check for a pop up on your device asking for permission to use USB debugging") - Pull the device's hosts file by running
adb pull /system/etc/hosts
. - Open the
hosts
file in your preferred editor, and copy-paste all the contents of HOSTS.txt in a new line. Save the file. - Enable root access on ADB by running
adb root
. - Remount the filesystem by running
adb remount
. - Push the file back to your device by running
adb push hosts /system/etc
. - If the device was rooted properly, it should successfully block all sites listed. If it doesn't work right away, try rebooting.
- (optional) If you want to make it a little more difficult to edit the file (so that you dont delete it), go into your device's shell with
adb shell
, and make thehosts
file immutable by runningchattr +i /system/etc/hosts
. You can remove the immutability by replacing+i
with-i
.
Make a promise
Once the mechanism is in place and working, do not disable it.
If you disable it on demand to watch porn then you defeat the very purpose of it, but more than that you betray yourself.
Contribute
Become an open source contributor in 7 steps (it takes less than 30 minutes):
- Fork this repository
- Clone the repository into your PC
- Create a new branch
- Change whatever you think it has to be improved
- Commit your changes
- Push your changes to GitHub
- Submit a PR
Your changes won't be visible immediately; first they have to be merged by the project maintainer.
Donation
If you feel like you want to donate something