[FLASHABLE ZIP] /etc/hosts for adblocking NO APP REQUIRED! - Optimus One, P500, V General

this site here looks like a good, relatively recently updated (at least for now) source for a hosts file to block a TON of adservers.
Even though their target audience is micro$oft windoze users, the hosts file works just fine in linux (and, in Android!)
Blocking Unwanted Parasites with a Hosts File
About halfway down the page, they have a link labelled "To view the HOSTS file in plain text form."
Download it in a real browser, and adb push it to /system/etc/ on your phone after adb remount...
Or, transfer it to your sd card and overwrite your /system/etc/hosts with it using root explorer, or terminal emulator, or some such.
This /etc/hosts file redirects lots of ad site URLs to 127.0.0.1 (the local machine.)
Here, for the lazy (or not technically inclined,) is a flashable zip to use in your edify-scripting recovery (like relatively current editions of CWM) with the 7-23-2011 updated version of the hosts file downloadable from the page I linked above.
Since this is just the /etc/hosts file, there's no app to eat your precious /data partition space, or run in the background wasting RAM.
It's great in the browser. speeds up forum sites quite a bit, even if it's still missing a few of the ad sites that try to load before you get to see the posts you're after.
It also blocks at least some admob ads when I've tested it (haven't had any ads show up yet but I've only tested it out today.)
NOTE: even though the zip is supposed to be signed with a testkey, recovery won't flash it unless you turn off signature verification.
Better than having to manually copy the hosts file in terminal or ADB, though.
TESTED ONLY ON OPTIMUS V! may work on other phones... try it on something else if you dare.

I use an app called ad away. Which uses that site to download from. Ad Away also allows you to add your own locations so I added the list the firefox addon ad block plus uses.

Related

Discussion: Getting Adfree to work.

I would really like to do away with adds, and have been struggling with this. Here is what I have tried so far:
1. After a temp root I ran adfree, which claimed to be a success, but upon trying out the browser and various apps the ads remained.
2. Noting that after a run of adfree, it states that the DNS cache must be cleared, I opened a root terminal and entered clear dns. Upon opening an ad filled app, I was delighted to find the ads gone. Tempting fate, I opened the browser and found that any site containing ads would freeze, and not load (xda for example).
3. I thought that maybe clearing the dns was the issue, so I took the hosts file generated by adfree, placed it on my sd, and made a visionary.sh script in /data/local, which upon boot placed the host file in /system/etc. The script ran fine, all ads were gone in apps, but again, websites with ads would not load.
This is where I am stuck. Getting the host file in the correct directory upon boot is not a problem, but I cannot figure why blocking ads causes the websites to not load. Any input would be appreciated.
I have experienced something kinda similar, but not exactly. I didn't have any luck with the app. A long time ago when I was running 1.5 it worked but not anymore. I learned about replacing the file with a modified hosts file into /system/etc. The only time it worked is when there was full root and my file manager of choice, root explorer, was able to truely write in the system folder and others. I always had to reboot in order for it to take. Since we don't have full root, after reboot, the stock hosts file is restored. I'm sure you already know this by the sounds of it.
Full root should be uploaded by tonight, so I would just wait for that if I were you
Sent from my PG06100 using XDA App
Yeah, this thread should probably be closed, as I made it prior to tonights great news.
Per OP request, closed

[Q] How to use hosts file to block ads

