The Following 7 Users Say Thank You to Vento For This Useful Post: | ||
|
2015-02-18
, 11:50
|
Posts: 334 |
Thanked: 616 times |
Joined on Sep 2010
|
#2
|
The Following User Says Thank You to Manatus For This Useful Post: | ||
|
2015-02-18
, 11:55
|
Posts: 178 |
Thanked: 91 times |
Joined on May 2011
@ Mira (Venice) - Italy
|
#3
|
First of all thanks for this.
It might be a good idea to evaluate the contents for anything else than lines with localhost addresses 127.0.0.1 and ::1. Otherwise you are trusting the provider of hosts.txt file that it does not contain any redirects to malicious proxy sites.
|
2015-02-18
, 12:31
|
Posts: 334 |
Thanked: 616 times |
Joined on Sep 2010
|
#4
|
Every reference to localhosts from that providere is replaced byt the original Jolla hosts settings (that why I use the file hosts.base).
The provider of that hosts file is really famous and everyone download the hosts file from him, but if anyone whuold like to check for malicious redirect fell fre to do it and report your progres here pls.
112.112.112.112 im.malicious.com localhost.localdomain localhost
112.112.112.112 im.malicious.com localhost.localdomain localhost #127.0.0.1
112.112.112.112 im.malicious.com #localhost.localdomain #localhost #127.0.0.1
|
2015-02-18
, 13:07
|
Posts: 334 |
Thanked: 616 times |
Joined on Sep 2010
|
#5
|
|
2015-02-18
, 14:14
|
Posts: 178 |
Thanked: 91 times |
Joined on May 2011
@ Mira (Venice) - Italy
|
#6
|
The Following User Says Thank You to Vento For This Useful Post: | ||
|
2015-02-18
, 14:15
|
Posts: 334 |
Thanked: 616 times |
Joined on Sep 2010
|
#7
|
127.0.0.1 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
127.0.0.1 localhost localhost.localdomain ::1 localhost6 localhost6.localdomain6 127.0.0.1 im.not.malicious 111.111.111.115 evil.com
127.0.0.1 localhost localhost.localdomain ::1 localhost6 localhost6.localdomain6
cat hosts.txt | grep -v ^# | grep -v localhost | cut -d "#" -f 1 >> /etc/hosts.tmp && cat /etc/hosts.base /etc/hosts.tmp >> /etc/hosts && rm /etc/hosts.tmp && sed 's/^ *//; s/ *$//; /$/d' /etc/hosts
|
2015-02-18
, 14:42
|
Posts: 334 |
Thanked: 616 times |
Joined on Sep 2010
|
#8
|
cat hosts.txt | grep -v ^# | cut -d "#" -f 1 | 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
cat hosts.txt | grep -v "#" | 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
|
2015-02-18
, 14:54
|
Posts: 178 |
Thanked: 91 times |
Joined on May 2011
@ Mira (Venice) - Italy
|
#9
|
With:
evil.com and now im.malicious.com from previous example still got through.Code:cat hosts.txt | grep -v ^# | cut -d "#" -f 1 | 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
But with:
it works. Since #-char has no purpose (except in malicious intent here), you can grep the lines with them all away.Code:cat hosts.txt | grep -v "#" | 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
|
2015-02-18
, 15:13
|
Posts: 334 |
Thanked: 616 times |
Joined on Sep 2010
|
#10
|
But in this way you delete every line that contains a comment or localhost, even if the word localhost is placed in the comment.
# [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
And maybe a look here shuld be useful too.
So first of all you need root acces, so type: devel-su
Backup your current hosts file with:
Now create a file (example: vi update-hosts) with these commands:
Make it executable, writable and readable only by root with:
To restore the original hosts file type:
You can test it by yourself on your Jolla with these sites:
1) http://ads-blocker.com/testing (partially works)
2) http://thepcspy.com/blockadblock/ (works!)
3) http://simple-adblock.com/faq/testing-your-adblocker/ (do not work)
Last edited by Vento; 2015-08-12 at 10:50. Reason: Script update