Filtered blocking code from WhatsApp

Whatsapp's blocking code filtered

 

Someone commented on the blog some regular expression that was being used to block telegram on whatsapp’s APP:

 

“(\\W|\\b)telegram(\\.\\w+){1,2}\\z”.

So we wanted to probe that the blocking was not caused by a random glitch and there was an specific purpose of blocking Telegram links.

Firstly we downloaded the android APK directly from WhatsApp site: https://www.cdn.whatsapp.net/android/2.12.370/WhatsApp.apk

The code

The first surprise we noticed was that the apk is not obfuscated at all. So we used jadx to decompile it, and this is the result:

[Result of decompiling WhatsApp Version 2.12.370 (sha1: bf9c222b1acaa007d5e78a17ceace2bdd4d7d198) using jadx 0.6.0]

In the class LinkifyWeb.java we found the infamous regular expression:Whatsapp's blocking code filtered

This regular expression means: Look for “telegram” string not preceded by anything, or preceded by a word separator, or preceded by non-word-character, then followed by some kind of domain TLD.

And this is the code that calls the regular expression and blocks any telegram URL at Whatsapp APP:

Whatsapp's blocking code filtered

Every time someone sends an URL, this function analize it to see if the URL is a “badHost”.

So, this confirms that the blocking of telegram is not unintentional. It is crystal clear that WhatsApp targets Telegram and only Telegram specifically.

Bonus track: In their paranoia, whatsapp also blocked the domain telegram.com. That is not related with telegram.

Geeks Channel
Follow us on Telegram Geeks Channel.

forward

Daniel LaRusso

Daniel LaRusso

Engineer, developer, open source enthusiast, passionate for technology. Consultant and researcher in robotics and automation.

You may also like...

5 Responses

  1. Avatar regex_master says:

    On top of doing abusive practices, they are bad coders.

    [\W\b]telegram(?:\.\w+){1,2}\z

    is almost twice faster.

    • Avatar Jaimehrubiks says:

      I’m so bad with regex, but how not to trust someone with your name 😛

    • Avatar bad_wolf says:

      Twice faster for something that’s called very sporadically. Not really worth it and in particular NOT a good measure of their value as coders.

  1. 1 December, 2015

    […] Filtrado el código de Whatsapp que bloquea a Telegram [ENG] […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.