Adfree seems to not working anymore and i saw you can redirect ads to pull up blank webpages and such but i am still confused on the whole process.
How do i correctly place a host file on my phone?
how do i add a specific address for ads to use?
ray5780 said:
Adfree seems to not working anymore and i saw you can redirect ads to pull up blank webpages and such but i am still confused on the whole process.
How do i correctly place a host file on my phone?
how do i add a specific address for ads to use?
Click to expand...
Click to collapse
Create a text file. Name it:
hosts
No extension.
Popoulate it like this:
127.0.0.0 www.someaddy.com
The first is the IP associated with the url that follows it. That specific IP refers to the localhost, or your phones IP. Thus preventing the add from showing up because the app thinks the add url is localhost.
Put the file on your sd card and use any file explorer to put it in: /etc
Set permissions as 644.
XDA thread is:
forum.xda-developers.com/showthread.php?t=509997
XDA Premium via GingerTh3ory
My host file if you wanted one to go off of https://gist.github.com/543651c8d3bb7992f2be
It's a compilation of various adhosts found from sites and ones I found on my own.
Some of them I got from here: http://pgl.yoyo.org/adservers
I use 0.0.0.0 instead of 127.0.0.1 because 0.0.0.0 is an invalid address and will kill ads faster instead of clogging up your loopback address and timing out. I used to use 127.0.0.1 but it isn't as fast if you try timing both.
Also, you can block ads the same way on linux PCs and osx (/etc/hosts) or on windows (/windows/system32/drivers/etc/hosts). Also works on linux based routers or aftermarket firmware, but it's a PITA to permanently on a router since it wipes /etc/host changes every reboot (but how many times do you reboot a router anyways). Doing it on a pc you no longer need adblock in your browser.
Also, if you copy over your existing list, you might want to change back the owner/group and permissions to what they were. The default owner/group is root and permissions were 644. You can do that via the command line (using chown/chgrp/chmod) or via something like root explorer.
yareally said:
I use 0.0.0.0 instead of 127.0.0.1 because 0.0.0.0 is an invalid address and will kill ads faster instead of clogging up your loopback address and timing out. I used to use 127.0.0.1 but it isn't as fast if you try timing both.
Click to expand...
Click to collapse
+1
Nice tip, I'll try it.
XDA Premium via GingerTh3ory
+1 very nice
Thanks for the tip
Thanks, alot + 1 for the both of you
I have a big list of hosts in the hosts file of /etc and I'm still getting ads now. Any advice?
Mustang302LX said:
I have a big list of hosts in the hosts file of /etc and I'm still getting ads now. Any advice?
Click to expand...
Click to collapse
which list? the one I gave that I use or yours?
it's the list of thousands and thousands from the adfree app. I'd think with the app being uninstalled the hosts file should still work. But I'll try your list now too.
So once I download the file I can just place it on my SD card and place it in the /etc folder replacing the current hosts file and all should be good?
Edit: I just did that and still have ads. *sigh* oh well I guess.
Might have to restart your phone. Generally you dont have to do something like that, but you might have to clear out your dns cache to have it work. You can test to see if it's working for sure by adding in your own made up host for something. For example, add the following to the host file:
74.125.225.80 my.test.url
then open up your web browser and type http://my.test.url
if it goes to google.com, your host file is blocking ads (74.125.225.80 is the url for google.com). Make sure the url is exactly like that, some browsers might want to attach .com or whatever to it.
EDIT: I also updated the list above too. https://gist.github.com/543651c8d3bb7992f2be
md5 sum: c5d52a08166ff912702414ce4188dab8
If I remember or someone reminds me, I'll push updates to it every now and then when I add to my list via git, since github is nice and lets you do that and continuously update the gist link.
Also if you're on windows and you copied that list there first, make sure you change the line endings to unix type. It wont work on your phone if you don't. Any decent editor will allow you to change it (something not notepad from microsoft). http://www.flos-freeware.ch/notepad2.html
I downloaded it to my mac to unzip the file. Then i placed it on my SD card and moved it to /etc overwriting the hosts file and changed the permissions. Have rebooted and all sorts of stuff. I didn't modify the file though on my mac though.
Mustang302LX said:
I downloaded it to my mac to unzip the file. Then i placed it on my SD card and moved it to /etc overwriting the hosts file and changed the permissions. Have rebooted and all sorts of stuff. I didn't modify the file though on my mac though.
Click to expand...
Click to collapse
Macs screw up line endings too with \r instead of \n. Might want to open it in a text editor that allows you to switch between line endings just to be sure. It might have overwrote them when downloading. The file size of it should be around ~607KB unzipped if it's correct. Something like textmate or maybe the built in text edit should have the ability http://macromates.com/
You can also doublecheck the file with md5sum. The unzipped file should be c5d52a08166ff912702414ce4188dab8
Had to come into work so no access to my computer till later tonight. I fixed my market issue by switching ROMs so I'll try this later. I originally downloaded the file to my phone but it was a zip file so I couldn't extract it. So I figured I'd extract on my computer and just transfer over but apparently that doesn't work lol. Thanks for putting up with my saeemingly idiodic questions!
No problem, lol. Just make sure the line endings are in unix (\n) format.
Added around 300 or so more adservers to the list just now.
https://gist.github.com/543651c8d3bb7992f2be
Anyone who finds anymore, feel free to post and I will add them
That list is more geared towards mobile, but I also have a more desktop geared list without the added mobile ad servers if anyone is interested.
I would imagine you started with or imported all the ones from MVPS.org? Considering it's probably the most common used hosts file resource on the interwebz although mainly for desktops.
http://winhelp2002.mvps.org/hosts.txt
Absolute_Zero said:
I would imagine you started with or imported all the ones from MVPS.org? Considering it's probably the most common used hosts file resource on the interwebz although mainly for desktops.
http://winhelp2002.mvps.org/hosts.txt
Click to expand...
Click to collapse
Not that particular site, but same concept. I used http://pgl.yoyo.org/adservers/ + ones ive added in the past 5 or so years. I'll do a sort -u on it and see if I have any missing though.
edit: that site seems to be having issues 503 error
My list for the desktop though:
https://gist.github.com/8b5325d5150977e28152
Added the list (removing any duplicates) given by absolute_zero from http://winhelp2002.mvps.org/hosts.txt
thanks!
https://gist.github.com/543651c8d3bb7992f2be (mobile host blocking)
https://gist.github.com/8b5325d5150977e28152 (desktop host blocking)
yareally said:
Added the list (removing any duplicates) given by absolute_zero from http://winhelp2002.mvps.org/hosts.txt
thanks!
https://gist.github.com/543651c8d3bb7992f2be (mobile host blocking)
https://gist.github.com/8b5325d5150977e28152 (desktop host blocking)
Click to expand...
Click to collapse
Thanks man. They should sticky this.
Sent from my HTC Thunderbolt
@yareally - Thanks for the kick ass host blocking, I have a question, How do I update host once a week. I mean, and I don't want copy and paste seems too much hassle for me.
Does the adfree app have ability add the url link to download from your website?

Block Ads

Hey guys I am sharing these host files to block ads
**Disclaimer**
**I Take NO Responsibility in bricking your device**
**If there is any connectivity problems, replace the old hosts file**
Needed:
Rooted Device
Root Explorer (Or another file manager that has /system/ directory access)
Attached hosts File
Installation
Step 1: Download and unpack hosts.zip.
Step 1: Copy the hosts file to /system/etc/.
Step 1: Reboot and enjoy.
What it does?
The Hosts file contains the mappings of IP addresses to host names. This file is loaded into memory at startup, then Android checks the Hosts file before it queries any DNS servers, which enables it to override addresses in the DNS. This prevents access to the listed sites by redirecting any connection attempts back to the local (your) phone. Another feature of the HOSTS file is its ability to block other apps from displaying ads .
Or you download/install "adfree" from the market.
hasjee said:
Or you download/install "adfree" from the market.
Click to expand...
Click to collapse
For me maybe it is better this way. 1 app less but the same thing, and im not depending of loosing adfree if i delete app.
Sent from my GT-I5800
alen1901 said:
For me maybe it is better this way. 1 app less but the same thing, and im not depending of loosing adfree if i delete app.
Sent from my GT-I5800
Click to expand...
Click to collapse
u can uninstall addfree right after you aply it
Yes you can remove adfree after placing the host files.
swapnilraj said:
Yes you can remove adfree after placing the host files.
Click to expand...
Click to collapse
Really? One time i tried that, but ads came back. Nevermind, i dont use it.
Sent from my GT-I5800
Thank you!! I've been looking for it for a long time!

[Q] ICS Hosts file doesn't work

