mobile_insight.monitor.dm_collector.dm_endec package

Submodules

Module contents

dm_endec A module that encodes or decodes DM packets.

Author: Jiayao Li

class mobile_insight.monitor.dm_collector.dm_endec.DMLogPacket(decoded_list)

Bases: object

DM log packet decoder.

A log packet contains a header that specifies the packet type and timestamp, and a payload field that store useful information of a phone. This class will decode both the header and payload fields.

This class depends on Wireshark to decode some 3GPP standardized messages.

classmethod _decode_msg(msg_type, b)

Decode standard message using WSDissector.

_init_called = False
classmethod _parse_internal_list(out_type, decoded_list)

Parse the internal list to create different types of output.

Parameters
  • out_type (string) – can be “dict”, “list”, “xml/dict” or “xml/list”

  • decoded_list (list) – output of dm_collector_c library

classmethod _parse_internal_list_dict(decoded_list)
classmethod _parse_internal_list_list(decoded_list)
classmethod _parse_internal_list_old(out_type, decoded_list)
classmethod _parse_internal_list_xml(tag_name, decoded_list)
classmethod _preparse_internal_list(decoded_list)
classmethod _search_result(result, target)
classmethod _wrap_decoded_xml(xmls)
Returns

an XML string that looks like:

<msg>

<packet>…</packet> <packet>…</packet> <packet>…</packet>

</msg>

decode()

Decode a DM log packet.

Returns

a Python dict object that looks like:

{

”type_id”: “LTE_RRC_OTA_Packet”, “timestamp”: datetime.datetime(……), “Pkt Version”: 2, “RRC Release Number”: 9, # other fields … “Msg”: “””

<msg>

<packet>…</packet> <packet>…</packet> <packet>…</packet>

</msg> “””,

}

Raises

FormatError – this message has an unknown type

decode_json()

Decode the message and convert to a standard JSON dictionary.

Returns

a string that contains the converted JSON document.

decode_xml()

Decode the message and convert to a standard XML document.

Returns

a string that contains the converted XML document.

get_type_id()
classmethod init(prefs)

Configure the DMLogPacket class with user preferences.

This method should be called before any actual decoding.

Parameters

prefs (dict) – a dict storing the preferences

exception mobile_insight.monitor.dm_collector.dm_endec.FormatError

Bases: RuntimeError

Error in decoding messages.

class mobile_insight.monitor.dm_collector.dm_endec.WSDissector

Bases: object

A wrapper class of the ws_dissector program, which calls libwireshark to dissect many types of messages, e.g. 3GPP standardized messages.

This wrapper communicates with the ws_dissector program using a trivial TLV-formatted protocol named AWW (Automator Wireshark Wrapper), through the standard input/output interfaces.

SUPPORTED_TYPES = {'LTE-NAS_EPS_PLAIN': 250, 'LTE-PDCP_DL_SRB': 300, 'LTE-PDCP_UL_SRB': 301, 'LTE-RRC_BCCH_DL_SCH': 203, 'LTE-RRC_BCCH_DL_SCH_NB': 208, 'LTE-RRC_DL_CCCH': 204, 'LTE-RRC_DL_CCCH_NB': 209, 'LTE-RRC_DL_DCCH': 201, 'LTE-RRC_DL_DCCH_NB': 206, 'LTE-RRC_PCCH': 200, 'LTE-RRC_UL_CCCH': 205, 'LTE-RRC_UL_CCCH_NB': 210, 'LTE-RRC_UL_DCCH': 202, 'LTE-RRC_UL_DCCH_NB': 207, 'NAS': 190, 'RRC_DL_BCCH_BCH': 104, 'RRC_DL_CCCH': 102, 'RRC_DL_DCCH': 103, 'RRC_DL_PCCH': 106, 'RRC_MIB': 150, 'RRC_SB1': 181, 'RRC_SIB1': 151, 'RRC_SIB11': 161, 'RRC_SIB12': 162, 'RRC_SIB19': 169, 'RRC_SIB2': 152, 'RRC_SIB3': 153, 'RRC_SIB5': 155, 'RRC_SIB7': 157, 'RRC_UL_CCCH': 100, 'RRC_UL_DCCH': 101, 'nas-5gs': 416, 'nr-rrc.bcch.bch': 402, 'nr-rrc.bcch.dl.sch': 403, 'nr-rrc.dl.ccch': 404, 'nr-rrc.dl.dcch': 405, 'nr-rrc.pcch': 406, 'nr-rrc.radio_bearer_conf': 415, 'nr-rrc.rrc_reconf': 410, 'nr-rrc.sbcch.sl.bch': 413, 'nr-rrc.scch': 414, 'nr-rrc.ue_mrdc_cap': 411, 'nr-rrc.ue_nr_cap': 412, 'nr-rrc.ue_radio_access_cap_info': 401, 'nr-rrc.ue_radio_paging_info': 400, 'nr-rrc.ul.ccch': 407, 'nr-rrc.ul.ccch1': 408, 'nr-rrc.ul.dcch': 409}
_init_proc_called = False
_proc = None
classmethod decode_msg(msg_type, b)

Decode a binary message of type msg_type.

Parameters
  • msg_type (string) – the type of the message to be decoded

  • b (string) – binary data to be decoded

Returns

an XML string

classmethod init_proc(executable_path, ws_library_path)

Launch the ws_dissector program. Must be called before any actual decoding, and should be called only once.

Parameters
  • executable_path (string or None) – path to ws_dissector. If set to None, uses the default path.

  • ws_library_path (string or None) – a directory that contains libwireshark. If set to None, uses the default path.