I need some pretty thorough guidance on a project I've been tasked with. I guess ideally I am looking for either a tutorial (or set of tutorials), or else a working, self-contained, open-source codebase for an Android app that can filter all incoming internet traffic on the Android device based on keywords.

In particular, the app will stop incoming HTTPS traffic for any given web request if the requested URL or webpage (not just the domain) has certain keywords in the HTML or the URL. If a request does not have the keywords, it will be allowed through and the device will function normally. If it is not an HTML or TXT request -- if there is no text to analyze except the URL -- then it will look for keywords in the full URL alone.

By self-contained, what I mean is that it should not require a remote proxy server or remote VPN.

I have searched Google for such a thing. I've searched in GitHub.

I've seen plenty of tutorials for setting up a local proxy or VPN... all point-and-click kinds of tutorials. I need something programmatic.

I've found libraries that supposedly allow you to set up a proxy from inside an Android app, but their documentation is too cryptic and there are no step-by-step examples for them, so I can never make them work.

I've found a few open-source apps that do some of this, but aren't quite what I'm looking for. Nothing that really does what I need it to. I've tried to alter the apps that I've found to turn them into what I want, but my knowledge is so limited and the missing pieces are always too numerous.

I've been working on this for months. Sad, I know.

Can anyone point me to a fairly thorough tutorial (or a set of tutorials) that will help me to build such an app? Or, can anyone point me to an existing open-source app like what I'm looking for? Or even something that comes pretty close?

FWIW, giving me broad advice like "you need to set up a local VPN and a local proxy, with a certificate, and then use the proxy to filter traffic" won't be of any help to me. I already know the broad outline of what I should probably do. I just can't figure out how to do it, and can't find any good resources for guidance! Which is why I'm here...

Thanks in advance!

  • 2
    Intercepting HTTPS traffic system wide is no longer possible on an unrooted Android since Android 6.
    – Robert
    Jan 13 at 20:32
  • @Robert By "intercepting" do you mean actually reading it, or do you mean even just passing it through a local proxy (without reading it)? And, either way, is that true even with a manually installed certificate?
    – gcdev
    Jan 13 at 21:21
  • Well I never did it, but if I should do that, I would use an out-of-android solution (a https eavesdropping transparent proxy installed in the router).
    – peterh
    Jan 13 at 21:43
  • 1
    While we might be able to help on the concept/idea for end-users, take note that app development is off-topic since Android Enthusiasts focuses on end-users or power-users (but not necessarily developers) solving their issues, so we won't and can't provide help on code (a directly runnable script is still okay, but code that needs to be compiled to make an Android app is not).
    – Andrew T.
    Jan 14 at 1:26
  • 1
    By "intercepting" I mean HTTPS decryption + reencryption because you were asking for searching for keywords. The main problem is that since Android 6 you need root permissions to install the root CA certificate of the used proxy. Installing the cert as user certificate has no effect as apps by default ignore user certificates.
    – Robert
    Jan 14 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.