4

I have to implement something that filters websites on Android devices (adult websites etc) as a uni project, but unfortunately have very little knowledge in this subject... What are possible solutions here? I would be very grateful if someone could just point me in the right direction(s). Then I can investigate further. I just need a summary of all possible general principles that are applicable for this, I guess, and what would be easiest to implement maybe.

From my understanding, you can...

  • use a proxy server and do the filtering there
  • use iptables to block calls to some websites
  • somehow set dns to point to a custom dns server/ a dns server with a filter

I guess it would be easiest to implement it on client side (iptables maybe) but I at least really would like to know what possibilities exist.

Don Ho
  • 1,289
  • 10
  • 18

2 Answers2

0

Actually, it's going to be really hard to implement on the client side because in order to use something like iptable you're going to need to have root on the device. Android is made in such away that a regular old app cant interfere with low-level things like restricting website access. It's probably possible, but it's gonna be a real headache. I think the easiest thing for you to do is implement a custom DNS server actually and just filter all the requests from there.

Kurtis Nusbaum
  • 30,445
  • 13
  • 78
  • 102
  • thanks for you answer! its no problem to root the phone or even writing a custom rom to access these lowlevel features, the idea right now is to explore all possible solutions, evaluate them and then pick one that is doable. what i need to know is whether iptable is an appropriate means to filter urls for example. – Don Ho Nov 26 '11 at 16:20
  • Like I said, you can do it, but it'll be a lot less of a headache to just use the dns server. – Kurtis Nusbaum Nov 27 '11 at 02:05
0

The only idea comes to in my mind HostTable and DNS Server,

There are no content blocking controls built in to the browser itself, but with superuser permissions you can filter any url you want. This method means you have to know what urls you want to block, add them to the hosts table, then "install" the hosts table on your Android. Look at Android Using the Hosts Table

Also at these Google App Engine and this SO Question

Community
  • 1
  • 1
user370305
  • 108,599
  • 23
  • 164
  • 151
  • thanks for the response, it seems fairly easy, but unfortunately, it is not working... i modified my hosts file to block both "google.de" and "www.google.de" but it loads normally... could it be because browsers like the stock browser use a proxy server? but then, how does adfree work? – Don Ho Nov 27 '11 at 21:13
  • edit: apparently i didnt set up the hosts file correctly, as when i ping those websites, it is resolved to the correct ip address (and not 127.0.0.1 as i specified) – Don Ho Nov 27 '11 at 21:31
  • turns out it had something to do with the linebreak format of my hosts file... [this java program](http://mathdotrandom.blogspot.com/2010/12/block-ads-on-pc-android-with-uber-hosts.html) takes care of this very good. also, im accepting this answer. it seems that every measure, host table included, can be bypassed by using a proxy, unless you do something freaky like deep packet inspection. among all the possibilities i listed, host table seems to be the easiest to implement then... – Don Ho Nov 30 '11 at 16:08