php - gammu check balance using getussd is encrypted -
i in developing message broadcast message.
have problem while check balance. , response :
service reply : "00500075006c007300610020003000200073002f006400200031004a 0075006e00310033002e0020004700610075006c002000420075006c0061006e0061006e00200031 002e003500470042002c005200700034003900720062002f0062006c006e002e0020004e00470045 0042005500540026004d0055005200410048000a00310020004d00610075000a003200200049006e 007400650072006e00650074002f00420042000a003300200050006b007400200053007500700065 0072002000480065006d00610074000a003400200050006b00740020004e0065006c0070006f006e 000a0035002000500072006f006d006f004b006f006e00740065006e000a00360020006d00500075 006c00730061000a00370020004d00790049006e0066006f000a"
how read(decrypt) it?
just had same problem. apparently these messages can pdu-encoded sms (texts).
but kind of jumps right ones eyes - it's 4 byte hex values (maybe unicode? maybe reading bytearray , decoding string may trick).
here's quick python 3 script:
reply = "00500075006c007300610020003000200073002f006400200031004a" \ "0075006e00310033002e0020004700610075006c002000420075006c0061006e0061006e00200031" \ "002e003500470042002c005200700034003900720062002f0062006c006e002e0020004e00470045" \ "0042005500540026004d0055005200410048000a00310020004d00610075000a003200200049006e" \ "007400650072006e00650074002f00420042000a003300200050006b007400200053007500700065" \ "0072002000480065006d00610074000a003400200050006b00740020004e0065006c0070006f006e" \ "000a0035002000500072006f006d006f004b006f006e00740065006e000a00360020006d00500075" \ "006c00730061000a00370020004d00790049006e0066006f000a" def chunks(l, n): """ yield successive n-sized chunks l. http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python """ in range(0, len(l), n): yield l[i:i+n] chunk in list(chunks(reply, 4)): print( chr( int( chunk[2:],16) ), end="" )
and output:
pulsa 0 s/d 1jun13. gaul bulanan 1.5gb,rp49rb/bln. ngebut&murah 1 mau 2 internet/bb 3 pkt super hemat 4 pkt nelpon 5 promokonten 6 mpulsa 7 myinfo
Comments
Post a Comment