Reply
Thread Tools
Posts: 178 | Thanked: 91 times | Joined on May 2011 @ Mira (Venice) - Italy
#11
the only way to be secure is to trust the provider then xD
 
Posts: 334 | Thanked: 616 times | Joined on Sep 2010
#12
No, after cutting out the comments behind #-characters you can freely grep away any lines containing anything else than 0.0.0.0.

Code:
cat hosts.txt | grep -v ^# | cut -d "#" -f 1 | grep 0.0.0.0 | grep -v localhost >> /etc/hosts.tmp && cat /etc/hosts.base /etc/hosts.tmp >> /etc/hosts && rm /etc/hosts.tmp && sed 's/^ *//; s/ *$//; /$/d' /etc/hosts
I tested with this hosts.txt:
Code:
0.0.0.0 im.not.malicious
112.112.112.112 im.malicious.com #localhost.localdomain #localhost #127.0.0.1
112.112.112.113 im.malicious.com localhost.localdomain localhost #127.0.0.1
111.111.111.114 colocalhosted #127.0.0.1 #colocalhosted
111.111.111.115 evil.com  #127.0.0.1
# [ZEDO]
0.0.0.0 zedo.com #[WebBug]
0.0.0.0 ads.zedo.com
0.0.0.0 c1.zedo.com
0.0.0.0 c2.zedo.com #[Tracking.Cookie]
0.0.0.0 c3.zedo.com
Which then resulted in as this hosts-file:
Code:
127.0.0.1 localhost localhost.localdomain
::1 localhost6 localhost6.localdomain6
0.0.0.0 im.not.malicious
0.0.0.0 zedo.com 
0.0.0.0 ads.zedo.com
0.0.0.0 c1.zedo.com
0.0.0.0 c2.zedo.com 
0.0.0.0 c3.zedo.com
 

The Following User Says Thank You to Manatus For This Useful Post:
Posts: 178 | Thanked: 91 times | Joined on May 2011 @ Mira (Venice) - Italy
#13
Originally Posted by Manatus View Post
No, after cutting out the comments behind #-characters you can freely grep away any lines containing anything else than 0.0.0.0.
...
Nice trick, I didn't think about it, updating first post right now (but with a shorter version ).

Last edited by Vento; 2015-02-18 at 20:32.
 

The Following User Says Thank You to Vento For This Useful Post:
Posts: 178 | Thanked: 91 times | Joined on May 2011 @ Mira (Venice) - Italy
#14
I know that this is an old thread and not a lot of ppl use this , btw I've only updated the main post: script improved and better guide.
 

The Following 4 Users Say Thank You to Vento For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 06:53.