Amidst the much awaited New Years Eve and the sound of ringing jingle bells, still hovering I am much excited to share my next Outreachy update.
So, in the last post I mentioned about what attracted me to contribute to Electronic Frontier Foundation in particular and how I landed up with this project.There were no technicalities therein but this post is intended for describing what my project exactly is and how far I have come by now.
It has taken exhaustive learning and surfing from my end to be in a situation apt for this write-up, so I will try to pour out as much as I can and I remember going down my memory lane (and my browser history :P) for past few weeks.
As a part of my internship, I am working on developing Privacy Badger for android devices.If you are pondering, what is Privacy Badger, there you go:
” Privacy Badger is a browser add-on that stops advertisers and other third-party trackers from secretly tracking where you go and what pages you look at on the web. If an advertiser seems to be tracking you across multiple websites without your permission, Privacy Badger automatically blocks that advertiser from loading any more content in your browser. To the advertiser, it’s like you suddenly disappeared.”
To learn more about it and check how it differs from other ad-blockers or what principles it runs on follow this link: Learn More
Essentially, privacy badger is available in form of browser plugins for Firefox and Chrome. We need to provide the same for mobiles too.
The question is how? We can make it happen in any of the three ways:
- Making a Firefox add on for Android.
- Standalone Android Browser App.
- To use a VPN connection in Android to regulate the traffic across the device.
following from discussion with my mentors.
Given the time, scalability ,resources and efficiency constraints, the best suited approach is the third one. So, I began learning about VPN and how can we make such connection on Android devices, in parallel checking out similar apps like Disconnect, AdBlock Browser, Ghostery etc.
We all have used VPN sometime or the other but when it comes to creating one programmatically you need to go to the core of what exactly constitutes it and how can you build one. Technically, VPN connects securely. It uses “tunneling protocols” ; it sets up tunnel between your system and server through all the routers going through, and encrypts all info going through the tunnel. If any hacker is trying to hack at any router, tunnel detects penetration, then the tunnel shuts down and new path gets created.
Android has classes such as VpnService that supports setting up of VPN connection. After trying out few toy examples I was ready to setup my VPN connection. While I was under the notion that VPN will essentially ensure users’ anonymity while surfing, the intended use was not that.
Further communication clarified this out as to what exactly we are looking for: “The idea is that we would run a vpn server locally on the phone to catch any traffic that is going out and look for domains that appear like they could be tracking and then keep a count of those domains and report them to the user in some sort of dashboard” as Cooper guided me.
The very idea of creating a server on android itself fascinated me 🙂 I read couple of blog posts later deliberating on how you can host your websites successfully on spare Android devices. I checked out and created a server on Android using nanohttpd yet another amazing open source project.
So I had my localhost running on Android. I setup a VPN connection to it but then what next? How to channelize all the outgoing traffic via it? This thing was getting app-specific, as in if I use a particular app and make requests via it, they may get directed to the vpn server and I can then do the intended traffic capturing or filtering, but I wanted to capture the entire outgoing traffic from my device.
After surfing and posting in related communities, I found some really good tools and ways to do that. Being stuck for sometime, meanwhile I tried out Charles Proxy and Firesheep, read more about cookie profiling and browser fingerprinting.
Then I decided why not try this by creating a proxy server on Android, so that all requests are first directed to this server, captured and then to the intended server (forward proxy). So I created a proxy server on Android using the inbuilt support for the same. Since, my android device was connected to Wi-Fi I added the manual proxy settings to it that directed all the requests to this server hosted on the device itself.
After failed attempts to establish the much needed connections and get the GET/POSTs requests captured , I was having a broad smile when it actually finally happened. Different issues come up while dealing HTTP and HTTPS requests respectively. I will be writing a detailed post on my technical blog explaining the major code snippets for the same.
I got a sneak peek into how WhatsApp uses sockets to communicate, while trying out all this.
As of now, I believe the last few days of year 2015 have been quite enthralling and engaging and the year is ending up with good hope to make things work next.
I will be trying out more possibilities and refine the present architecture, along with working on the app’s features and functionalities.
So, that was more or less the log of events at my end.
Oops, I just checked the post went long a bit, so since you have reached till here, I take the opportunity to wish you a very happy and prosperous New Year 2016 !
See you in next post soon!
Till then stay connected, happy hacking, have your favorite cuisine and if you are a fan of metal covers, do check out this guy: