Block URLs on phone using AdAway
Using AdAway on your Android phones it is very easy to block a set of URLs.
AdAway (available from F-Droid, source from GitHub) is an ad-blocker. The application basically maintains a list of resources containing lists to ad-servers, see figure for example, e.g.:
# dest ip url
127.0.0.1 some.ad.server.com
This entry will redirect all traffic meant for some.ad.server.com
to the server 127.0.0.1
, which is your localhost. Entries from different resources are merged. Thus, all requests to typical ad-servers will fail → annoying advertisements won’t be delivered. It’s quite powerful and gives impressive results.
However, I didn’t want to talk about ad-stuff. The cool thing is
AdAway allows for extensions with own hosts files!
You can simply add another link to a file containing further host entries. I created my own AdAway file, uploaded it to https://stuff.lesscomplex.org/adaway.txt and added it to AdAway, as you can see in the figure. The current version contains a few entries for:
- facebook/yahoo/etc: I’m not using facebook or stuff, all these request shouldn’t leave my phone
- captive portal detection: To detect captive portals the phone downloads a few bytes from a google server and checks if it is able to access the real internet or just a captive portal
- swift key: I’m using swift key, but do not want it to communicate to the internet. Thus, I’m blocking a few URLs that swiftkey wants to talk to. As I’m already using a firewall this just adds another layer of privacy.
Feel free to use my “extension”, but I expect it to change over time. :)
Shortcomings
This method only works if applications load contents from URLs. As soon as the IPs are hard-coded the hosts file
- phone (6) ,
- media (61) ,
- android (6) ,
- trick (61) ,
- censor (1) ,
- network (81) ,
- privacy (5) ,
- lineageos (5)
Leave a comment
There are multiple options to leave a comment: