PDU SMS Sender Number Extraction

You're working with raw GSM SIM filesystem data, and that looks like a raw PDU-encoded SMS message. Let's parse it and extract the sender's phone number.


πŸ” Step-by-step PDU Analysis:

PDU string:

0307913366003000F011000B9115132893723F0000AA205530306B58305977636A4E756379466A4A46387863313941647A4E7A4D47316C

The format for a PDU SMS typically is:

css

[SMSC info length][SMSC info][PDU type][TP-MR][TP-DA length][TP-DA (receiver)][TP-PID][TP-DCS][TP-SCTS][TP-UDL][TP-UD]

But in your case, the PDU starts with:

r

03 07 91 33 66 00 30 00 F0 11 00 0B 91 15 13 28 93 72 3F ...

We'll parse it accordingly.


πŸ”§ Breakdown of the important fields:

  • SMSC Length (in octets):
    03 β†’ means 3 bytes for SMSC info follow.

  • SMSC Info (3 bytes):
    07 91 33
    β†’ 07 = SMSC length again? Maybe an error or part of the SMSC. Let's treat it as:SMSC address:

  • 91 β†’ international format

  • 33 66 00 β†’ swapped semi-octets: 336600 β†’ becomes +336600 (or likely something wrong here – not critical now)

  • PDU Type (1 byte):
    30 β†’ typical SMS-DELIVER PDU

  • Message Reference (MR):
    00

  • Sender Address Length:
    0B = 11 digits

  • Sender Address Type-of-Address (TOA):
    91 β†’ international number

  • Sender Address Value:
    15 13 28 93 72 3F
    This is in semi-octet swapped format. We decode it:

  • 15 β†’ 51

  • 13 β†’ 31

  • 28 β†’ 82

  • 93 β†’ 39

  • 72 β†’ 27

  • 3F β†’ F3 β†’ drop the F Resulting digits: 51318239273
    With the + from 91, the sender's number is:


βœ… Sender Number: +51318239273


If you want a Python script to extract this kind of info automatically, let me know!