1. Welcome to NoFap! We have disabled new forum accounts from being registered for the time being. In the meantime, you can join our weekly accountability groups.
    Dismiss Notice

Explanation of the HOSTS file method. (Windows/Android/Mac OS X)

Discussion in 'Off-topic Discussion' started by icandoallthings, Apr 22, 2017.

  1. I see many people going through the Internet Filter method(using K9 or some other Blocker).
    But for those of you who want flexibility and control(Windows, Android, iOS(Jailbreak Only) or just don't want to download additional software, I'll be going over what the hosts file really does and how you can customize its usage to suit your needs.

    FOR WINDOWS
    1. Open Notepad in Administrator Mode(Right-click on Notepad ->Run as Administrator)
    2. File -> Open -> C:\Windows\System32\drivers\etc -> Change from Text Documents to All Files in the dropdown menu -> Double-click on Hosts. This should open up the hosts file in notepad

    FOR MAC OS X : http://www.switchingtomac.com/tutorials/how-to-edit-the-hosts-file-in-os-x/

    FOR ANDROID : https://www.howtogeek.com/140576/how-to-edit-the-hosts-file-on-android-and-block-web-sites/

    Because of Apple's strict security measures, it is not possible to access/edit the hosts file at the moment without Jailbreaking your iOS device.

    All the tutorials here will tell you to create a line :
    127.0.0.1 www.(sitetoblock).com


    So when you type a website into your browser, what happens is your browser first looks up the Hosts file for the IP if it has been defined. If not, it sends a request to a server that responds with the IP address of the website you are looking for. Your computer now sends a request to that IP Address and the server responds and displays the website you are looking for.

    127.0.0.1 is the IP Address of the Machine you are using. So when you put this in your Hosts file, your browser assumes that your PC is the server and requests it for the web page. But since you don't host the website, you are displayed with the message the website can't be found.

    You don't necessarily have to use 127.0.0.1
    My reasoning is that when you search for P, you are going through some urges.
    So instead, we redirect to the NoFap Emergency Relapse Tool by replacing 127.0.0.1 with the IP Address of the tool instead.

    Each website has an IP Address linked to it. You can find the IP Address of a website using the command "nslookup".

    If you are on Windows: Go to Command Prompt -> Type nslookup followed by the website you are looking for -> Hit Enter
    eg. nslookup facebook.com
    nslookup google.com
    nslookup emergency.nofap.com

    If you are on Mac OS X: Go to Terminal-> nslookup (websiteyouarelookingfor).com -> Enter

    The result you are looking for can come up in either this way,
    upload_2017-4-22_13-18-59.png

    or this way,
    upload_2017-4-22_13-10-53.png

    or even,
    upload_2017-4-22_13-11-25.png


    TO REDIRECT TO NOFAP'S EMERGENCY WEBSITE:

    Command Prompt( or Terminal on Mac) -> nslookup emergency.nofap.com -> Enter
    (As shown in the image above)

    So the line to input in the Hosts file becomes:

    104.131.35.216 www.(website1).com www.(website2).com www.(website3).com ... and so on. Where website1, website2, website3 are the websites you wish to block.

    After reading this post, you will now be able to fool your browser into blocking/redirecting websites you no longer wish to visit.
    This method is good if you want to block a few frequent websites. In my experience using a Filter can be bypassed using an online VPN. In that case you can use this method to block/redirect when you try to access the VPN Website instead.

    In another post, I'll talk about how you can password protect a folder in Windows so that you can't access the files within.
     
    Calculas likes this.

Share This Page