Are there wild cards for a hosts file?

Discussion in 'other software & services' started by Mortal Raptor, Oct 30, 2014.

  1. Mortal Raptor

    Mortal Raptor Banned

    Joined:
    Oct 6, 2014
    Posts:
    1,013
    I entered 0.0.0.0 softonic.com but for example this site:

    http://safe-n-sec.en.softonic.com/

    Just loads fine, isn't there a way to block everything that ends with softonic.com as they seem to change the URL for every download
     
  2. Raza0007

    Raza0007 Registered Member

    Joined:
    Mar 30, 2009
    Posts:
    1,690
    Location:
    USA
    A Hosts file works with domain names only. So, if you want to block a website you need to enter its complete name. Wildcards are not allowed in a hosts file. If you need to use a wildcard then you need to install a DNS server on your PC, like dnsmasq.
     
  3. Mortal Raptor

    Mortal Raptor Banned

    Joined:
    Oct 6, 2014
    Posts:
    1,013
    oh what a shame, so I have to enter each URL separately :(
     
  4. tlu

    tlu Guest

    No, as wildcards or placeholders are invalid in the hosts file. It blocks only and exactly what's added to it. That's the major reason why all those publicly available hosts files like MVPS are that huge as all sub-domains for, e.g., doubleclick.net and the likes have to be seperate entries.

    @Raza0007: dnsmasq doesn't accept wildcards, either. However, adding an entry like

    Code:
    address=/softonic.com/0.0.0.0
    applies to all related sub-domains. That's why blocking of ads/trackers/malware with dnsmasq is clearly superior compared to a hosts file.
     
  5. Raza0007

    Raza0007 Registered Member

    Joined:
    Mar 30, 2009
    Posts:
    1,690
    Location:
    USA
    I have actually never used wildcard entries with dnsmasq personally, but before posting here I checked this Wikipedia entry and the comparison table lists the DNS servers that support wildcards and dnsmasq is listed as supporting wildcards.
     
  6. tlu

    tlu Guest

    Ah, okay, so I may be wrong. However, I still think that they should be unnecessary for what we're discussing here because simpy adding a domain like in the example above also covers all sub-domains. Thus, it is sufficient to add one entry like

    Code:
    address=/doubleclick.net/0.0.0.0
    where you need hundreds of entries in the hosts file. And adding specific sub-domains like

    Code:
    address=/ads.example.comt/0.0.0.0
    is still supported, of course.
     
  7. Compu KTed

    Compu KTed Registered Member

    Joined:
    Dec 18, 2013
    Posts:
    1,412
    If all your interested in doing is blocking certain domains then you could try using a PAC file. When you click on
    any domain that ends with in your example ( softonic.com) it will notify you that its blocked/refusing connections.
     
  8. Mortal Raptor

    Mortal Raptor Banned

    Joined:
    Oct 6, 2014
    Posts:
    1,013
    how to do that bro?
     
  9. Compu KTed

    Compu KTed Registered Member

    Joined:
    Dec 18, 2013
    Posts:
    1,412
    Depending on browser used you would have to configure the .pac file to use the connection
    settings of the browser.

    In Firefox and Mozilla forks - Automatic proxy configuration URL:
    Enter the file path into the blank field of APC (location where you put pac file)

    You can try a syntax like this: file:///C:/PacFIle/<name of pac file>.pac (doesn't have to be this location)
    Name you pac file - e.g., wipe-ads.pac or muncher.pac or any name you want to use with the .pac extension.

    So in this example I would type into the blank field of Automatic proxy configuration URL: file:///C:/PacFIle/wipe-ads.pac

    You could use an already pre-configured pac file or create your own. Also a pac file doesn't need JavaScript
    enabled to work.

    It may sound complicated but it's really not that hard to setup.

    http://sherylcanter.com/articles/oreilly_20040330_HostsPac.php
     
    Last edited: Nov 4, 2014
  10. siljaline

    siljaline Registered Member

    Joined:
    Jun 29, 2003
    Posts:
    6,617
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.