![]() |
Blocking ads on N9 (Custom hosts file HOW-TO)
MOD EDIT: One-liner to achieve the same from this post:
Code:
wget -O ~/hosts http://winhelp2002.mvps.org/hosts.txt && echo "127.0.0.1" $(uname -n) "localhost" > /etc/hosts && tr -d '\015' < ~/hosts >> /etc/hosts One of the first things I installed on my N900 was adblock. Then when I briefly moved to Android I rooted each and every one of those phones just to install adfree. Notice a trend? :p Thanks for all the replies below. Having tried Firefox (fennec), my opinion is that while it works, it is not ready for daily use on the N9. I feel the easiest way to block ads on the N9 is to implement a custom hosts file. It does not require flashing the open mode kernel, and it does survive reboots. This procedure also keeps the correct permissions and file type for the new hosts file (I just checked it on my N9) I posted the guide in a later post, but here it is again: _____________________________________________ I implemented an ad blocking hosts file. I've tested some of the sites I usually visit, and all the ads are gone. Here is a step by step guide how to do it easily. NOTE: This procedure ONLY works if you've rooted the N9 since you need terminal and root access to /etc. PC part: 1. Download the latest version of the hosts file TO YOUR PC from: There are a lot of other versions out there, but this one seems to be updated on a regular basis, the latest version is less than a month old. 2. Open the hosts file in Notepad++, or your favorite text editor. Make sure it is a pure text editor, as some will introduce formatting into the file and they will destroy the hosts file contents. 3. Replace the uncommented first line Quote:
Quote:
4. Save the new hosts file. 5. Connect the N9 to your PC via USB Mass Storage and copy the new hosts file to it. When you disconnect the N9, the file will be located in Quote:
6. Open Terminal and gain root access. The default password is rootme. Quote:
Quote:
Quote:
I am sure there are dozens of ways to accomplish this, and the commands I listed use hard paths. That's so it works no matter which folder the Terminal is opened in. |
Re: Blocking ads on N9?
You can add the adblock plugin using Firefox for harmattan.
That is the only way that we have for now afaik |
Re: Blocking ads on N9?
There was also a great /etc/hosts file that I got for my N900 somwhere on these forums a while back.
It basically took a HUGE list of some of the worst web page banner ad domains and equated them with 127.0.0.1. Worked like a charm on both my Linux desktop and my N900. Would be a good fit for any N9 owner looking to avoid ads since it would apply to all browsers on the phone and not just the buggy mobile Firefox. If you're interested and can't find it with the powersearch, let me know and I can extract it from my old phone when I get home. |
Re: Blocking ads on N9?
I investigated on this a while ago and editing hosts file would be my choice as well.
The thing is, that afaik AEGIS created a hash of that file so chances are when you modify it, AEGIS will block access to the system or so. Sorry, I'm not that firm in Harmattan yet, so forgive me if I may have used the wrong terms. |
Re: Blocking ads on N9?
Quote:
|
Re: Blocking ads on N9?
I got Firefox (fennec 11.0) up and running with adblock. The good news is adblock does its job. Firefox's tabs and menu system is similar to Dolphin HD on Android, so I am familiar with the interface and like it. Although since it's combined swype, it can make life a little difficult. Rendering is also very quick, at least on par with the stock browser.
The bad news is that the menu system is very sluggish. A tap anywhere takes far too long to register, the menus are inconsistent (some are white, others are gray), and the text does not reflow on zoom even if the option is enabled. It also crashed a couple of times. I am aware this is at best a beta version, so these kinds of issues are to be expected. But I think I'll stick with the stock browser for now. I will look into editing the hosts file, see if that gets me anywhere. If anyone is wondering where to get Firefox for the N9, here's my source: http://romaxa.info/fennec/ |
Re: Blocking ads on N9?
so cddiede...? did you try it?
<Rant> umm so i think one of the reasons android and ios have been a hit with the developers is that they can make money even offereing their apps for free by showing ads. since both google and apple have monetary interests in their ad services (they own them), they protect what i feel they believe is their "right." offcourse i completely disagree with their policy and thats the reason i have always stuck with Nokia because they dont own an advertising company and dont use their platforms as ad selling platforms, like google and apple. p.s. shouldnt someone sue apple for not allowing third parties to shows ads in ios apps. isnt that an antitrust issue? </Rant> |
Re: Blocking ads on N9?
Adblock? Seriously? That's what my grandma would use. The way any proficient user filters content on any system is with Privoxy. It's been in the Fremantle repos for ages, and I don't see why you couldn't build it for Harmattan if it hasn't been done already.
|
Re: Blocking ads on N9?
There is a more elegant solution -- and it almost, but not quite, works...
...unfortunately, to make it work, the abomination called Aegis must be purged from the system. In short: Netfilter (a ring 0 firewall so feature-rich, flexible, and efficient that even Cisco started using it for its ASA-55x0 firewall/vpn/security devices) is -installed -active -amenable to rule additions. Unfortunately it doesn't look like it can be used. Apparently it has been "handicapped" (crippled) so that one of its most basic targets: REJECT doesn't work -- cannot work, because the underlying kernel module was renamed and therefore isn't found when needed. It is not a kernel object, so cannot be loaded directly/manually. hard linking and soft linking don't work either (either because of aegis or losing kernel parameters). DROP apparently still works; but the solution really needs that icmp unreachable so the connection is closed immediately, rather than timing out. Of course, without aegis it would be quite trivial to fix the broken package and make it work. And as its built for efficiency, it us a much more sensible solution than AdBlock -- a) because it works for all browsers and b) because it probably consumes an order of magnitude fewer resources (if not less), especially since its already active. |
Re: Blocking ads on N9?
In fact, I've had enough.
I'm flashing to open mode. The hell with this. |
Re: Blocking ads on N9?
Quote:
http://talk.maemo.org/showthread.php?t=81579 Been tying to summarize most findings in the OP. Oh & you might want to wait till we get 1.2+ kernel source. It's been requested in that thread recently. That way you won't have to re-flash... Then again we could be waiting for several more weeks. |
Re: Blocking ads on N9?
This kind of suck if the userbase is going to be divided into two groups, one with open mode and another without. Hacks and application development for harmattan are done mostly by those who are ready to flash the phone daily and they will also get this open mode to simplify their works, this probably also mean that those without o-p are going to miss these hacks.
just my though on current development. |
Re: Blocking ads on N9?
Quote:
You also don't have to update the contents all the time, maybe once a year is enough. Remember to grep -v 127.0.0.1 /etc/hosts |less to check that there are no malicious proxy addresses amongst the blocked ones. Speaking of which I'm not sure this is enough if someone puts a malicious line like this in the hosts file: xxx.xxx.xxx.xxx mobile.bank.com 127.0.0.1 So grepping for your bank's name and your email address provider is adviced too. |
Re: Blocking ads on N9?
wow, i had no idea that aegis was so bad and that i have been fooled with that pretty terminal and SU. why Nokia? why.
Is there a thread that shows exactly how&what aegis does and control? why cant we circumvent it? is it because it keeps a md5 hash or something of certain files and directories. |
Re: Blocking ads on N9?
1 Attachment(s)
Quote:
|
Quote:
|
Re: Blocking ads on N9?
Quote:
In the beginning of the file I would replace the line 127.0.0.1 localhost with 127.0.0.1 RM696 localhost to be on the sure side. Not that I've tested one without; it would be hard to do that properly since any application may depend on resolving hostname through hosts file and you'd find out only when you met one. I've also tried one found here: http://winhelp2002.mvps.org/hosts.htm but it needs conversion with dos2unix command that can be found in either harmattan-dev or rzr repos (can't remember which). Also the file contains a lot of explanations about sites thus making it heavier to handle and checking it with plain grepping is more cumbersome. So it is faster to use one from android-land. WARNING: To plain Windows people out there: Do not use Windows Notepad to edit the file, and I wouldn't use Wordpad either even when the latter actually shows the lines properly; there is more to end of lines and newlines. http://en.wikipedia.org/wiki/Newline#Common_problems In Windows land Notepad++ should be safe, not that I've tested it lately. |
Re: Blocking ads on N9?
Quote:
http://www.developer.nokia.com/Commu...Platform_Guide http://harmattan-dev.nokia.com/docs/..._security.html Aegis does a lot of things, and not all of them are bad for users... Missing the hosts file from the aegis configuration sounds and most probably is insecure, but I think that Harmattan devs have done this on purpose as a small nod to users not afraid to tinker to allow adblocking. Just guessing here of course, but certainly there is no actual need for them to have it open as it contains only the "127.0.0.1 RM696 localhost" by default and it is unlikely that it would change in any future updates. |
Re: Blocking ads on N9?
Quote:
But I did manage to extract the big *** /etc/hosts file from my N900. If anyone wants to grab the spam domain portions off of it, here it is: http://www.besh.com/~chad/hosts |
Re: Blocking ads on N9?
About the host file: https://github.com/pbrisbin/scripts/...00/updatehosts
You can disable adds with CSS, but I donī know if the browser allows the user to apply custom cascading style sheets (donīt own a N9). |
Re: Blocking ads on N9?
So I finally cat'ed the spam domains from my old /etc/hosts file onto the end of the one in my N9 after removing the N900 specific line in the old file. Seems to be working without error at least as well as it did on the N900.
Already observed several blank banner ads, but that may be random as I haven't been observing for very long yet. |
Re: Blocking ads on N9?
so i does this by bluetoothing hosts file over to my n9. then i gains the devel-su on da terminal. then i moves the hosts file beamed over. mv \home\user\MyDocs\hosts \etc\. this gives me a warning about cant preserve ownership. also i renamed the original file but its not there no more, itsmusta not took.
my slashes maybe backward cuz my bluetooth keyboard is the one for sony playstation and its all jacked up! i think its working. what text editor should i use on the n9 to add the rm696 line? not vi please.:eek: |
Re: Blocking ads on N9?
Quote:
http://talk.maemo.org/showpost.php?p...2&postcount=11 Worthwhile skimming through the whole thing too.... |
Re: Blocking ads on N9?
Quote:
" Protects sensitive data with encryption and signing, by using a key derived from a hardware-protected device-specific secret." this makes it hard to circumvent too. looks like aegis is too serious of a protection mechanism. anyways i am happy that i can use a custom hosts file. you cant do that on Android without root. |
Re: Blocking ads on N9?
Hopefully Adblock will be supported in XUL mobile Firefox past version 12. But it's not yet clear. See this thread:
https://adblockplus.org/forum/viewtopic.php?f=1&t=9376 https://adblockplus.org/forum/viewto...=9376&start=15 |
Re: Blocking ads on N9?
Quote:
It is normal to see ownership preservation warnings when copying from FAT-filesystem (normal user storage area on N9) to linux filesystems (such as /etc has). Privileges should be in order automatically even when it complains a bit. 'ls -l /etc/hosts' should show: '-rw-r--r-- 1 root root' etc. If not, it can be fixed with 'chmod ugo+r /etc/hosts' and after that 'chmod u+w /etc/hosts' |
Re: Blocking ads on N9?
I implemented an ad blocking hosts file. I've tested some of the sites I usually visit, and all the ads are gone.
Here is a step by step guide how to do it easily. NOTE: This procedure ONLY works if you've rooted the N9 since you need terminal and root access to /etc. PC part: 1. Download the latest version of the hosts file TO YOUR PC from: There are a lot of other versions out there, but this one seems to be updated on a regular basis, the latest version is less than a month old. 2. Open the hosts file in Notepad++, or your favorite text editor. Make sure it is a pure text editor, as some will introduce formatting into the file and they will destroy the hosts file contents. 3. Replace the uncommented first line Quote:
Quote:
4. Save the new hosts file. 5. Connect the N9 to your PC via USB Mass Storage and copy the new hosts file to it. When you disconnect the N9, the file will be located in Quote:
6. Open Terminal and gain root access. The default password is rootme. Quote:
Quote:
Quote:
I am sure there are dozens of ways to accomplish this, and the commands I listed use hard paths. That's so it works no matter which folder the Terminal is opened in. |
Re: Blocking ads on N9 (Custom hosts file HOW-TO)
Great stuff, still works on PR1.3.
|
Re: Blocking ads on N9 (Custom hosts file HOW-TO)
This is fantastic. Every N9 owner should do this! Works with PR 1.3 and the file was updated October 2012, so it's VERY recent. Goodbye ads. Browser loads pages MUCH faster and uses less of your data plan.
|
Re: Blocking ads on N9 (Custom hosts file HOW-TO)
Easy mode As root, on device; Code:
wget -O ~/hosts http://www.mvps.org/winhelp2002/hosts.txt && echo "127.0.0.1 rm696 localhost" > /etc/hosts && tr -d '\015' < ~/hosts >> /etc/hosts ***this will wipe your hosts file, so if you have put anything custom in there, you will have to re-ad it. |
Re: Blocking ads on N9 (Custom hosts file HOW-TO)
Quote:
The download and transfer of file to /etc/hosts works but the $(cat /etc/hostname) didn't put RM696 into the hosts file... See: Code:
127.0.0.1 localhost Code:
:~# ls -al /etc/hostname I had deleted the same hosts file that I already had prior to your post so its a fresh test... Edit: Why not replace (cat /etc/hostname) with (uname -n)? Edit 2: Replacing with (uname -n) in your command didn't do the change too; will check and report... |
Re: Blocking ads on N9 (Custom hosts file HOW-TO)
fixed:
Code:
wget -O ~/hosts http://www.mvps.org/winhelp2002/hosts.txt && echo "127.0.0.1 RM696 localhost" > /etc/hosts && tr -d '\015' < ~/hosts >> /etc/hosts I cannot imagine why: Code:
echo "127.0.0.1" $(uname -n) "localhost" |
Re: Blocking ads on N9 (Custom hosts file HOW-TO)
Are you sure it works correctly with uname -n?
Doing: Code:
~# wget -O ~/hosts http://www.mvps.org/winhelp2002/hosts.txt && echo "127.0.0.1" $(uname -n) "localhost" > /etc/hosts && tr -d '\015' < ~/hosts >> /etc/hosts Edit: Would you know how to instead in the above commands replace the contents of line 23 with the echo command instead? Edit 2: Ah just realized my stupidness...The uname echo can remain as first line; it won't make any difference... |
This works like a charm to speed up the browser! Are there any new host files to update with?
|
Re: Blocking ads on N9 (Custom hosts file HOW-TO)
Quote:
Code:
wget -O ~/hosts http://winhelp2002.mvps.org/hosts.txt && echo "127.0.0.1" $(uname -n) "localhost" > /etc/hosts && tr -d '\015' < ~/hosts >> /etc/hosts E: If you just recently ran the one-liner then you are surely updated as the updates are just pushed to the same URL ;) |
Re: Blocking ads on N9 (Custom hosts file HOW-TO)
I guess that on N950 you need to replace RM696 with RM680, right?
|
Re: Blocking ads on N9 (Custom hosts file HOW-TO)
Quote:
|
Re: Blocking ads on N9 (Custom hosts file HOW-TO)
Quote:
the one liner should be put into the op. Or maybe a deb on apps for meego! :) |
Re: Blocking ads on N9 (Custom hosts file HOW-TO)
Quote:
|
Re: Blocking ads on N9 (Custom hosts file HOW-TO)
I have a strange issue with that.
I downloaded the ad-blocking hosts file from the link given and changed 127.0.0.1 localhost to 127.0.0.1 RM696 localhost manually with kate (I'm on Kubuntu). Then I transferred the new hosts file to my Downloads directory and replaced the original /etc/hosts (I made a copy before). Everything works fine except the fact that I am not able to access any website when I am in my wireless home network:eek: What is really strange about this issue that I got it working back again when I changed my hosts file back to the standard one. When I tried out the ad-blocking hosts file again it didn't work again for me. But now my old hosts file does not work too! Any tips? Edit: Well, obviously this could not be caused by the hosts file. there was some encryption error, I changed b&g to b and then to auto108mbps and now it is working again. Very strange. yesterday I downloaded some maps through my wifi...:confused: |
All times are GMT. The time now is 08:09. |
vBulletin® Version 3.8.8