*g(:dZddlmZmZmZmZmZddlTddlTddl Tddl Tddl m Z m Z mZmZmZddlmZmZddlmZddlTddlZddlmZid d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0ZGd1d2eZGd3d4eZGd5d6eZGd7d8eZ Gd9d:eZ!Gd;deZ#Gd?d@eZ$GdAdBe%Z&dCdDdEdFiZ'GdGdHe(Z)dS)Iz/ Various constants from 3GPP TS 31.103 V18.1.0 )StructSwitchthisBytes GreedyString)*)EF_ADEF_SMSEF_SMSSEF_SMSREF_SMSP)ADF_USIMEF_FromPreferred)EF_UServiceTableN)EF_ARRzP-CSCF addressz(Generic Bootstrapping Architecture (GBA)z HTTP Digestz+GBA-based Local Key Establishment Mechanismz3Support of P-CSCF discovery for IMS Local Break OutzShort Message Storage (SMS)z#Short Message Status Reports (SMSR)zVSupport for SM-over-IP including data download via SMS-PP as defined in TS 31.111 [31] z%Communication Control for IMS by ISIM zSupport of UICC access to IMS zURI support by UICC zMedia Type support zIMS call disconnection causez(URI support for MO SHORT MESSAGE CONTROLMCPTTzAURI support for SMS-PP DOWNLOAD as defined in 3GPP TS 31.111 [31]zFrom PreferredzIMS configuration datazXCAP Configuration Dataz WebRTC URIzMuD and MiD configuration datazIMS Data Channel indication)cNeZdZdddifgZGddedZd fd ZxZS) EF_IMPIf803137333830303630303030303031303140696d732e6d6e633030302e6d63633733382e336770706e6574776f726b2e6f7267naiz1738006000000101@ims.mnc000.mcc738.3gppnetwork.orgc$eZdZeeZdS) EF_IMPI.naiN__name__ __module__ __qualname__ Utf8Adapter GreedyBytes _construct=/home/jenkins/workspace/simtester-sanitize/pySim/ts_31_103.pyr,r.F [-- r7tag6f02rEF.IMPIIMS private user identityc ftjd||||d|tj|_dSNfidsfidnamedescr6)super__init__r*r,_tlvselfrCrDrErFkwargs __class__s r8rHzEF_IMPI.__init__Is8LSt$TLLVLLLK r7)r=rr>r?)r0r1r2_test_de_encode BER_TLV_IEr,rH __classcell__rMs@r8r*r*@s r F H KO .....jd....          r7r*cNeZdZdddifgZGddedZd fd ZxZS) EF_DOMAINF8021696d732e6d6e633030302e6d63633733382e336770706e6574776f726b2e6f7267domainz!ims.mnc000.mcc738.3gppnetwork.orgc$eZdZeeZdS)EF_DOMAIN.domainNr/r6r7r8rUrWSr9r7r:r;6f03r EF.DOMAINHome Network Domain Namec ftjd||||d|tj|_dSrA)rGrHrSrUrIrJs r8rHzEF_DOMAIN.__init__Vs9LSt$TLLVLLL$ r7)rXrrYrZ)r0r1r2rNrOrUrHrPrQs@r8rSrSNs R 9 ; >O.........%%%%%%%%%%r7rScNeZdZdddifgZGddedZd fd ZxZS) EF_IMPUn80357369703a37333830303630303030303031303140696d732e6d6e633030302e6d63633733382e336770706e6574776f726b2e6f7267impuz5sip:738006000000101@ims.mnc000.mcc738.3gppnetwork.orgc$eZdZeeZdS) EF_IMPU.impuNr/r6r7r8r_ra`r9r7r:r;6f04rEF.IMPUIMS public user identityc ftjd||||d|tj|_dSrA)rGrHr]r_rIrJs r8rHzEF_IMPU.__init__cs8LSt$TLLVLLLL r7)rbrrcrd)r0r1r2rNrOr_rHrPrQs@r8r]r][s z K M PO.....zt....!!!!!!!!!!r7r]c\eZdZfdZedGddeZxZS)EF_ISTc tdddddt|xj|gz c_dS)N6f07rzEF.ISTzISIM Service Table)rN)rGrH EF_IST_mapshell_commandsAddlShellCommands)rKrLrMs r8rHzEF_IST.__init__isP x1EyR\]]]  6 6 8 899r7zFile-Specific Commandsc0eZdZfdZdZdZdZxZS)EF_IST.AddlShellCommandscHtdSN)rGrHrKrMs r8rHz!EF_IST.AddlShellCommands.__init__ps GG       r7c||jjj}||jt |ggdS)z Activate a service within EF.ISTN_cmdlchan selected_file ust_updateintrKargrvs r8do_ist_service_activatez0EF_IST.AddlShellCommands.do_ist_service_activatess6 IO9M  $ $TYS B ? ? ? ? ?r7c||jjj}||jgt |gdS)z"Deactivate a service within EF.ISTNrsrys r8do_ist_service_deactivatez2EF_IST.AddlShellCommands.do_ist_service_deactivatexs6 IO9M  $ $TYSXXJ ? ? ? ? ?r7c|jjj}||j}|jd|zdS)aCheck consistency between services of this file and files present/activated. Many services determine if one or multiple files shall be present/activated or if they shall be absent/deactivated. This performs a consistency check to ensure that no services are activated for files that are not - and vice-versa, no files are activated for services that are not. Error messages are printed for every inconsistency found.z/===> %u service / file inconsistencies detectedN)rtrurvust_service_checkpoutput)rKrzrv num_problemss r8do_ist_service_checkz-EF_IST.AddlShellCommands.do_ist_service_check}sH!IO9M(::49EEL I  OR^^ _ _ _ _ _r7)r0r1r2rHr{r}rrPrQs@r8rlrnnsr      @ @ @  @ @ @ ` ` ` ` ` ` `r7rl)r0r1r2rHwith_default_category CommandSetrlrPrQs@r8rgrghs::::: 344`````J``54`````r7rgcteZdZdddddifdddddifd dd d difgZGd d edZdfd ZxZS)EF_PCSCF\802c0070637363662e696d732e6d6e633030302e6d63633733382e7075622e336770706e6574776f726b2e6f7267 pcscf_addressz+pcscf.ims.mnc000.mcc738.pub.3gppnetwork.orgFQDN)addresstype_of_address800501c0a80c22z 192.168.12.34IPv4&801102fe800000000000000042d7fffe530335zfe80::42:d7ff:fe53:335IPv6c eZdZedeedddz deeje e e e e e dz Z dS)EF_PCSCF.PcscfAddressrrrr)rrrrN)r0r1r2rEnumByterrrr3r4 Ipv4Adapter Ipv6Adapterr5r6r7r8 PcscfAddressrsV-dd4aaa.P.P.PP%ffT-A6Ak+6N6N6Ak+6N6N6Ak+6N6N.P.P'Q'QQRR r7rr:r;6f09N EF.P-CSCFP-CSCF Addressc ftjd||||d|tj|_dSrA)rGrHrrrIrJs r8rHzEF_PCSCF.__init__s9LSt$TLLVLLL) r7)rNrr)r0r1r2rNrOrrHrPrQs@r8rrs h )Vkqss u x  VUU W Z 2 )AV\^^ ` c ORRRRRztRRRR**********r7rc eZdZdfd ZxZS)EF_GBABP6fd5NEF.GBABPGBA Bootstrappingc tjd||||d|tdtz dtz dtz |_dS)NrBrandb_tid key_lifetimer6)rGrHrLVr5rJs r8rHzEF_GBABP.__init__sULSt$TLLVLLL !(!/!244r7)rNrrr0r1r2rHrPrQs@r8rrs=4444444444r7rceZdZGddedZGddedZGdd eeeg Zdfd ZxZ S)EF_GBANLc eZdZedeeejjdz z de edz Z dS)EF_GBANL.NAF_IDfqdnrua_spiN) r0r1r2rr3rr_ total_len HexAdapterr5r6r7r8NAF_IDrs^VF;;uuTV5Ea5G/H/H#I#II$ZZa%9%99;; r7rr:r;c$eZdZeeZdS)EF_GBANL.B_TIDNr/r6r7r8B_TIDrr9r7rceZdZdS)EF_GBANL.GbaNlCollectionN)r0r1r2r6r7r8GbaNlCollectionrs r7r)nested6fd7NEF.GBANL GBA NAF Listc ftjd||||d|tj|_dSrA)rGrHrrrIrJs r8rHzEF_GBANL.__init__s9LSt$TLLVLLL, r7)rNrr) r0r1r2rOrrTLV_IE_CollectionrrHrPrQs@r8rrs;;;;;;;;;..... ....     +VUO    ----------r7rcXeZdZdddifdddifgZGdded Zdfd ZxZS) EF_NAFKCAV80296273662e696d732e6d6e633030302e6d63633733382e7075622e336770706e6574776f726b2e6f7267naf_key_centre_addressz)bsf.ims.mnc000.mcc738.pub.3gppnetwork.orgd8030656e65746e61667830312e696d732e6d6e633030302e6d63633733382e7075622e336770706e6574776f726b2e6f7267z0enetnafx01.ims.mnc000.mcc738.pub.3gppnetwork.orgc$eZdZeeZdS)EF_NAFKCA.NafKeyCentreAddressNr/r6r7r8NafKeyCentreAddressrr9r7rr:r;6fddN EF.NAFKCANAF Key Centre Addressc ftjd||||d|tj|_dSrA)rGrHrrrIrJs r8rHzEF_NAFKCA.__init__s9LSt$TLLVLLL1 r7)rNrr)r0r1r2rNrOrrHrPrQs@r8rrs b $&Q S V p $&X Z \O .....jd....2222222222r7rc*eZdZ dfd ZdZxZS) ADF_ISIMa0000000871004TADF.ISIMNISIM ApplicationcHt||||||ttt t t ddttdtdtdtdtdtdtdtd t!d t#d t%d t'd t)dt+dt-dt/dg}|||xjt5jgz c_dS)N)aidhas_fsrCrDrErF6f06rr)servicer)rr)rrrrr#r$r%r&r'r()rGrHr*rSr]r rrgrrrrr r r r EF_UICCIARIrEF_IMSConfigDataEF_XCAPConfigData EF_WebRTCURIEF_MuDMiDConfigData EF_AC_GBAUAPI EF_IMSDCI add_filesrkrrl) rKrrrErCrDrFfilesrMs r8rHzADF_ISIM.__init__s| SSt$UYZZZ II KK II GG 64 HH Q    Q    Q    a 5 ! ! ! E " " " E " " " A     # # # R ( ( ( R ( ( ( b ) ) )  $ $ $  + + + ! $ $ $ b ! ! !- 0 u  : < <==r7cJtjj|Srp)pySim ts_102_221CardProfileUICCdecode_select_response)rKdata_hexs r8rzADF_ISIM.decode_select_responses/FFxPPPr7)rTrNNr)r0r1r2rHrrPrQs@r8rrsZZ^(>>>>>>@QQQQQQQr7rzSecurity managementz#Authentication error, incorrect MACz4Authentication error, security context not supported)98629864ceZdZfdZxZS)CardApplicationISIMcrtdttdS)NISIM)adfsw)rGrHrsw_isimrqs r8rHzCardApplicationISIM.__init__s, XZZG<<<<rs,@?????????????DDDDDDDDDDDDDD66666666444444$$$$######1}4  <  $ ,_.'&2 K!"#$ !!(%- 4      m     % % % % % % % % ! ! ! ! !j ! ! !````` ```D*****z****44444}444 - - - - -z - - - 2 2 2 2 2 2 2 2"Q"Q"Q"Q"Qw"Q"Q"QN5F =====/=====r7