pycrate icon indicating copy to clipboard operation
pycrate copied to clipboard

New msg object initialize with from_json, not all data is getting updated

Open vbipin opened this issue 1 year ago • 1 comments

When creating a new msg object and using from_json to fill the data, all of the json data is not getting updated. Is there an easy way to solve this. I am using the pycrate 0.7 and python 3.11

  1. Create a sample json text to use.
pdu = unhexlify( '074300035200c2' ) # EMM Attach Complete
m, e = parse_NAS_MT(pdu)
att_complete_json = m.to_json()
print( att_complete_json )
  1. I want to create a new message with this json
new_msg = EMMAttachComplete()
new_msg.from_json( att_complete_json )
print( new_msg.to_json() )

The new_msg json is different and also the new_msg.to_bytes()

print ( hexlify( new_msg.to_bytes() )) "07430003000000" this is different from the starting pdu.

vbipin avatar Jan 04 '24 10:01 vbipin

Thanks for bringing this issue. A new pycrate repository has been setup, including new fixes. This repo will keep being maintained : https://github.com/pycrate-org/pycrate. Please checkout the latest 0.7.1 version which provides extended JSON support for mobile NAS messages, what should fix your case (I hope).

mitshell avatar Mar 01 '24 09:03 mitshell