y> rcd|jjji}|j|||||S)z,Command Line tab completion for TERMINATE DFr0r1r3r7s rcomplete_terminate_dfz&Ts102222Commands.complete_terminate_dfOr=rc|js|jddS|jj|j}|jjj|j\}}dS)aTerminate the specified EF. DANGEROUS! See TS 102 222 6.8. This is a permanent, one-way operation on the card. There is no undo, you can not recover a terminated EF. The only permitted command for a terminated EF is the DLETE FILE command.r?N) r@r!r"r#r$rr% terminate_efr'r(s rdo_terminate_efz Ts102222Commands.do_terminate_efTrCrcd|jjji}|j|||||S)z,Command Line tab completion for TERMINATE EFr0r1r3r7s rcomplete_terminate_efz&Ts102222Commands.complete_terminate_ef_r=rz--force-terminate-cardzRI really want to permanently terminate the card. It will not be usable afterwards!c|js|jddS|jjj\}}dS)zTerminate the Card. SUPER DANGEROUS! See TS 102 222 Section 6.9. This will permanently brick the card and can NOT be recovered from!zFRefusing to permanently terminate the card, please read the help text.N)force_terminate_cardr!r"r#r%terminate_card_usage)r)r*r,r-s rdo_terminate_card_usagez(Ts102222Commands.do_terminate_card_usagehsK(  I  e f f f Fy*??AA rzrequired argumentszoptional argumentsz--ef-arr-file-idTz.Referenced Security: File Identifier of EF.ARR)requiredrrz--ef-arr-record-nrz0Referenced Security: Record Number within EF.ARRz --file-sizezSize of file in octetsz --structure) transparent linear_fixedber_tlvz!Structure of the to-be-created EF)rOrchoicesrz--short-file-idz+Short File Identifier as 2-digit hex stringz --shareablezShould the file be shareable?z--record-lengthzLength of each record in octetsFILE_IDz)File Identifier as 4-character hex stringcXd|jd|jdi}|jdkri|js|jddS|j|d<|j|jz|d<|d|dz|jkrt d n'|jd kr|jd dSt| t|j td t|j |j d t|j t|j g}t#|}|jjjt+|\}}|jj|jjjdS)zNCreate a new EF below the currently selected DF. Requires related privileges.file_descriptor_byte working_ef shareable file_type structurerQz8you must specify the --record-length for linear fixed EFN record_len num_of_recz/File size not evenly divisible by record lengthrRz/BER-TLV creation not yet fully supported, sorrydecodedoperational_activatedef_arr_file_idef_arr_record_nrchildren)rYr[ record_lengthr!r" file_size ValueErrorFileDescriptorFileIdentifierrTLifeCycleStatusIntegerSecurityAttribReferencedrbrcFileSizeShortFileIdentifier short_file_id FcpTemplater#r% create_filerto_tlv select_filer4)r)r*file_descriptoriesfcpr,r-s r do_create_efzTs102222Commands.do_create_efs #!^)!^%%  >^ + +%    ![\\\,0,>OL ),0Nd>P,POL )|,|/LLPTP^^^ !RSSS_ ^y ( ( I  N O O O Fo666t|8\8\8\%.EFFF'4CVEIEZ1]1]^^^///"4+=>>> 3'''y*66s3::<<7H7HII  ##DIO$ABBBBBrz sysmoISIM-SJA optional argumentsz--aidz0Application ID (creates an ADF, instead of a DF)z--total-file-sizez.Physical memory allocated for DF/ADi in octetsz--permit-rfm-create)rz--permit-rfm-delete-terminatez--permit-other-applet-createz&--permit-other-applet-delete-terminatecd|jdddi}g}|t||t|j|jr(|t |j|td|t|j |j d|j r(|t|j |j s|js|js|jrM|j |j|j|jd}|t#t%|g t'| }|jjjt1|\}}|jj|jjjd S) zNCreate a new DF below the currently selected DF. Requires related privileges.rVdf no_info_givenrXr^r`ra) rfm_createrfm_delete_terminateother_applet_createother_applet_delete_terminaterdN)rYappendrirjrTaidDfNamerkrlrbrctotal_file_size TotalFileSizepermit_rfm_createpermit_rfm_delete_terminatepermit_other_applet_create$permit_other_applet_delete_terminateProprietaryInformationToolkitAccessConditionsrpr!r#r%rqrrrrsr4)r)r*rtru toolkit_acrvr,r-s r do_create_dfzTs102222Commands.do_create_dfs #!^!,%%  >/:::;;; >$,777888 8 1 JJvdh/// 0 0 0 )2IJJJKKK +tGZIMI^5a5abbb c c c   D JJ}T-ABBB C C C  ! gT%E gIh glpmV g!3'+'G&*&E040Y J JJ-8OXb8c8c8c7deee f f f3'''y*66s3::<<7H7HII  ##DIO$ABBBBBrz!Name or FID of file to be resizedc|jj|j}t |jt |jg}t|}|jjj t| \}}|jj |jjjdS)zTResize an existing EF below the currently selected DF. Requires related privileges.r^rdN)r!r#r$rrjr'rmrgrpr% resize_filerrrrsr4)r)r*r+rurvr,r-s r do_resize_efzTs102222Commands.do_resize_efs IO 1 1$) < <ae,,,///13'''y*66s3::<<7H7HII  ##DIO$ABBBBBrcd|jjji}|j|||||S)z)Command Line tab completion for RESIZE EFr0r1r3r7s rcomplete_resize_efz#Ts102222Commands.complete_resize_efr=rN)(__name__ __module__ __qualname____doc__argparseArgumentParserdelfile_parser add_argumentstrcmd2with_argparserr.rr< termdf_parserrBrErHrJ tcard_parserrN create_parser_action_groupspopadd_argument_groupcreate_requiredcreate_optionalrrr rwcreatedf_parsercreatedf_requiredcreatedf_optionalcreatedf_sja_optionalrresize_ef_parserresize_ef_requiredrrrrrr&s4EE,X,..N 0f hhhS7STTTT((>>)(>a$s)aaaa ,H+--MyY[[[vC6HIIIT''??('?a49aaaa T''??('?a49aaaa +8*,,L6|egggT&&BB'&B,H+--M $$&&&#667KLLO#667KLLO  !3dTD EEE  !5:]O PPP  KVn ooo  CQ{Q{Q{&I!KKK  !2Cp qqq  |Ji jjj  !2Kl mmmyy?jkkkT''CC('C@.h-//O"&&((('::;OPP'::;OPP+>>?abb""#53VF"GGG""#7$Z_Q"RRR""=Lk"lll""7As"ttt""#6[O"AAA&&'<\&RRR&&'F|&\\\&&'El&[[[&&'OXd&eee  Al mmmT))CC*)CB/x.00#''))))<<=QRR##MD{Yq#rrr!!&s9\!]]]T)**CC+*CaS aaaaaarr)typingrrrrr osmocom.utilsrrrr pySim.ts_102_221bytesboolintrrrrrrs( 22222222AAAAAAAAAAAA4E444s4u4444;<<@a@a@a@a@az@a@a=<@a@a@ar