Hello Everybody,
Last week i upgraded my SGS2 to 4.0.3, and i made a full reset, because some minor things did not work as expected. Now i got the stock firmware (I9100XXLPQ) with The CF root kernel (3.0.15-I9100XXLPQ-CL223505) on it.
Now my problem. AdFree does not work anymore. AdAway and manually copy the hosts file to /etc/ neither. Of course i rebooted my phone several times. hope i did not make any other noob mistake... I tried different hosts files, one of them worked as expected on my friends HTC Sensation.
Someone got any help for me? im freakin' out because of these advertisements^^
Wish you a nice day and thx 4 all helpful answers
ad free
Working for me on CM9.
You might need to check the settings in 'Superuser'.
install adfree back and do everything like instructed... and if it still doesnt work, try to check the hosts file size? if its WAY TOO SMALL then u did something wrong and Adfree didnt modify ur host file correctly
it still does not work maybe there are some local files that i have to delete? (like dns cache which clears by rebooting the phone)
Adfree doesn't seem to work on ICS. Try adaway.
Make a copy of the hosts file .
Open hosts file on phone with notepad delete all the data save and close .
Run one of the add apps and see what happens to the file .
jje
I deleted everything i "modded" with the hosts file, downloaded AdAway and now it seems to work. I think the hosts file from AdAway is very incomplete, but manually adding urls works now.
I couldnt figure out the problem. Maybe you just have to do it twice
Does anyone know how to get the advertisements urls from the apps? i want to block them manually.
thx 4 all the ansers.
I too noticed AdFree is not working on ICS, currently on the SG2 Epic 4G Touch FF18 update. Checked hosts file and it is updated with entries. I tested with manual entry and confirmed the hosts file works, but it seems like apps are bypassing it.
Control Test:
1. open www.purple.com (simple page that loads purple, handy for testing internet routing) - page loaded without issue
2. updated default hosts file with "127.0.0.1 www.purple.com"
3. open www.purple.com - receive "Webpage not available"
App Test:
1. Angry Birds in game ad still shows up
2. click ad, browser opens to "Webpage not available" - This proves hosts file is working, but because the ad still shows up in game is what makes me think apps are somehow bypassing hosts file...
I installed AdAway and when he created the hosts file can not and he said "lack of space on the partition!
Attempt to modify the hosts file in the preferences for target / data / data / hosts "
johnny8910 said:
Working for me on CM9.
You might need to check the settings in 'Superuser'.
Click to expand...
Click to collapse
Thanks.. I had to revoke the permissions from SuperUser and re-started Ad-away. The app asked for permission again and this time manage to write the host files

[Q] Android Stock Browser - help please!

