From b998dcb8c1e2d463d235f119761f8ca0f7a72740 Mon Sep 17 00:00:00 2001 From: Tyson Key Date: Sat, 1 Jan 2011 22:58:47 +0100 Subject: [PATCH] update sim dissector --- src/isi-sim.c | 245 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 237 insertions(+), 8 deletions(-) diff --git a/src/isi-sim.c b/src/isi-sim.c index 04adcae..d97e003 100644 --- a/src/isi-sim.c +++ b/src/isi-sim.c @@ -1,7 +1,7 @@ /* isi-simauth.c * Dissector for ISI's SIM resource - * Copyright 2010, Tyson Key * Copyright 2010, Sebastian Reichel + * Copyright 2010, Tyson Key * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -59,13 +59,90 @@ static const value_string isi_sim_service_type[] = { {0x00, NULL} }; - +static const value_string isi_sim_cause[] = { + {0x00, "SIM_SERV_NOT_AVAIL"}, + {0x01, "SIM_SERV_OK"}, + {0x02, "SIM_SERV_PIN_VERIFY_REQUIRED"}, + {0x03, "SIM_SERV_PIN_REQUIRED"}, + {0x04, "SIM_SERV_SIM_BLOCKED"}, + {0x05, "SIM_SERV_SIM_PERMANENTLY_BLOCKED"}, + {0x06, "SIM_SERV_SIM_DISCONNECTED"}, + {0x07, "SIM_SERV_SIM_REJECTED"}, + {0x08, "SIM_SERV_LOCK_ACTIVE"}, + {0x09, "SIM_SERV_AUTOLOCK_CLOSED"}, + {0x0A, "SIM_SERV_AUTOLOCK_ERROR"}, + {0x0B, "SIM_SERV_INIT_OK"}, + {0x0C, "SIM_SERV_INIT_NOT_OK"}, + {0x0D, "SIM_SERV_WRONG_OLD_PIN"}, + {0x0E, "SIM_SERV_PIN_DISABLED"}, + {0x0F, "SIM_SERV_COMMUNICATION_ERROR"}, + {0x10, "SIM_SERV_UPDATE_IMPOSSIBLE"}, + {0x11, "SIM_SERV_NO_SECRET_CODE_IN_SIM"}, + {0x12, "SIM_SERV_PIN_ENABLE_OK"}, + {0x13, "SIM_SERV_PIN_DISABLE_OK"}, + {0x15, "SIM_SERV_WRONG_UNBLOCKING_KEY"}, + {0x2E, "SIM_SERV_ILLEGAL_NUMBER"}, + {0x1C, "SIM_SERV_NOT_OK"}, + {0x1E, "SIM_SERV_PN_LIST_ENABLE_OK"}, + {0x1F, "SIM_SERV_PN_LIST_DISABLE_OK"}, + {0x20, "SIM_SERV_NO_PIN"}, + {0x21, "SIM_SERV_PIN_VERIFY_OK"}, + {0x22, "SIM_SERV_PIN_BLOCKED"}, + {0x23, "SIM_SERV_PIN_PERM_BLOCKED"}, + {0x24, "SIM_SERV_DATA_NOT_AVAIL"}, + {0x25, "SIM_SERV_IN_HOME_ZONE"}, + {0x27, "SIM_SERV_STATE_CHANGED"}, + {0x28, "SIM_SERV_INF_NBR_READ_OK"}, + {0x29, "SIM_SERV_INF_NBR_READ_NOT_OK"}, + {0x2A, "SIM_SERV_IMSI_EQUAL"}, + {0x2B, "SIM_SERV_IMSI_NOT_EQUAL"}, + {0x2C, "SIM_SERV_INVALID_LOCATION"}, + {0x35, "SIM_SERV_STA_SIM_REMOVED"}, + {0x36, "SIM_SERV_SECOND_SIM_REMOVED_CS"}, + {0x37, "SIM_SERV_CONNECTED_INDICATION_CS"}, + {0x38, "SIM_SERV_SECOND_SIM_CONNECTED_CS"}, + {0x39, "SIM_SERV_PIN_RIGHTS_LOST_IND_CS"}, + {0x3A, "SIM_SERV_PIN_RIGHTS_GRANTED_IND_CS"}, + {0x3B, "SIM_SERV_INIT_OK_CS"}, + {0x3C, "SIM_SERV_INIT_NOT_OK_CS"}, + {0x19, "SIM_FDN_ENABLED"}, + {0x1A, "SIM_FDN_DISABLED"}, + {0x45, "SIM_SERV_INVALID_FILE"}, + {0x4F, "SIM_SERV_DATA_AVAIL"}, + {0x49, "SIM_SERV_ICC_EQUAL"}, + {0x4A, "SIM_SERV_ICC_NOT_EQUAL"}, + {0x4B, "SIM_SERV_SIM_NOT_INITIALISED"}, + {0x50, "SIM_SERV_SERVICE_NOT_AVAIL"}, + {0x57, "SIM_SERV_FDN_STATUS_ERROR"}, + {0x58, "SIM_SERV_FDN_CHECK_PASSED"}, + {0x59, "SIM_SERV_FDN_CHECK_FAILED"}, + {0x5A, "SIM_SERV_FDN_CHECK_DISABLED"}, + {0x5B, "SIM_SERV_FDN_CHECK_NO_FDN_SIM"}, + {0x5C, "SIM_STA_ISIM_AVAILABLE_PIN_REQUIRED"}, + {0x5D, "SIM_STA_ISIM_AVAILABLE"}, + {0x5E, "SIM_STA_USIM_AVAILABLE"}, + {0x5F, "SIM_STA_SIM_AVAILABLE"}, + {0x60, "SIM_STA_ISIM_NOT_INITIALISED"}, + {0x61, "SIM_STA_IMS_READY"}, + {0x96, "SIM_STA_APP_DATA_READ_OK"}, + {0x97, "SIM_STA_APP_ACTIVATE_OK"}, + {0x98, "SIM_STA_APP_ACTIVATE_NOT_OK"}, + {0xF9, "SIM_SERV_NOT_DEFINED"}, + {0xFA, "SIM_SERV_NOSERVICE"}, + {0xFB, "SIM_SERV_NOTREADY"}, + {0xFC, "SIM_SERV_ERROR"}, + {0x30, "SIM_SERV_CIPHERING_INDICATOR_DISPLAY_REQUIRED"}, + {0x31, "SIM_SERV_CIPHERING_INDICATOR_DISPLAY_NOT_REQUIRED"}, + {0x4D, "SIM_SERV_FILE_NOT_AVAILABLE"} +}; static dissector_handle_t isi_sim_handle; static void dissect_isi_sim(tvbuff_t *tvb, packet_info *pinfo, proto_item *tree); static guint32 hf_isi_sim_message_id = -1; static guint32 hf_isi_sim_service_type = -1; +static guint32 hf_isi_sim_cause = -1; +static guint32 hf_isi_sim_secondary_cause = -1; void proto_reg_handoff_isi_sim(void) { static gboolean initialized=FALSE; @@ -81,7 +158,11 @@ void proto_register_isi_sim(void) { { &hf_isi_sim_message_id, { "Message ID", "isi.sim.msg_id", FT_UINT8, BASE_HEX, isi_sim_message_id, 0x0, "Message ID", HFILL }}, { &hf_isi_sim_service_type, - { "Service Type", "isi.sim.service_type", FT_UINT8, BASE_HEX, isi_sim_service_type, 0x0, "Service Type", HFILL }} + { "Service Type", "isi.sim.service_type", FT_UINT8, BASE_HEX, isi_sim_service_type, 0x0, "Service Type", HFILL }}, + { &hf_isi_sim_cause, + { "Cause", "isi.sim.cause", FT_UINT8, BASE_HEX, isi_sim_cause, 0x0, "Cause", HFILL }}, + { &hf_isi_sim_secondary_cause, + { "Secondary Cause", "isi.sim.secondary_cause", FT_UINT8, BASE_HEX, isi_sim_cause, 0x0, "Secondary Cause", HFILL }} }; @@ -102,19 +183,167 @@ static void dissect_isi_sim(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitr cmd = tvb_get_guint8(tvb, 0); switch(cmd) { - - case 0x1D: /* SIM_IMSI_REQ_READ_IMSI isi_sim_service_type */ + + case 0x19: /* SIM_NETWORK_INFO_REQ */ proto_tree_add_item(tree, hf_isi_sim_service_type, tvb, 1, 1, FALSE); code = tvb_get_guint8(tvb, 1); switch(code) { - case 0x2D: //READ_IMSI - col_set_str(pinfo->cinfo, COL_INFO, "Read IMSI"); + case 0x2F: + col_set_str(pinfo->cinfo, COL_INFO, "Network Information Request: Read Home PLMN"); break; default: - col_set_str(pinfo->cinfo, COL_INFO, "unknown SIM packet"); + col_set_str(pinfo->cinfo, COL_INFO, "Network Information Request"); break; } break; + + case 0x1A: /* SIM_NETWORK_INFO_RESP */ + proto_tree_add_item(tree, hf_isi_sim_service_type, tvb, 1, 1, FALSE); + code = tvb_get_guint8(tvb, 1); + switch(code) { + default: + col_set_str(pinfo->cinfo, COL_INFO, "Network Information Response"); + break; + } + break; + + case 0x1D: /* SIM_IMSI_REQ_READ_IMSI */ + proto_tree_add_item(tree, hf_isi_sim_service_type, tvb, 1, 1, FALSE); + code = tvb_get_guint8(tvb, 1); + switch(code) { + default: + col_set_str(pinfo->cinfo, COL_INFO, "Read IMSI Request"); + break; + } + break; + + case 0x1E: /* SIM_IMSI_RESP_READ_IMSI */ + proto_tree_add_item(tree, hf_isi_sim_service_type, tvb, 1, 1, FALSE); + code = tvb_get_guint8(tvb, 1); + switch(code) { + default: + col_set_str(pinfo->cinfo, COL_INFO, "Read IMSI Response"); + break; + } + break; + + case 0x21: /* SIM_SERV_PROV_NAME_REQ */ + proto_tree_add_item(tree, hf_isi_sim_service_type, tvb, 1, 1, FALSE); + code = tvb_get_guint8(tvb, 1); + switch(code) { + default: + col_set_str(pinfo->cinfo, COL_INFO, "Service Provider Name Request"); + break; + } + break; + + case 0x22: /* SIM_SERV_PROV_NAME_RESP */ + code = tvb_get_guint8(tvb, 1); + switch(code) { + default: + case 0x2c: + proto_tree_add_item(tree, hf_isi_sim_cause, tvb, 1, 1, FALSE); + proto_tree_add_item(tree, hf_isi_sim_secondary_cause, tvb, 2, 1, FALSE); + col_set_str(pinfo->cinfo, COL_INFO, "Service Provider Name Response: Invalid Location"); + break; + col_set_str(pinfo->cinfo, COL_INFO, "Service Provider Name Response"); + break; + } + break; + + case 0xBA: /* SIM_READ_FIELD_REQ */ + proto_tree_add_item(tree, hf_isi_sim_service_type, tvb, 1, 1, FALSE); + code = tvb_get_guint8(tvb, 1); + switch(code) { + case 0x66: + col_set_str(pinfo->cinfo, COL_INFO, "Read Field Request: Integrated Circuit Card Identification (ICCID)"); + break; + default: + col_set_str(pinfo->cinfo, COL_INFO, "Read Field Request"); + break; + } + break; + + case 0xBB: /* SIM_READ_FIELD_RESP */ + proto_tree_add_item(tree, hf_isi_sim_service_type, tvb, 1, 1, FALSE); + code = tvb_get_guint8(tvb, 1); + switch(code) { + case 0x66: + proto_tree_add_item(tree, hf_isi_sim_cause, tvb, 2, 1, FALSE); + col_set_str(pinfo->cinfo, COL_INFO, "Read Field Response: Integrated Circuit Card Identification (ICCID)"); + break; + default: + col_set_str(pinfo->cinfo, COL_INFO, "Read Field Response"); + break; + } + break; + + case 0xBC: /* SIM_SMS_REQ */ + proto_tree_add_item(tree, hf_isi_sim_service_type, tvb, 1, 1, FALSE); + code = tvb_get_guint8(tvb, 1); + switch(code) { + default: + col_set_str(pinfo->cinfo, COL_INFO, "SMS Request"); + break; + } + break; + + case 0xBD: /* SIM_SMS_RESP */ + proto_tree_add_item(tree, hf_isi_sim_service_type, tvb, 1, 1, FALSE); + code = tvb_get_guint8(tvb, 1); + switch(code) { + default: + col_set_str(pinfo->cinfo, COL_INFO, "SMS Response"); + break; + } + break; + + case 0xDC: /* SIM_PB_REQ_SIM_PB_READ */ + proto_tree_add_item(tree, hf_isi_sim_service_type, tvb, 1, 1, FALSE); + code = tvb_get_guint8(tvb, 1); + switch(code) { + default: + col_set_str(pinfo->cinfo, COL_INFO, "Phonebook Read Request"); + break; + } + break; + + case 0xDD: /* SIM_PB_RESP_SIM_PB_READ */ + proto_tree_add_item(tree, hf_isi_sim_service_type, tvb, 1, 1, FALSE); + code = tvb_get_guint8(tvb, 1); + switch(code) { + default: + col_set_str(pinfo->cinfo, COL_INFO, "Phonebook Read Response"); + break; + } + break; + + case 0xEF: /* SIM_IND */ + code = tvb_get_guint8(tvb, 1); + switch(code) { + default: + col_set_str(pinfo->cinfo, COL_INFO, "Indicator"); + break; + } + break; + + case 0xF0: /* SIM_COMMON_MESSAGE */ + proto_tree_add_item(tree, hf_isi_sim_cause, tvb, 1, 1, FALSE); + proto_tree_add_item(tree, hf_isi_sim_secondary_cause, tvb, 2, 1, FALSE); + code = tvb_get_guint8(tvb, 1); + switch(code) { + case 0x00: + col_set_str(pinfo->cinfo, COL_INFO, "Common Message: SIM Server Not Available"); + break; + case 0x12: + col_set_str(pinfo->cinfo, COL_INFO, "Common Message: PIN Enable OK"); + break; + default: + col_set_str(pinfo->cinfo, COL_INFO, "Common Message"); + break; + } + break; + default: col_set_str(pinfo->cinfo, COL_INFO, "Unknown type"); break;