SMS Decoding
Introduction
I first started to take a serious view at SMS 10 years ago when my team was tasked with delivering daily summary information via the use of iSMS long code SMS. This led me to stories of the silent SMS of 2010 and on how a complete movement profile can be built based on a well- crafted series of stealth pings. 👻😲
Anyway, keeping this simple and stupidly easy, this medium article is about using basic Python to decode SMS such as SMS metadata or information about the message [you will be able to attempt this with the actual payload itself if you lay hands on them], and how these can even be used for generating insights at work. GSM, SMSC and SMS operations are items that will not be covered here, and for demonstration purposes, we are using the encoded short codes rather than SMS payload (content). Imagine the magic that we can do with the actual payload?
***
So what can we do with this information?
> Banking X ISP/Telco Collaboration
If i am dealing with SME loans in business banking, is it possible for me to infer from SMS data which are the primary bank of my customers? And is there an opportunity for me to drive more CASA from them and make our bank as the customer’s primary bank instead?
For example, every month, this specific customer who applied for loan with us also transacts using Bank X. He received more than 30 count of SMS from this shortcode that provides 6 digit verification to customers of Bank X. Is this sufficient to infer that Bank X is his primary bank? 🤔
> ECommerce X Telco Collaboration. If you know how many times i logged in to Shopee web browser [6 digit code sent for authentication each time], will you sell me more Shopee vouchers/ rewards on Digi? 🤔
> EWallet X Telco Collaboration. Boost x Axiata can do magic for sure.👻
> Bitcoin X Telco Collaboration. Can Telco X start selling VPN solution to Binance customers? [SMS from Binance for login verification + knowing that Malaysian authorities is putting a block on direct access in the next XX days] Also, did they also sell VPNs when consumers are blocked from direct access to Pornhub in Malaysia few years ago? 🤔🤣
> ISP X ISP Competition. I dont think I need further elaboration 👻😛
ISP: Internet Service Provider; Telco: Telecommunications Company; SMS: Short Message Service
***
SMS Security?
SMS messaging is insecure, not encrypted and it’s much easier to view contents of messages, spoof and intercept our 2FA codes even by semi-skilled hackers like most of us. 🤓👻
***
Importance?
With the transition to 5G and movement to social media, will SMS still be important? The answer is likely Yes. because 🙂
[1] Even with 5G underway, support for SMS over 5G has already been documented in 3GPP 23.501
[2] Engagement numbers on SMS marketing. See it to believe it.
https://marketerhire.com/blog/sms-marketing-statistics
***
Numeral system basics
useful to represent and express numbers using digits or other symbols in a consistent manner
http://web.alfredstate.edu/faculty/weimandn/miscellaneous/ascii/ascii_index.html
***
Binary Example
For example, the binary, 0101 means 5, and can be decomposed as 0x2³ + 1x2² + 0x2¹ + 1x2⁰
***
Character Encoding
Good to understand some basic encoding standards such as UTF-8, ISO-8859–1 etc
http://www.steves-internet-guide.com/guide-data-character-encoding/
***
Decoding SMS
Sharing a few examples without without revealing details of which vendor and encoding standards, but rather this will focus on understanding how the decoding process works so we can leverage on fundamental Python to decode instead of packages
***
Basic Python
When do we use int(), bin(), hex()?
The codes should be self-explanatory. If not, feel free to ping me.
***
***
Decoding with Python
Example 1 & 2
***
Example 3
***
The Maths behind
Decoding payload works in the same way too with hand calculation. Except with Python, we are able to automate these with ease. 👻
Don’t be afraid if you are unable to find the right python packages online to support your task. Start from understanding the fundamental logic/ mathematics behind it and you will be fine when coding the solution from scratch. The codes will also be easier to maintain when they go into production. 😉
***
***
As always, ping me in case you need more information 👻
References:
https://www.3gpp.org/specifications
***