Hi to all
My Streak 5 is running DSC ROM v1.1 and am using the included Android stock browser (v2.3.3).
When I try to view adfly web pages (eg *******/), I am not able to see them - I get the 'web page not available' error message.
What do I need to do to both view these kind of web pages and also for them to load properly in the Android browser? I can see the pages on any PC but have singularly failed to find a way via the browser on my phone
Many many thanks to anyone who can put me out my misery..
This may be due to the modified hosts file that is included with DSC. Look in /system/etc/ and find a file named hosts. Make a backup of it. Open the original in a text editor and remove everything but this line:
127.0.0.1 localhost
Leave a blank line at the end of the file, save and exit.
It may require a reboot to be effective. If it doesn't work, just revert to your backup.
lordmorphous said:
This may be due to the modified hosts file that is included with DSC. Look in /system/etc/ and find a file named hosts. Make a backup of it. Open the original in a text editor and remove everything but this line:
127.0.0.1 localhost
Leave a blank line at the end of the file, save and exit.
It may require a reboot to be effective. If it doesn't work, just revert to your backup.
Click to expand...
Click to collapse
Thanks very much for the quick reply - much appreciated. Your suggestion about the hosts file gave me a clue.
I have AdAway installed, which blocks ads (on both webpages and those sent/displayed by apps and games) by modifying the hosts file. I disabled AdAway and reverted to the DSC ROM hosts file - and I can now see adfly pages on the browser.
However, I still wish to block ads on web pages, while still being able to use adfly-type sites. I also don't want to lose the ability to block ads shown/sent by apps & games. Is there an alternative method to block these?
AdAway was extremely effective at doing its job and I'd be loath to lose that functionality. For example on my PC, I use Chrome with AdBlockPlus extension which allows me to see and navigate through adfly-type sites while not being subject to ads.
Any advice or suggestions would be gratefully received. Thanks again for your help.
Cheers
AdAway and other such programs only combine the lists of blocked sites compiled by well-known sites into a single HOSTS file. They currently cannot exclude specific sites. For that, you have to edit the file manually.
Continue using AdAway, but use a text editor afterward to manually update the HOSTS file to exclude the site you want to see.
Strephon Alkhalikoi said:
AdAway and other such programs only combine the lists of blocked sites compiled by well-known sites into a single HOSTS file. They currently cannot exclude specific sites. For that, you have to edit the file manually.
Continue using AdAway, but use a text editor afterward to manually update the HOSTS file to exclude the site you want to see.
Click to expand...
Click to collapse
Actually AdAway has a whitelist facility. I've added ******* to it but can still see all the ads, unlike when I use AdBlock Plus under Chrome on a PC. Guess that'll have to do, unless anyone knows of a more elegant solution..
Cheers
I've used AdAway for months now and didn't realize it had a whitelist. Good to know the feature exists, though I am unlikely EVER to use it.
lordmorphous said:
This may be due to the modified hosts file that is included with DSC. Look in /system/etc/ and find a file named hosts. Make a backup of it. Open the original in a text editor and remove everything but this line:
127.0.0.1 localhost
Leave a blank line at the end of the file, save and exit.
It may require a reboot to be effective. If it doesn't work, just revert to your backup.
Click to expand...
Click to collapse
thanks bro!!!
I stop using adaway due to this problem. SO many website can't be opened. MOdify the host file and now things work again or just click disable adaway and it will modify the host file for you
For the app, you might want to use lucky patcher to block the ads
lordmorphous said:
This may be due to the modified hosts file that is included with DSC. Look in /system/etc/ and find a file named hosts. Make a backup of it. Open the original in a text editor and remove everything but this line:
127.0.0.1 localhost
Leave a blank line at the end of the file, save and exit.
It may require a reboot to be effective. If it doesn't work, just revert to your backup.
Click to expand...
Click to collapse
Can't find system , can you be more specific , not able to find in file manager
pramodb said:
Can't find system , can you be more specific , not able to find in file manager
Click to expand...
Click to collapse
You need to be using a file manager that allows root functions, such as ES File Explorer, Root Explorer, etc. A non-root enabled file explorer won't allow you to see /system/
lordmorphous said:
You need to be using a file manager that allows root functions, such as ES File Explorer, Root Explorer, etc. A non-root enabled file explorer won't allow you to see /system/
Click to expand...
Click to collapse
Dude , I used es explorer and I'm still not able to find system
pramodb said:
Dude , I used es explorer and I'm still not able to find system
Click to expand...
Click to collapse
Did you enable the root explorer features of ES? I'm not sure where to go from here to help you. Finding /system/ is pretty basic stuff.
If you are familiar with using adb, you can use it to pull the file to your computer, edit it, and push it back into place. The command would be:
adb pull /system/etc/hosts
adb push hosts /system/etc/hosts
There are lots of guides available for using adb and it is a worthwhile tool to know and use.
I like Notepad ++ for editing files on my computer. It's free and simple to use.
I'm willing to help, but keep in mind that I no longer have this phone as I moved on to the S3 last July.
lordmorphous said:
Did you enable the root explorer features of ES? I'm not sure where to go from here to help you. Finding /system/ is pretty basic stuff.
If you are familiar with using adb, you can use it to pull the file to your computer, edit it, and push it back into place. The command would be:
adb pull /system/etc/hosts
adb push hosts /system/etc/hosts
There are lots of guides available for using adb and it is a worthwhile tool to know and use.
I like Notepad ++ for editing files on my computer. It's free and simple to use.
I'm willing to help, but keep in mind that I no longer have this phone as I moved on to the S3 last July.
Click to expand...
Click to collapse
Okay , got it but it is already in the way you said of should he , what do you suggest I do now
lordmorphous said:
Did you enable the root explorer features of ES? I'm not sure where to go from here to help you. Finding /system/ is pretty basic stuff.
If you are familiar with using adb, you can use it to pull the file to your computer, edit it, and push it back into place. The command would be:
adb pull /system/etc/hosts
adb push hosts /system/etc/hosts
There are lots of guides available for using adb and it is a worthwhile tool to know and use.
I like Notepad ++ for editing files on my computer. It's free and simple to use.
I'm willing to help, but keep in mind that I no longer have this phone as I moved on to the S3 last July.
Click to expand...
Click to collapse
Okay , I got it and its in the way you said it should be , so any suggestions. And BTW I'm using gt-p5100 on job 4.2.2 via CyanogenMod
Well, that ruled out the hosts file. I'm stumped now. If I think of something I'll post it.
lordmorphous said:
Well, that ruled out the hosts file. I'm stumped now. If I think of something I'll post it.
Click to expand...
Click to collapse
Hi
I had the same problem like others had so what i did , i just move the host file from system/etc to just system , now i can open adf and other sites but now i can see ads running in my apps and games . Now i want to manually edit the hosts file so that the ads won't run in apps & games but it won't block adf . So can u tell me which data to remove from the host file ??
Okay i just remove the adf (dot)ly and cdn(dot)adf(dot)ly from the hosts and now i can open adf and also no ads in the apps or games.
But has problem with the linkbucks , still can't open it and can't find it in the hosts also
easy video tutorial made by me
https://www.youtube.com/watch?v=Kaochdv3cbs
Hi
hi
after doing that i have this error
unable to connect proxy server
how to fix this?

Categories

Resources