FreeCalypso > hg > fc-sim-sniff
view sw/sniff-dec/hl_decode.c @ 58:95ed46b5f8f1 default tip
doc/Sniffing-hw-setup: mv-sniffer is here
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 04 Oct 2023 05:55:09 +0000 |
parents | eb4274e7f4da |
children |
line wrap: on
line source
/* * Here we implement higher-level decoding of INS codes and SELECT file IDs. */ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> static struct ins_code_tab { u_char ins_code; char *cmdname; } ins_code_table[] = { {0xA4, "SELECT"}, {0xF2, "STATUS"}, {0xB0, "READ BINARY"}, {0xD6, "UPDATE BINARY"}, {0xB2, "READ RECORD"}, {0xDC, "UPDATE RECORD"}, {0xA2, "SEEK"}, {0x32, "INCREASE"}, {0x20, "VERIFY PIN"}, {0x24, "CHANGE PIN"}, {0x26, "DISABLE PIN"}, {0x28, "ENABLE PIN"}, {0x2C, "UNBLOCK PIN"}, {0x04, "INVALIDATE"}, {0x44, "REHABILITATE"}, {0x88, "RUN GSM ALGO"}, {0xFA, "SLEEP"}, {0xC0, "GET RESPONSE"}, {0x10, "TERMINAL PROFILE"}, {0xC2, "ENVELOPE"}, {0x12, "FETCH"}, {0x14, "TERMINAL RESPONSE"}, /* table search terminator */ {0, 0} }; void decode_cmd_opcode(ins) u_char ins; { struct ins_code_tab *tp; for (tp = ins_code_table; tp->cmdname; tp++) if (tp->ins_code == ins) break; if (tp->cmdname) printf(" Command: %s\n", tp->cmdname); } static struct file_id_tab { u_short file_id; char *name; } file_id_table[] = { {0x2F00, "EF_DIR"}, {0x2FE2, "EF_ICCID"}, {0x3F00, "MF"}, {0x6F05, "EF_LP"}, {0x6F07, "EF_IMSI"}, {0x6F20, "EF_Kc"}, {0x6F30, "EF_PLMNsel"}, {0x6F31, "EF_HPLMN"}, {0x6F37, "EF_ACMmax"}, {0x6F38, "EF_SST"}, {0x6F39, "EF_ACM"}, {0x6F3A, "EF_ADN"}, {0x6F3B, "EF_FDN"}, {0x6F3C, "EF_SMS"}, {0x6F3D, "EF_CCP"}, {0x6F3E, "EF_GID1"}, {0x6F3F, "EF_GID2"}, {0x6F40, "EF_MSISDN"}, {0x6F41, "EF_PUCT"}, {0x6F42, "EF_SMSP"}, {0x6F43, "EF_SMSS"}, {0x6F44, "EF_LND"}, {0x6F45, "EF_CBMI"}, {0x6F46, "EF_SPN"}, {0x6F48, "EF_CBMID"}, {0x6F49, "EF_SDN"}, {0x6F4A, "EF_EXT1"}, {0x6F4B, "EF_EXT2"}, {0x6F4C, "EF_EXT3"}, {0x6F50, "EF_CBMIR"}, {0x6F52, "EF_KcGPRS"}, {0x6F53, "EF_LOCIGPRS"}, {0x6F54, "EF_SUME"}, {0x6F74, "EF_BCCH"}, {0x6F78, "EF_ACC"}, {0x6F7B, "EF_FPLMN"}, {0x6F7E, "EF_LOCI"}, {0x6FAD, "EF_AD"}, {0x6FAE, "EF_PHASE"}, {0x6FB7, "EF_ECC"}, {0x6FC5, "EF_PNN"}, {0x6FC6, "EF_OPL"}, {0x6FC7, "EF_MBDN"}, {0x6FC9, "EF_MBI"}, {0x6FCA, "EF_MWIS"}, {0x7F10, "DF_TELECOM"}, {0x7F20, "DF_GSM"}, {0x7F21, "DF_DCS1800"}, /* table search terminator */ {0, 0} }; void decode_file_id(file_id) unsigned file_id; { struct file_id_tab *tp; for (tp = file_id_table; tp->name; tp++) if (tp->file_id == file_id) break; if (tp->name) printf(" Matching SELECT: %s\n", tp->name); }