Closed abouillot closed 2 years ago
In the 2nd message, the EMMAttachRequest
is wrapped into an EMMSecProtNASMessage
(the NAS EMM security header). To select IEs inside the AttachRequest, you need to select them with the proper path, e.g.:
In [1]: m, e = parse_NAS_MO(b'\x17\x07"#\xcb\x05\x07A\x02\x0b\xf6\x02\xf8\x10\x80\x01\x01\x87Q:\x18\x07\xf0\xf0\xc0\xc0\x1d\x00\x10\x00\x16\x02\x07\xd0!\'\x10\x80\x00\x02\x00\x00\x01\x00\x00\x03\x00\x00\x
...: 05\x00\x00\x11\x00R\x02\xf8\x10\x00\x01\\\x08\x021\x04u\xf0>\x01\x90\x11\x03WX\xb2 \x0b`\x144\xe2\x91\x81\x00\x12>\x80!@\x08\x00\x02\x1f\x00\x04\x02`\x04]\x01\x03\xe0\xc1o\x04\xf0\x00\xf0\x00')
In [2]: m['EMMAttachRequest']['UENetCap']
Out[2]: <UENetCap : <L : 7><UENetCap : <EEA0 : 1><EEA1_128 : 1><EEA2_128 : 1><EEA3_128 : 1><EEA4 : 0><EEA5 : 0><EEA6 : 0><EEA7 : 0><EIA0 : 1><EIA1_128 : 1><EIA2_128 : 1><EIA3_128 : 1><EIA4 : 0><EIA5 : 0><EIA6 : 0><EIA7 : 0><UEA0 : 1><UEA1 : 1><UEA2 : 0><UEA3 : 0><UEA4 : 0><UEA5 : 0><UEA6 : 0><UEA7 : 0><UCS2 : 1><UIA1 : 1><UIA2 : 0><UIA3 : 0><UIA4 : 0><UIA5 : 0><UIA6 : 0><UIA7 : 0><ProSe_dd : 0><ProSe : 0><H245_ASH : 0><ACC_CSFB : 1><LPP : 1><LCS : 1><X1_SRVCC : 0><NF : 1><ePCO : 0><HC_CP_CIoT : 0><ERw_oPDN : 0><S1U_data : 0><UP_CIoT : 0><CP_CIoT : 0><ProSe_relay : 0><ProSe_dc : 0><spare : 0><spare : 0><spare : 0><spare : 1><spare : 0><spare : 0><spare : 0><MultiDRB : 0><spare [transparent] : 0x>>>
Thanks, well spotted. I'll addapt the decoding accordingly.
Hello,
I use pycrate to analysis cellular phone logs.
I get the hex input from the log file and parse with parse_NAS_MO method. The message is an Attach request
The parsing goes fine with the various messages from different phones. When using the show function the content of the NAS message is properly displayed in all cases so far, with the proper items.
However, when trying specific items in the message, from one model, I systematically get an error with one message complaining the UENetCap is missing, while it is visible when looking into the NAS message.
Here is the code to show the behavior, with the message from one model correctly handled and the other failing:
here is the error output: