Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Hosts File Nightmare

Hosts File Nightmare

Scheduled Pinned Locked Moved The Lounge
help
15 Posts 11 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S snorkie

    I modified my hosts file in Windows this morning to block some ads. It ended up nearly bricking my Win 10 machine. Press the start button and type "cmd" and nothing showed up. Windows Defender decided it was a virus that modified the file and blocked all Internet. 90 minutes later and lots of help, we rolled back the hosts file to empty and my machine is working again.

    Hogan

    D Offline
    D Offline
    dandy72
    wrote on last edited by
    #5

    If blocking sites using the hosts file is the sort of thing you like to do, you might be a candidate for [Pi-hole](https://pi-hole.net/). Despite its name, it's not just for the Raspberry Pi. I have it running on a tiny VM running Debian dedicated to it. My machines now use the VM's IP as their primary DNS, so *all* devices on my network get all the same sites blocked. The community at large is maintaining the list, so it's pretty good and up to date. Of course, you can add your own blacklist/whitelist.

    S 1 Reply Last reply
    0
    • D dandy72

      If blocking sites using the hosts file is the sort of thing you like to do, you might be a candidate for [Pi-hole](https://pi-hole.net/). Despite its name, it's not just for the Raspberry Pi. I have it running on a tiny VM running Debian dedicated to it. My machines now use the VM's IP as their primary DNS, so *all* devices on my network get all the same sites blocked. The community at large is maintaining the list, so it's pretty good and up to date. Of course, you can add your own blacklist/whitelist.

      S Offline
      S Offline
      snorkie
      wrote on last edited by
      #6

      I think I'll do that for home, but at the office its probably a bad idea :-D

      Hogan

      D C 2 Replies Last reply
      0
      • S snorkie

        I think I'll do that for home, but at the office its probably a bad idea :-D

        Hogan

        D Offline
        D Offline
        dandy72
        wrote on last edited by
        #7

        Well, as long as only your own system(s) are using Pihole for their DNS, it really shouldn't affect anyone else. In theory.

        1 Reply Last reply
        0
        • S snorkie

          I modified my hosts file in Windows this morning to block some ads. It ended up nearly bricking my Win 10 machine. Press the start button and type "cmd" and nothing showed up. Windows Defender decided it was a virus that modified the file and blocked all Internet. 90 minutes later and lots of help, we rolled back the hosts file to empty and my machine is working again.

          Hogan

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #8

          My host file is "mostly" the MVPS one, but some custom entries are added to that. Meaning, no ads on youtube. No insecure ads loaded on the machine, all is blocked, every site. It is my machine and I control what gets executed and what isn't even downloaded. Anyone can buy ads and spread malicious code. It's a little program in C# that keeps it up to date. For a few computers :) Modifying the host file doesn't impact the abilities of the "run" command on Windows, so that has nothing to do with cmd not executing.

          Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

          K 1 Reply Last reply
          0
          • S snorkie

            I think I'll do that for home, but at the office its probably a bad idea :-D

            Hogan

            C Offline
            C Offline
            Clumpco
            wrote on last edited by
            #9

            snorkie wrote:

            at the office its probably a bad idea

            Obviously if you are in a corporate environment (your IT dept should be blocking the crap for you anyway), but if it is a small company with local IT expertise, pi-hole would probably be ideal.

            So old that I did my first coding in octal via switches on a DEC PDP 8

            1 Reply Last reply
            0
            • L Lost User

              My host file is "mostly" the MVPS one, but some custom entries are added to that. Meaning, no ads on youtube. No insecure ads loaded on the machine, all is blocked, every site. It is my machine and I control what gets executed and what isn't even downloaded. Anyone can buy ads and spread malicious code. It's a little program in C# that keeps it up to date. For a few computers :) Modifying the host file doesn't impact the abilities of the "run" command on Windows, so that has nothing to do with cmd not executing.

              Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

              K Offline
              K Offline
              Keefer S
              wrote on last edited by
              #10

              Would you be interested in sharing? We do a lot of stuff in C# and I'm always on the lookout for improved ways to block unwanted data from hitting our network. We use a robust 3rd party Endpoint service and are pretty happy with it, but this thread caught my eye.

              L 1 Reply Last reply
              0
              • S snorkie

                I modified my hosts file in Windows this morning to block some ads. It ended up nearly bricking my Win 10 machine. Press the start button and type "cmd" and nothing showed up. Windows Defender decided it was a virus that modified the file and blocked all Internet. 90 minutes later and lots of help, we rolled back the hosts file to empty and my machine is working again.

                Hogan

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #11

                I don't mind adding to my hosts file on a weekly basis. The "problem" I had was the constant renaming (hosts to hosts.tmp and vice-versa) when a legitimate site wouldn't load and I needed the hosts files turned off for a second. I then started using HostsMan. Things are way simpler now.

                "One man's wage rise is another man's price increase." - Harold Wilson

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

                1 Reply Last reply
                0
                • S snorkie

                  I modified my hosts file in Windows this morning to block some ads. It ended up nearly bricking my Win 10 machine. Press the start button and type "cmd" and nothing showed up. Windows Defender decided it was a virus that modified the file and blocked all Internet. 90 minutes later and lots of help, we rolled back the hosts file to empty and my machine is working again.

                  Hogan

                  M Offline
                  M Offline
                  Mark Starr
                  wrote on last edited by
                  #12

                  I rarely edit my hosts file these days: I opted instead for setting up a Pi Hole on a Raspberry Pi. It’s got 1.5 MM entries in it from various lists. All devices on my LAN point to it as the DNS.

                  Time is the differentiation of eternity devised by man to measure the passage of human events. - Manly P. Hall Mark Just another cog in the wheel

                  J 1 Reply Last reply
                  0
                  • M Mark Starr

                    I rarely edit my hosts file these days: I opted instead for setting up a Pi Hole on a Raspberry Pi. It’s got 1.5 MM entries in it from various lists. All devices on my LAN point to it as the DNS.

                    Time is the differentiation of eternity devised by man to measure the passage of human events. - Manly P. Hall Mark Just another cog in the wheel

                    J Offline
                    J Offline
                    Jeremy Falcon
                    wrote on last edited by
                    #13

                    Same. Works like a champ and Windows can't stop the magic.

                    Jeremy Falcon

                    1 Reply Last reply
                    0
                    • S snorkie

                      I modified my hosts file in Windows this morning to block some ads. It ended up nearly bricking my Win 10 machine. Press the start button and type "cmd" and nothing showed up. Windows Defender decided it was a virus that modified the file and blocked all Internet. 90 minutes later and lots of help, we rolled back the hosts file to empty and my machine is working again.

                      Hogan

                      P Offline
                      P Offline
                      Peter Adam
                      wrote on last edited by
                      #14

                      It happened in the W8 era, too: [Hosts file is detected as malware in Windows Defender - Microsoft Support](https://support.microsoft.com/en-us/topic/hosts-file-is-detected-as-malware-in-windows-defender-4320fa8b-0d54-1129-db85-61f095144521)

                      1 Reply Last reply
                      0
                      • K Keefer S

                        Would you be interested in sharing? We do a lot of stuff in C# and I'm always on the lookout for improved ways to block unwanted data from hitting our network. We use a robust 3rd party Endpoint service and are pretty happy with it, but this thread caught my eye.

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #15

                        Can rewrite it in C# in a bit, it's not a piece of art or complex. Might be worth an article. Basically, you send a header to the MVPS host file, asking if there's a change to the file since that date. If it is, download and put it somewhere (I used SQLite, to propagate across my linked pc's). Add your own domains to it, merging two text files. Then overwrite your hostfile. Could prolly be done from a powershell script, but for me it was quicker in C# because I have more familiarity with C#. The PI Hole might work better, especially for a network, and your host file should not be huge. I like it because it works nicely on laptops where the PI Hole isn't always available. But basically it is download and merge, and the only nice thing about it is that it asks the MVPS host file if it changed, and if it didn't it won't download again. So, not a huge project, but I find it valuable for the moments that all other stuff fails.

                        Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups