Page 1 of 1
Some of you guys might find this helpful
Posted: 24 Feb 2012, 07:08
by Forboding Angel
As some of you may remember, I use windows HOSTS to do a lot of filtering for known virus and adservers with the help of various sources but mainly
http://winhelp2002.mvps.org/hosts.htm
So anyway, I wanted a program that I could use on customers machines and would update itself automatically. Here is the result of what I have done.
Basically this program installs, grabs the hosts file from
http://winhelp2002.mvps.org/hosts.txt , and backs up your hosts file (as HOSTS.MVP in drivers/etc) and replaces it with this one. It runs on startup as well (just via the startup folder in the start menu, so that part is easy to disable, no need for msconfig).
Runtime is basically instantaneous. Check it out. As I said, I created this for use on my customers machines, but I thought that others might have use for it. It is really neat having ads and spyware always blocked. Daddy likes
There are other programs out there that do this, but they are akin to swatting a fly with an elephant, whereas this program is akin to taking a surgical knife to the fly's knees.
#WinHOSTS
P.S. Yes I know, it could be nicer, better, do this and that in the background, blah blah blah. Feel free to improve upon it.
Re: Some of you guys might find this helpful
Posted: 24 Feb 2012, 09:41
by Cheesecan
Seems like a nice idea and it's not invasive to the user which is good.
Forboding Angel wrote:
P.S. Yes I know, it could be nicer, better, do this and that in the background, blah blah blah. Feel free to improve upon it.
Think you forgot to post the source code then.

Re: Some of you guys might find this helpful
Posted: 24 Feb 2012, 10:21
by Forboding Angel
It's in the install. Including the iip file needed for install creator.
Just look in the install directory.
Re: Some of you guys might find this helpful
Posted: 24 Feb 2012, 10:41
by Cheesecan
I don't see it, but ok.
Re: Some of you guys might find this helpful
Posted: 24 Feb 2012, 11:30
by knorke
error handling?
so you delete the HOSTS file and if wgets fails to download hosts.txt for whatever reason, then there is not HOSTS file at all?
Also the bat will print "THE MVPS HOSTS FILE IS NOW UPDATED" even if did nothing at all due not finding files or w/e
Re: Some of you guys might find this helpful
Posted: 24 Feb 2012, 11:37
by Forboding Angel
Code: Select all
REM Get rid of old HOSTS files sitting around
del HOSTS
cls
wget http://winhelp2002.mvps.org/hosts.txt
ECHO Updating to the latest hosts file from: http://winhelp2002.mvps.org/hosts.txt
ren hosts.txt HOSTS
cls
start mvps.bat
mvps.bat is the update batch used for winhelp2002 that actually replaces the HOSTS file (and backs up the original).
That's basically all the program does. But it's nice to have a program that does it (especially on startup so you don't have to worry about updating your HOSTS file). Moreover, you can get all the old people you know to run a program like this, and all of a sudden you stop having to do so much bullshit cleaning lady work for your family and their computers.
Or maybe you don't really understand what all this HOSTS file stuff is, but you like the thought of ad/spyware/malware/virus servers being blocked and don't really want to have to learn how to use it. This tool is for you.
It's not that it does anything groundbreaking, it's that it fills a void and does so easily and cleanly.
Re: Some of you guys might find this helpful
Posted: 24 Feb 2012, 11:41
by Forboding Angel
Yeah you're right knorke, I'll add some logic to fix that
Change logic to:
Code: Select all
wget http://winhelp2002.mvps.org/hosts.txt
ECHO Updating to the latest hosts file from: http://winhelp2002.mvps.org/hosts.txt
cls
if exist hosts.txt (
del HOSTS
ren hosts.txt HOSTS
) else (
exit
)
cls
start mvps.bat
That should do the trick. Thanks for pointing that out!
Edit: Actually, I'll add a warning about needing an internet connection to the else.
Re: Some of you guys might find this helpful
Posted: 24 Feb 2012, 12:01
by knorke
cls right after echo -> message gets cleared instantly before you can read it.
Edit: Actually, I'll add a warning about needing an internet connection to the else.
why not show the error returned by wget instead of making assumptions?
http://www.gnu.org/software/wget/manual ... xit-Status
Re: Some of you guys might find this helpful
Posted: 24 Feb 2012, 12:10
by Forboding Angel
For whatever reason, wget refuses to output when run from the compiled bat file. Irritating, but not too horrible. Wget output might confuse some users though.
Code: Select all
ECHO OFF
cls
ECHO Updating to the latest hosts file from: http://winhelp2002.mvps.org/hosts.txt
wget http://winhelp2002.mvps.org/hosts.txt
cls
if exist hosts.txt (
del HOSTS
ren hosts.txt HOSTS
) else (
ECHO #WinHOSTS was unable to download the latest HOSTS file from http://winhelp2002.mvps.org/hosts.txt
ECHO.
ECHO Please make sure that your computer is connected to the internet, then try running #WinHOSTS again!
pause
exit
)
cls
start mvps.bat
This is my current iteration.
Edit: Install file updated.
Re: Some of you guys might find this helpful
Posted: 24 Feb 2012, 12:18
by Forboding Angel
It's worth noting that I realize that there are several other things that could happen to cause problems but they are quite unlikely. Unfortunately it's impossible to be 100% foolproof, but the current version should take care of 99.9% of situations.
Edit: Damnit, forgot to update the file link in the OP. It's fixed now.
Edit2: Another update coming to cause a host file update of the hosts file contained in the program. That way, even if someone doesn't have an internet connection when this program runs, it still updates to the latest hosts file included with the program.
Re: Some of you guys might find this helpful
Posted: 24 Feb 2012, 12:39
by knorke
if exist hosts.txt (
existance of hosts.txt does not mean it is complete or even has content in it. For fun close the bat while wget is downloading (and pretend it was some error.)
Wget output might confuse some users though.
the idea of error codes is that you can ask people for the funny number and that helps
you to figure what failed.
I realize that there are several other things that could happen to cause problems
yes. but now I will only tell more if I get part of the money \o/
Re: Some of you guys might find this helpful
Posted: 24 Feb 2012, 12:48
by Forboding Angel
Haha, I am making no money off of this. Just wanted a useful tool for myself to use with customers. Figured others might benefit and realized that it was worth trying to spread the word around because this will help protect jackasses running IE6.
Program updated again. Now it will always update to the latest hosts file that it has access to.
And yes knorke, you are correct, I agree. But I simply can't manage every possible outcome.
A neat thing would be a hash comparison between the hosts file on the server and the downloaded hosts file, but all this for a 596 kb file is a bit much isnt it?
Re: Some of you guys might find this helpful
Posted: 25 Feb 2012, 12:42
by hoijui
learn to thread title, please!
Re: Some of you guys might find this helpful
Posted: 25 Feb 2012, 21:08
by dimm
I constantly use sites that depend on ads. Since i am not playing for their bandwidth i should probably let the get revenue somehow?
Where can i find my current hosts file?
wait
http://winhelp2002.mvps.org/hosts.htm#Note nvm 2nd question
then there is this:"If you are connected to the Internet using AOL, a custom dialer provided by your ISP, through a Local Area Network (LAN) connection or a remote proxy server these procedures (using a HOSTS file) may not be effective. Programs such as some "web accelerators" may no longer work if you overwrite the existing HOSTS file as these type programs add entries to the HOSTS file."
FFX has enough addons for this though the may slow down browsing.
Re: Some of you guys might find this helpful
Posted: 27 Feb 2012, 22:15
by Forboding Angel
if you're using firefox + adblock this is still useful. Why? Because adblock only blocks those servers when you are browsing with firefox. But what about other programs you have installed that rely on the IE renderer (like steam)?
However, this isn't really targeted at you. This is targeted mainly at users who don't really understand what a host file is and probably think that IE6 is still the greatest innovation mankind has ever conceived.
If you notice, I made this so that I could stick it on customer machines as well as my own family, because I get tired of fixing silly things. Let someone who's making 8 bucks an hour deal with virus and spyware. That isn't what I do. At least, not if I can help it.
Sorry, guys who know little more than how to install spybot and av programs, I honestly don't care if you lose money because of this. There are those of us who do real work and get tired of dealing with stupid shit.
Protect people from themselves. Also, while I highly discourage it, technically, you should be able to browse a porn site in IE with this and remain fairly safe (but don't try it, that is beyond a bad idea, there are many other code based exploits that could rape your computer 6 ways from sunday).