*gs dZddlZddlmZmZddlmZddlmZ ddlTddl Tddl Tddl Tddl mZmZmZmZmZmZmZddlmZmZddlTdd lmZmZmZmZdd lmZid d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,id-d.d/d0d1dd2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMidNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxZ Gdydze!Z"Gd{d|e#Z$Gd}d~e#Z%Gdde#Z&Gdde#Z'Gdde(Z)Gdde#Z*Gdde#Z+Gdde#Z,Gdde-Z.Gdde/Z0Gdde(Z1Gdde/Z2Gdde(Z3Gdde(Z4Gdde(Z5Gdde/Z6Gdde(Z7Gdde(Z8Gdde(Z9Gdde/Z:Gdde(Z;Gdde(Z<Gdde(Z=Gdde6Z>Gdde/Z?Gdde/Z@Gdde(ZAGdde/ZBGdde#ZCGdde(ZDGdde(ZEGdde/ZFGdde/ZGGdde(ZHGdde#ZIGdde#ZJGdÄde#ZKGdńde#ZLGdDŽde#ZMGdɄde(ZNGd˄de#ZOGd̈́dePdϬЦZQGdфde(ZRGdӄde#ZSGdՄde(ZTGdׄde(ZUGdلde/ZVGdۄde-ZWGd݄deZXGd߄deZYdS)a Various constants from ETSI TS 151.011 + Representation of the GSM SIM/USIM/ISIM filesystem hierarchy. The File (and its derived classes) uses the classes of pySim.filesystem in order to describe the files specified in the relevant ETSI + 3GPP specifications. N)packunpack)Tuple)Optional)*) dec_iccid enc_icciddec_imsienc_imsidec_plmnenc_plmndec_xplmn_w_act) CardProfileCardProfileAddon) DF_PHONEBOOK DF_MULTIMEDIADF_MCSDF_V2X) AddonGSMRzCHV1 disable functionz"Abbreviated Dialling Numbers (ADN)zFixed Dialling Numbers (FDN)zShort Message Storage (SMS)zAdvice of Charge (AoC)z)Capability Configuration Parameters (CCP) PLMN selectorRFU MSISDN Extension1 Extension2 zSMS Parameters zLast Number Dialled (LND)z!Cell Broadcast Message IdentifierGroup Identifier Level 1Group Identifier Level 2Service Provider NamezService Dialling Numbers (SDN) Extension3z/VGCS Group Identifier List (EFVGCS and EFVGCSS)z,VBS Group Identifier List (EFVBS and EFVBSS)z7enhanced Multi-Level Precedence and Pre-emption ServicezAutomatic Answer for eMLPPzData download via SMS-CBzData download via SMS-PPzMenu selectionz Call controlz Proactive SIMz(Cell Broadcast Message Identifier RangeszBarred Dialling Numbers (BDN) Extension4!zDe-personalization Control Keys"Co-operative Network List#zShort Message Status Reports$z*Network's indication of alerting in the MS%z.Mobile Originated Short Message control by SIM&GPRS'z Image (IMG)(z%SoLSA (Support of Local Service Area))z1USSD string data object supported in Call Control*zRUN AT COMMAND command+4User controlled PLMN Selector with Access Technology,8Operator controlled PLMN Selector with Access Technology-%HPLMN Selector with Access Technology.CPBCCH Information/zInvestigation Scan0,Extended Capability Configuration Parameters1MExE2zReserved and shall be ignored3PLMN Network NameOperator PLMN ListMailbox Dialling Numbers!Message Waiting Indication Status!Call Forwarding Indication Status$Service Provider Display Informationz"Multimedia Messaging Service (MMS)z Extension 8 MMS User Connectivity Parameters)456789:;ceZdZdZdZdZdS)ExtendedBcdAdapterz7Replace some hex-characters with other ASCII charactersct|ts|S|ddddS)Narb#) isinstancestrlowerreplaceselfobjcontextpaths =/home/jenkins/workspace/simtester-sanitize/pySim/ts_51_011.py_decodezExtendedBcdAdapter._decodezsG#s## Jyy{{""3s++33C<<<ct|ts|S|ddddS)Nrrmrorn)rprqrsrts ry_encodezExtendedBcdAdapter._encodes=#s## J{{3s##++C444r{N)__name__ __module__ __qualname____doc__rzr}r{ryrkrkvs8AA=== 55555r{rkc `eZdZddddddddd d d fd d d dddddd d d fgZdZdfd ZxZS)EF_ADN<42204841203120536963FFFFFFFFFFFF06810628560810FFFFFFFFFFFFFFz B HA 1 SicrTunknown isdn_e164exttype_of_numbernumbering_plan_id 6082658001)alpha_id len_of_bcdton_npi dialing_nr cap_conf_idext1_record_id<4B756E64656E626574726575756E67FF0791947112122721ffffffffffffKundenbetreuungr international 4917212172126f3aNEF.ADNAbbreviated Dialing Numbersrc tj|f|||dd|d|z}tdtt t t tjj dz z dtz dtz dttt t d z d tz |tz |_dS) N)r(r<sfidnamedescrec_lenext%u_record_idrr(rrrr"r)super__init__Struct COptionalGsmOrUcs2AdapterRpadBytesthis_ total_lenInt8ubTonNpirk BcdAdapter _construct rufidrrrrkwargsext_name __class__s ryrzEF_ADN.__init__sZ4dxZZSYZZZ$s* I6FtERVRXRbceReLfLfGgGg6h6h,i,i!i!-f!4!*6!1!-.@DQVWYQZQZOOA\A\.].]!]!.v!5!)& 22r{)rNrrrr~rr_test_de_encode _test_no_padr __classcell__rs@ryrrsL(tGPGRGUGUC3II J M,ARVKZ`kKmKm,CSVXX Z  OL2222222222r{rc&eZdZdfd ZdZxZS)EF_SMS6f3cNEF.SMSShort messagesc Ftj|f|||dd|dS)N)rrrrrurrrrrrs ryrzEF_SMS.__init__s4\4dz\\U[\\\\\r{c |d}||d}|dd}|d|dt|dS)Nc|dzdkrdS|dzdkrdS|dzdkrdS|dzdkrdS|d zd krd S|d zd krd S|d zdkrdS|d zdkrdSdS)Nrr)N free_spacer)mt message_readr)rmessage_to_be_read)momessage_to_be_sentr=r)rsent_status_not_requestedr')r sent_status_req_but_not_receivedr3)r"sent_status_req_rx_not_stored_smsrr;)rsent_status_req_rx_stored_smsr)Nrfur)statuss ry decode_statusz0EF_SMS._decode_record_bin..decode_statuss}$$++$$&&--$$&&33$$&&33$$&&::$$&&AA$$&&CC$$&&??$}r{rr) directionr remainderb2h)ru raw_bin_datarrrrs ry_decode_record_binzEF_SMS._decode_record_binsR % % %(|A// $ #AY&)#i..YYYr{)rNrr)r~rrrrrrs@ryrrsY]]]]]]ZZZZZZZr{rc eZdZddddddddd fd d d dd dddd fgZddgdifdddifgZdZdfd Zddededede ffd Z xZ S) EF_MSISDNDffffffffffffffffffffffffffffffffffffffff04b12143f5ffffffffffffffffffrTnetwork_specificrr12345frrrrD456967656e65205275666e756d6d6572ffffffff0891947172199181f3ffffffffffzEigene Rufnummerrr4917279119183fDffffffffffffffffffffffffffffffffffffffff05b1716662f6ffffffffffffffffmsisdn)rr1766266Dffffffffffffffffffffffffffffffffffffffff06b121436587f9ffffffffffffff 1234567896f40N EF.MSISDNr!c tj|f|||ddd|tdtt t t tjj dz z dtz dtz dttt t d z td d |_dS) N)r)rAT)rrrrleftpadrr(rrrr"rpattern)rrrrrrrrrrrrrkrPaddingrrs ryrzEF_MSISDN.__init__sh4dxY]hhaghhh I6FtERVRXRbceReLfLfGgGg6h6h,i,i!i!-f!4!*6!1!-.@DQVWYQZQZOOA\A\.].]!]")!W"="="= ??r{ abstract_data record_nrrreturncpd|vr|d}t|tkrd}d}|t|dzdzz}n4|d}|d}|dt|ddzdzz}dt|dzdzd ||d |d }t|||S) NrrrrfrrrTrr)typerqlenrencode_record_hex) rurrrrnpitonrrs ryrzEF_MSISDN.encode_record_hexs } $ $"8,FF||s""!(#c&kkAo&;; QiQi#AYVAY!);c)AA *,,/ OOq,@1,D26=@@C*E*E-7 88M ww(( 9MMMr{)rNrr!N) r~rrr _test_encoderrdictintrqrrrs@ryrrs. P1YkOZ:\:\# % % & Q+1QUix_jJlJl+ - - . O Q ))) * , P { # %LL??????NNtNNPSN_bNNNNNNNNNNr{rc eZdZdddddddddddddd d dddddd d d d d d fgZdZGddeZdfd ZxZS)EF_SMSPX454e6574776f726b73fffffffffffffff1ffffffffffffffffffffffffffffffffffffffffffffffff0000a7 ENetworksFT tp_dest_addr tp_sc_addrtp_pidtp_dcstp_vprreserved_for_extensionrr)lengthr call_number00)rparameter_indicatorsrrrr tp_vp_minutesceZdZdZdZdS)EF_SMSP.ValidityPeriodAdapterc|dkr|dzS|dkr d|dz dzzS|dkr|dz dzS|d kr|d z d zSt) Nrr<r r`' ValueErrorrts ryrzz%EF_SMSP.ValidityPeriodAdapter._decodeshczzU{"39"233c g..c k22  r{c|dkr|dz dz S|dkr d|dz dzzS|dkrd|dz zS|d krd |d zzSt) Nrrrr rr<iri rrrrts ryr}z%EF_SMSP.ValidityPeriodAdapter._encode sre||1uqy sg2566 $$cWo..(((ck233  r{Nr~rrrzr}rr{ryValidityPeriodAdapterrs2 ! ! ! ! ! ! ! !r{r6f42NEF.SMSP Short message service parametersc tj|f|||dd|tdtz dtz dt t tdz }tdttt ttj j dz z d tttd d d d dz d|z d|z dt!td z dt!td z dt"tz |_dS)N)r:Nrrrrr"rr:r rrrrrrrrrrr )rrrrrrrrrGsmStringAdapterrrr InvertAdapter FlagsEnumByte HexAdapterrrr)rurrrrrScAddrrs ryrzEF_SMSP.__init__sF\4dz\\U[\\\6)9=TXY^_aYbYbTcTcIdId;dee I6FtERVRXRbceReLfLfGgGg6h6h,i,i!i!7 iPTcdqrWXabjkGmGmGm9n9n"n!/!6!-f!4!)*U1XX*>*>!>!)*U1XX*>*>!>!01N1Nt1T1T!TVVr{)rNrr) r~rr _test_decoderAdapterrrrrs@ryrrs e#udhIMY]hl>o>o(+YqOg9j9j-/22'*tWoMe7h7h+-00dT D D F LL!!!!!!!!0 V V V V V V V V V Vr{rc<eZdZGddeZd fd ZxZS) EF_SMSSceZdZdZdZdS)EF_SMSS.MemCapAdapterc|dzrdndS)NrFTrrts ryrzzEF_SMSS.MemCapAdapter._decode(s!G-55 -r{c|rdndS)Nrrrrts ryr}zEF_SMSS.MemCapAdapter._encode+s?11 "r{Nrrr{ry MemCapAdapterr+'s2 . . . # # # # #r{r.6f43NEF.SMSS SMS statusrrc tj|f||||d|tdtz d|tz |_dS)Nrrrsizelast_used_tpmrmemory_capacity_exceeded)rrrrr.rrurrrrr5rrs ryrzEF_SMSS.__init__.scS4dDSSFSSS V #%?@R@RSY@Z@Z%Z\\r{)r/Nr0r1r2)r~rrr'r.rrrs@ryr)r)&sq########\\\\\\\\\\r{r)c eZdZdfd ZxZS)EF_SMSR6f47NEF.SMSRSMS status reportsr<r<c tj|f||||d|tdtz dt t dz |_dS)Nr sms_record_idsms_status_reportr;rrrrr$rrrurrrrrrrs ryrzEF_SMSR.__init__5scY4dwYYRXYYY F "$7 5998M8M$MOOr{)r;Nr<r=r>r~rrrrrs@ryr:r:4sGOOOOOOOOOOr{r:c eZdZdfd ZxZS)EF_EXTNEF.EXT Extensionr'r'c tjd|||||d|tdtz dt t dz dtz |_dS)N)rrrrr record_typeextension_datar$ identifierrrBrCs ryrzEF_EXT.__init__<sk]St$T7]]V\]]] & "2:eBii3H3H"H,W]J]__r{)NrGrHrIrDrs@ryrFrF;sG__________r{rFc$eZdZ dfd ZxZS)EF_CMI6f58NEF.CMIrr3Comparison Method Informationc tj|f||||d|tdtt t t jjdz z dtz |_ dS)Nrrrcomparison_method_id) rrrr rrrrrrrrurrrrrrrs ryrzEF_CMI.__init__CsyY4dwYYRXYYY 'U463CA3E-F-F(G(GHH HJ`agJgiir{)rPNrQrRrSrDrs@ryrOrOBsMEL5iiiiiiiiiir{rOc eZdZdfd ZxZS) DF_TELECOM7f10 DF.TELECOMNc tjd(|||d|ttddddtt ddd d t d d dd t t ttdddddtdddddtddddtddddtddd d!td"d#d$td%dd&d'ttttttg}||dS))Nrrr6f3bzEF.FDNzFixed dialling numbersr)rrrr6f3dzEF.CCPz#Capability Configuration Parametersr(r()rrrr6f4fzEF.ECCPrV)r)r>6f44zEF.LNDzLast Number Dialledr)r6f49zEF.SDNzService Dialling Numbersr6f4azEF.EXT1zExtension1 (ADN/SSC)6f4bzEF.EXT2zExtension2 (FDN/SSC)6f4czEF.EXT3zExtension3 (SDN)6f4dzEF.BDNzBarred Dialling Numbers6f4ezEF.EXT4zExtension4 (BDN/SSC)r)rrrr LinFixedEFrrr)rFr:rOrrrr add_files)rurrrrfilesrs ryrzDF_TELECOM.__init__KssASt$AA&AAA HH vH3KQR S S S HH 6A8 U U U 6 JT\ ^ ^ ^ KK II II 64+@a H H H 64+E1 M M M 64,B C C 64,B C C 64,> ? ? vH3L M M M 64,B C C II HH NN OO HH HH1 4 ur{)rYrZNrDrs@ryrXrXJs=r{rXc6eZdZdgZ d fd Zd Zd ZxZS) EF_LP)24rm6f05NEF.LPrNrLanguage PreferencecVt||||||dSNrrrr5rr)rurrrr5rrrs ryrzEF_LP.__init__rs/ 4dDRYZZZZZr{c t|Srr)ruin_binrs ryrzEF_LP._decode_record_binvs6{{r{c t|Sr)h2bruin_jsonrs ry_encode_record_binzEF_LP._encode_record_binys7||r{)rnNrorprrqr~rrrrrr{rrs@ryrlrlnsu  OUV+[[[[[[r{rlceZdZdddifdddifgZdfd Zd Zd ZedGddeZ xZ S)EF_IMSI082982608200002080imsi2280628000002080829261011608457402620111064875046f07NEF.IMSIIMSIr r ct||||||xj||gz c_dSNr4)rrshell_commandsAddlShellCommandsrurrrrr5rs ryrzEF_IMSI.__init__sQ 4dDIII  6 6t < <==r{c$dt|iSNr)r ruraw_hexs ry _decode_hexzEF_IMSI._decode_hexs))**r{c ,t|dSr)r ruabstractrs ry _encode_hexzEF_IMSI._encode_hexs()))r{File-Specific Commandsc0eZdZdeffd ZdefdZxZS)EF_IMSI.AddlShellCommandsefcVt||_dSr)rr_ef)rurrs ryrz"EF_IMSI.AddlShellCommands.__init__s$ GG     DHHHr{argcr|}t|dkst|dkr|jj\}}|dkrt|dt|z dkr|d}|t|d}|jjd||zi\}}|dkr@|r@|j|jjj|dSdSdStdtd) z Change the plmn part of the IMSIrr9000rr"Nz&PLMN length does not match IMSI lengthzPLMN has wrong length!) stripr_cmdlchanread_binary_decupdate_binary_dec poutput_json selected_file decode_hexr)rurplmndataswrmsins rydo_update_imsi_plmnz-EF_IMSI.AddlShellCommands.do_update_imsi_plmns.99;;D4yyA~~Ta!Y_<<>> r<>>>>> +++***344;;;;;J;;54;;;;;r{r~cLeZdZddddfddddfgZ dfd ZdZdZxZS) EF_PLMNsel22F86022806)mccmnc3304203340206f30N EF.PLMNselrr6Nrc Htj|f|||||d|dS)N)rrrr5rr rurrrrr5rrrs ryrzEF_PLMNsel.__init__7d4dDRYdd]cdddddr{c @|dddkrdSt|SNrffffff)r ruin_hexrs ry_decode_record_hexzEF_PLMNsel._decode_record_hexs( "1": ! !4F## #r{c J|dkrdSt|d|dS)Nrrr)r rys ry_encode_record_hexzEF_PLMNsel._encode_record_hexs( d??8GENGEN;; ;r{)rNrrrr)r~rrrrrrrrs@ryrrs%66 8%77 9 OGV*+eeeeee$$$ <<<<<<> ( (CSJ(,(I(I*(U(U %[*g%%%a-')**<<>> ; ;CSJ(,(I(I*(U(U %[*Ds|K(D00 s|K(D00     $(z!9 :     r{rcTeZdZd dedeedeefdZdZdZdZ d Z dS) !EF_ServiceTable.AddlShellCommandsNrallocateactivatect|\}}|jjd|\}}t |}|*|r|dxxd|zzcc<n|dxxd|zzcc<|*|r|dxxd|zzcc<n|dxxd|zzcc<|jjt||\} }|S)Nr)roffsetrr)r)rrrr read_binaryrx update_binaryr) rurrrrrhex_datarr total_datas ry_adjust_servicez1EF_ServiceTable.AddlShellCommands._adjust_services(7(T(TU_(`(` %[*9?66a 6TTLHbx==D#2GGGZ0GGGGGGGj11GGG#2GGGZ0GGGGGGGj11GGG!Y_::3t99[:YYNJIr{cN|t|ddS)z Allocate a service within EF.SSTTrNrrrurs rydo_sst_service_allocatez9EF_ServiceTable.AddlShellCommands.do_sst_service_allocate '  Sd ; ; ; ; ;r{cN|t|ddS)z"Deallocate a service within EF.SSTFrNrrs rydo_sst_service_deallocatez;EF_ServiceTable.AddlShellCommands.do_sst_service_deallocate'  Se < < < < z#EF_ACC...;s+SSSAq 1 1AKSSSr{r+)r)r.s`ryzEF_ACC.;s"SSSSrSSSr{00000001r0002r0100r8000r)802brr6f78NEF.ACCAccess Control Classrrc tj|f||||d|dtdD}tt t ||_dS)Nr4cHg|]}d|tz  Sr*)r+r)r,r-s ry z#EF_ACC.__init__..Is)===a""T)===r{r+)rrr ByteSwapped BitsSwappedrr) rurrrrr5rflagsrs ryrzEF_ACC.__init__EsfS4dDSSFSSS==599===%k)U2C&D&DEEr{)r7Nr8r9r:)r~rracc_listrrrrs@ryr'r'7sTSHhhjj "hhqkk #hhqkk #hhqkk #hhrll $hhq1Qr** ,  O4<39FFFFFFFFFFr{r'c4eZdZddddddfgZd fd ZxZS)EF_LOCI7802570222f8100978000078025702 22f8100978rupdated)tmsilai tmsi_time lu_status6f7eNEF.LOCILocation Informationr$r$c :t|||||tdtt dz dtt dz dt z dt tdd d d z |_dS) Nr4rHrrIrrJrKrrrr)rG not_updatedplmn_not_allowedlocation_area_not_allowed) rrrr$rrEnumr#rrs ryrzEF_LOCI.__init__Rs 4dDIII  588(<(XZeflZl!,T$qcdLM.O.O.O"OPPr{)rLNrMrNrOrrs@ryrCrCMsg&"@rrrrrr"r#rr rurrrr5rrFlagsConstructrs ryrzEF_eMLPP.__init__s|S4dDSSFSSS" Ar"FFF ^ #%;N%JLLr{)rNrr:rrrs@ryrrs UT'+dDKK38ud[`5:UTY-\-\ OEKELLLLLLLLLLr{rc BeZdZddddddddddifgZ d fd ZxZS) EF_AAeM3cauto_answer_prio_levelsFTr6fb6NEF.AAeMrr"Automatic Answer for eMLPP Servicec tj|f||||d|ttddddddd }t d |z |_dS) Nr4rrrrr+r>rrrrrs ryrzEF_AAeM.__init__snS4dDSSFSSS" Ar"FFF !:>!IJJr{)rNrrrrrs@ryrrs +Et\`6:TSX.[.[] _ODJ:KKKKKKKKKKr{rc$eZdZ dfd ZxZS) EF_CBMID6f48NEF.CBMIDrr3Cell Broadcast Message Identifier for Data Downloadc ztj|f|||||d|tt|_dSrsr!r$s ryrzEF_CBMID.__init__r%r{)rNrrrrrDrs@ryrrsCWXK//////////r{rc$eZdZ dfd ZxZS) EF_ECC6fb7NEF.ECCrr)rEmergency Call Codesc tj|f|||||d|ttt d|_dS)Nrtr)rrr"rrrr$s ryrzEF_ECC.__init__sRd4dDRYdd]cddd%jq&:&:;;r{)rNrrrrrDrs@ryrrsCST,<<<<<<<<< Network's Indication of Alertingc tj|f||||d|tdtz dtz |_dS)Nralerting_categorycategory)rrrr GreedyBytesrrVs ryrzEF_NIA.__init__sTY4dwYYRXYYY  & ;(>@@r{)rNrrrrDrs@ryrrsMEL9@@@@@@@@@@r{rc0eZdZddddfgZd fd ZxZS) EF_Kc837d783609a3858f05837d783609a3858fr)kccksn6f20NEF.KcCiphering key Kcrc tj|f||||d|tdtt dz dt z |_dS)Nr4rrr)rrrr$rrrr8s ryrzEF_Kc.__init__sYS4dDSSFSSS jq&:&:!:F6MJJr{)rNrrrrrs@ryrrs_ (:A G GIOKKKKKKKKKKr{rc4eZdZddddddfgZd fd ZxZS) EF_LOCIGPRSffffffffffffff22f8990000ff01ffffffffr 22f8990000ffrQ)ptmsi ptmsi_sigrai rau_status6f53N EF.LOCIGPRSGPRS Location Informationr_c dt|||||tdtt dz dtt dz dtt dz dt t d d d d z |_dS) Nr4rrrrrrrrrr)rGrQrRrouting_area_not_allowed)rrrr$rrTr#rrs ryrzEF_LOCIGPRS.__init__s 4dDIII E!HH)=)=!={:V[\]V^V^K_K_?_!&z%((';';!;!-d4PQdeLM/O/O/O"OPPr{)rNrrr_rrs@ryrrsg (h~]j l l oOPPPPPPPPPPr{rczeZdZdddddgdfddddgdfd dd gd dfgZdfd ZdZdZedZxZ S) EF_xPLMNwAcT 62F210400026201 E-UTRAN NB-S1 E-UTRAN WB-S1)rract 62F2108000UTRAN 62F220488C02)rr EC-GSM-IoTGSMNG-RAN1234NrINrc Htj|f|||||d|dSrsrrs ryrzEF_xPLMNwAcT.__init__ s7d4dDRYdd]cdddddr{c @|dddkrdSt|Sr)rrs ryrzEF_xPLMNwAcT._decode_record_hexs( "1": ! !4"6** *r{c |dkrdSt|d|d}||d}||zS)N ffffff0000rrr)r enc_act)rurzrhplmnrs ryrzEF_xPLMNwAcT._encode_record_hexsF d??<WU^WU^<zcdma2000 1xRTTr+rri@i`iPrrz%04Xr)in_listu16s ryr zEF_xPLMNwAcT.enc_acts  g   6MC w   6MC G # # 6MC g % % 6MC w & & 6MC g % %/W*D*D 6MCC  ' ' 6MCC  ' ' 6MC G    7 7 6MCC g   6MCC W $ $ 6MC~r{)rNNNrr) r~rrrrrrr r rrs@ryrrs to<`bbd tgKIIK t<}<}<} BO eeeeee+++ \r{rc$eZdZ dfd ZxZS) EF_CPBCCH6f63N EF.CPBCCHrr(rrSc tj|f|||||d|tdtz |_dS)Nrtcpbcch)rrrr#rr$s ryrzEF_CPBCCH.__init__=sId4dDRYdd]cddd '!122r{)rNrrrrSrDrs@ryrr<sCVW*3333333333r{rc$eZdZ dfd ZxZS) EF_InvScan6f64N EF.InvScanrIOnvestigation Scanc ~tj|f||||d|ttdd|_dS)Nr4rr)in_limited_service_modeafter_successful_plmn_selection)rrr"r#rrs ryrzEF_InvScan.__init__DsQS4dDSSFSSS# !QPPPr{)rNrrr rDrs@ryrrCsMFL+PPPPPPPPPPr{rc LeZdZdddddddddddd d ddd fgZdfd ZxZS)EF_CFIS 0100ffffffffffffffffffffffffffffrFr)voicefaxrrrTrrr) msp_numbercfu_indicator_statusrrrrext7_record_id6fcbNEF.CFISr_rc tj|f|||dd|d|z}tdtz dt dt z dt z dt z d t d z z d tz d tz d ttttdz dtz |tz |_ dS)N)r+r<rrr)r*r'r(rrrrrrr"r) rrrrrrrrrkrrrrrs ryrzEF_CFIS.__init__TsZ4dxZZSYZZZ$s* f!4!7 '$,PUVZPZ\bcg\ginovwxoyoyiy8z8z!z!-f!4!*6!1!-.@DQVWYQZQZOOA\A\.].]!]!.v!5!)& 22r{)r,Nr-r_rrrs@ryr%r%Ks ,uU\ajk4m4mDG\`gkCUDUDEGWZnq  s s uO 2 2 2 2 2 2 2 2 2 2r{r%ceZdZGddedZGddedZGdd eeeg Zdfd ZxZ S)EF_PNNc$eZdZeeZdS)EF_PNN.FullNameForNetworkNr~rrr$rrrr{ryFullNameForNetworkr2c Z ,, r{r4Ctagc$eZdZeeZdS)EF_PNN.ShortNameForNetworkNr3rr{ryShortNameForNetworkr:hr5r{r;EceZdZdS)EF_PNN.NetworkNameCollectionNr~rrrr{ryNetworkNameCollectionr>m r{r@nested6fc5NEF.PNNr[c ftj|f|||d|tj|_dSN)rrr)rrr0r@_tlvrs ryrzEF_PNN.__init__ps9H4dHHHHH0 r{)rDNrEr[) r~rr BER_TLV_IEr4r;TLV_IE_Collectionr@rrrs@ryr0r0`s-----ZT---- -----jd----      1;MOb:c    1111111111r{r0cLeZdZdddddddfdd d d dd dfgZdfd ZxZS)EF_OPL62f2100000fffe01z262-01r1fffe)mcc_mnclac_minlac_maxr)rI pnn_record_id216354789abcde12z123-456789abcder/6fc6NEF.OPLrrr\c Rtj|f||||d|tdtdtt dz dt t dz dt t dz z dt z |_dS) NrrIrOrrPrrQrR)rrr PlmnAdapterrr$rrrVs ryrzEF_OPL.__init__|sY4dwYYRXYYY vi E!HH8M8M.M!*:eAhh+?+?!?:V[\]V^V^K_K_A_(a(a"abqrxbxzzr{)rVNrWrXr\rrs@ryrLrLus  (VPPcd f f i  )fQQdf h h kO zzzzzzzzzzr{rLc6eZdZdddddddfgZd fd ZxZS) EF_MBI 0100000000rr) mbi_voicemailmbi_fax mbi_email mbi_other mbi_videocall6fc9NEF.MBIrrMailbox Identifierc tj|f||||d|tdtz dtz dtz dtz dt tz |_dS)Nrr^r_r`rarb)rrrrrrrVs ryrzEF_MBI.__init__srY4dwYYRXYYY !769I;W]K]!,V!3_YvEVEV5VXXr{)rcNrdrerfrrs@ryr\r\si 111_` b b eOXXXXXXXXXXr{r\cLeZdZdddddddddddddfgZdZ d fd ZxZS)EF_MWIS 0000000000F voicemailr(emailother videomailrN) mwi_statusnum_waiting_voicemailnum_waiting_faxnum_waiting_emailnum_waiting_othernum_waiting_videomailT6fcaEF.MWISrrr^c tj|f||||d|tdttdddddz d t z d t z d t z d t z d t t z |_dS)Nrrprrrrr+rkrqrrrsrtru)rrrr"r#rrrrVs ryrzEF_MWIS.__init__sY4dwYYRXYYY iqXYabnp.q.q.q!q!8!?!26!9;Nv;U!4V!;=TU^_eUfUf=fhhr{)rvNrwrxr^rrs@ryriris ',UUUZ!!;@PRacj+k    FO:8888888888r{rceZdZGddedZGddedZGdd eeeeg Z dfd Z xZ S)EF_MMSUPc$eZdZeeZdS)!EF_MMSUP.MMS_UserPref_ProfileNameN)r~rrrrrrr{ryMMS_UserPref_ProfileNamers%%k22 r{rrbr7ceZdZdS)EF_MMSUP.MMS_UserPref_InfoNr?rr{ryMMS_UserPref_InforrAr{rrceZdZdS)EF_MMSUP.MMS_User_PreferencesNr?rr{ryMMS_User_Preferencesrrr{rrB6fd1NEF.MMSUPrpMMS User Preferencesc htj|f||||d|tj|_dS)Nr)rrrrrHrVs ryrzEF_MMSUP.__init__s<Y4dwYYRXYYY1 r{)rNrrpr) r~rrrIrrrJrrrrrs@ryrrs33333:43333     JD         0'9;SUf&g    HQ,2222222222r{rc$eZdZ dfd ZxZS) EF_MMSUCP6fd2N EF.MMSUCPrprac Ftj|f||||d|dSrrrs ryrzEF_MMSUCP.__init__s3S4dDSSFSSSSSr{)rNrrprarDrs@ryrrsMEN8TTTTTTTTTTr{rc:eZdZdddifgZd fd Zd Zd ZxZS) EF_ICCID988812010000400310f0iccid89882110000004300102fe2rEF.ICCIDICC IdentificationcTt||||ddS)N)r"r"r4rrurrrrrs ryrzEF_ICCID.__init__s, 4dHMMMMMr{c$dt|iSNr)rrs ryrzEF_ICCID._decode_hexs7++,,r{c ,t|dSr)r rs ryrzEF_ICCID._encode_hexs'*+++r{)rrrr)r~rrrrrrrrs@ryrrsv G-B"DFONNNNNN---,,,,,,,r{rc4eZdZgdZd fd ZdZdZxZS) EF_PL))6465de)656een)ffffN2f05rEF.PLPreferred LanguagescVt||||dddS)Nrr)rrrrr5rrs ryrzEF_PL.__init__s; 4d"AI  ? ? ? ? ?r{c <|dkrdS|dSNsascii)decode)rubin_datars ryrzEF_PL._decode_record_bins$ { " "4??7++ +r{c 4|dS|dSr)encoderys ryr{zEF_PL._encode_record_bins ?;>>'** *r{)rrrrr|rs@ryrrslO ??????,,, +++++++r{rc^eZdZdfd ZedGddeZxZS) DF_GSM7f20DF.GSMGSM Network related filesc pt||||xj|gz c_gt t t ttddddttddddtd td dd d dtddddtddddttdddddttdddddttddd d!d"t!t#td#dd$d%d&t%t't%d'dd(d)t'd*dd+d,t)t+t-t/t1t3t5t7t d-dd.d/t9td0dd1d2t;d3dd4d5t;d6dd7d8t;d9dd:d;t=t?tAtCtEdtGtItKtMd?dd@dAtMdBddCdDtOtQtMdEddFdGtStUtW}|,|dS)HNr\6f31z EF.HPPLMNz"Higher Priority PLMN search period)r6f38zEF.SSTzSIM service table)rr+)rrr56f39zEF.ACMzAccumulated call meterr)rr6f3ezEF.GID1r*6f3fzEF.GID2r,6f41zEF.PUCTz!Price per unit and currency table)rr)rr56f74zEF.BCCHzBroadcast control channelsr6f7bzEF.FPLMNzForbidden PLMNs)r&r&6faezEF.PhasezPhase identificationr6fb3zEF.VBSzVoice Broadcast Service6fb4zEF.VBSSzVoice Broadcast Service Status6f52z EF.KcGPRSzGPRS Ciphering key KcGPRS6f54zEF.SUMEzSetUpMenu Elements6f60z EF.PLMNwAcTrM6f61z EF.OPLMNwAcTrO6f62z EF.HPLMNwAcTrQ6fc7zEF.MBDNr]6fc8zEF.EXT6zExternsion6 (MBDN)6fcczEF.EXT7zExternsion7 (CFIS)6fcfzEF.EXT8zExtension8 (MMSN))-rrrrrlr~rrrrr EF_SST_mapCyclicEFr rr'rCrVrvrrrrrrrrrrrrrr0rLrr\rir%rFr{rrrrri)rurrrrjrs ryrzDF_GSM.__init__ s> St$777  6 6 8 899A GGA IIA  GGA  LL A &$ C E E E A  KKA  FD(!4JW V V VA  VT82F D D DA  &$ 8R S S SA  &$ 8R S S SA  HHA  &$ B Q Q QA " II#A $ &$ ;( L L L%A ( HH)A * vtZ-H > > >+A . II/A 0 GG1A 2 &$ 5F D D D3A 6 II7A 8 JJ9A : FD(1J K K K;A < VT9: < < <=A @ JJAA B IICA D JJEA F HHGA H JJIA J HHKA L HHMA N HHOA P &$ 2M N N NQA R MMSA T &$ 8L M M MUA V }T V V VWA Z ~X Z Z Z[A ^ ~E G G G_A b KKcA d LLeA f HHgA h HHiA j 641K L L LkA l HHmA n IIoA p IIqA r 641E F F FsA t 641E F F FuA v IIwA x IIyA z 641D E E E{A | KK}A ~ JJA @ KKAA D ur{zApplication-Specific CommandsceZdZfdZeZedede edZ xZ S)DF_GSM.AddlShellCommandscHtdSrr)rurs ryrz!DF_GSM.AddlShellCommands.__init__Us GG       r{RANDzRandom challenge)rhelpc|jjj|j\}}|j|dS)zPerform GSM Authentication.N)rrsccrun_gsmrr)ruoptsrrs rydo_authenticatez(DF_GSM.AddlShellCommands.do_authenticate[s@,44TY??JT2 I " "4 ( ( ( ( (r{) r~rrrargparseArgumentParserauthenticate_parser add_argument is_hexstrcmd2with_argparserrrrs@ryrrSs     '5577((iFX(YYY  0 1 1 ) ) 2 1 ) ) ) ) )r{r)rrr)r~rrrrrrrrs@ryrr sFFFFFFP:;; ) ) ) ) )J ) )<; ) ) ) ) )r{rcbeZdZdZfdZededefdZe de ddfdZ xZ S) CardProfileSIMr<c dddddddidd d d d d dddddddddddddddd}ttttg}tg}t ddd d!|||"dS)#NzNormal ending of the commandzknormal ending of the command, with extra information from the proactive SIM containing a command for the MEzIlength XX of the response data given in case of a SIM data download errorzlength XX of the response data)r91xx9exx9fxx9300zkSIM Application Toolkit is busy. Command cannot be executed at present, further normal commands are allowedzKcommand successful but after using an internal update retry routine X timeszmemory problem)920x9240zno EF selectedzout of range (invalid address)z&file ID not found or pattern not foundz%file is inconsistent with the command)9400940294049408zno CHV initializedzVaccess condition not fulfilled, unsuccessful CHV verification or authentication failedz in contradiction with CHV statusz)in contradiction with invalidation statusz;unsuccessful verification, CHV blocked, UNBLOCK CHV blockedz/increase cannot be performed, Max value reached)980298049808981098409850zincorrect parameter P3zincorrect parameter P1 or P2z-unknown instruction code given in the commandz,wrong instruction class given in the commandz*technical problem with no diagnostic given)67xx6bxx6dxx6exx6fxx)NormalzPostponed processingzMemory managementzReferencing managementzSecurity managementzApplication independent errorsSIMz GSM SIM Carda0r1)rclasel_ctrl files_in_mfraddons)rrrXrrrr)rurrjr'rs ryrzCardProfileSIM.__init__fs7Fc8 F%f("" )8@? ''-p:CUI $$16GFD //9# # L JJ GG LL HH     ^"(eV  U U U U Ur{resp_hexrclt|}dddd}dddd}d iiid }t|d d |d <|d |vr||d n|d }||dd d<|dvrut|dd d|dd<t|dd|d<|d|d<|d|d<t|d|d<n|dvrt|dd d|d<|d|vr||dn|d}||dd d<|dkr'|d}||dd <|d|z|dd!<t|d"d#|d$<|d%d&zd'krd(|d)<n|d%d zrd*|d)<nd+|d)<|S),N transparent linear_fixedcyclic)rrrmfdf working_ef)rrrfile_descriptor_byte)file_descriptorproprietary_inforrfile_idr1 file_type)r-r.rbigr2available_memoryr'r(file_characteristicsnum_direct_child_dfr)num_direct_child_efr+num_chv_unblock_adm_codes)r/ file_size structure record_len num_of_recrr"access_conditionsr$rroperational_activatedlife_cycle_status_intoperational_deactivated terminated)rxrr from_bytes)r(resp_binstruct_of_file_maptype_of_file_maprr4 file_structr=s rydecode_select_responsez%CardProfileSIM.decode_select_responsesd x==     ' !#    Xac]++I*21+9I*I*I%Xa[''OWXY{ FO 56{C  $ $:=..RSTURUX]:^:^C" #$6 7*-hr"uo*>*>C& ')1"C% &)1"C% &/28B':':C# $|d"a''/F+,,"$ rhsL 2 ++++++eeeeeeeeeeeeeeeeee77777777OOOOOOOOOOOO!!!!!!<<+<%<$ <  < 2 <<u<x< < <<#<+<"< "!<"#<<$(%<& '<()<*9+<,6-<.A/<0$1<2"3<4"5<67<89<:;<<2=<>'?<@ A<B)C<D#E<<<F&G<H5I<J8K<LM<N O<P/Q<R;S<T U<V>W<XBY<Z/[<\]<^_<`6a<bc<d'e<fg<<h "++.,*w<<< J 5 5 5 5 5 5 5 522222Z2224ZZZZZZZZZ>0N0N0N0N0N 0N0N0Nf2V2V2V2V2Vj2V2V2Vj \ \ \ \ \m \ \ \OOOOOjOOO_____Z___iiiiiZiiiH     J   &;&;&;&;&;m&;&;&;T<<<<<<<<,44444 444Q=Q=Q=Q=Q=mQ=Q=Q=j     ]   &/////j///FFFFF]FFF, P P P P Pm P P P" " " " " M" " " J/////j/// ; ; ; ; ;} ; ; ;LLLLL}LLL" K K K K Km K K K/////w///<<<<